Skip to main content

Module flow_engine

Module flow_engine 

Source
Expand description

Host-driven flows, the shared engine of the CLI, the MCP server and the TUI: create the issue, make the branch on the host, find what the host or a bot made for an issue, wait for it. Everything here is a function over a HostingClient, so a fake transport tests it and the three frontends cannot drift apart. The loops (sleeping, cancelling, drawing a spinner) are the frontend’s: it asks find_for_issue again after backoff.

Structs§

Found
What the host (or a bot) made for an issue, as far as it could be told.
HostMade
What host-creates-branch made.

Functions§

backoff
How long to wait before asking the host again after attempt tries (0-based): 1 s, 2 s, 3 s, 5 s, 8 s, then every 10 s. Bounded so a bot that takes minutes costs a few dozen cheap calls, never a hammered host. GITPOULPI_FLOW_POLL_MS fixes the pause (tests and benches).
create_issue
Creates the issue of draft on project.
find_for_issue
Asks the host what exists for issue number: its own links, the branches matching the workflow’s branch_from_issue and the requests whose source branch does. A source that fails is noted, not fatal; when every source fails the error of the first is returned.
host_creates_branch
Creates name from from on the host for the issue and, when open_request, a draft merge request into target that closes the issue.
issue_branch_name
The name the host-made branch of issue number gets: the workflow’s branch_from_issue with the type, the issue number and the title’s slug.