Workflow states and agent attribution¶
This is the FLOW-09B contract for the released opt-in workflow. A task's
four-value status is a broad index. The current workflow.phase and ordered
workflow_get.history are the authority for execution progress. Every phase
transition updates the workflow row, appends a sequenced event with a server
timestamp and updates the task's broad status in one PostgreSQL transaction.
The Bridge execution event is also stored with its sequence and lease fencing.
| User-facing meaning | Persisted workflow phase | Broad task status | Who causes the transition | Next observable action |
|---|---|---|---|---|
| Task defined, waiting for issue | No workflow | todo |
Task author | Select worker, verifier, criteria, Git base and Bridge policy. No agent is assigned yet. |
| Ready for issue | ready event |
todo |
Server during authorized dispatch | Freeze the selected worker/verifier versions and create the first offer. This phase is normally transient within dispatch. |
| Issued to Bridge | queued |
in_progress |
Server creates an offered execution | Authorized Bridge can poll and claim it. |
| Bridge accepted the offer | claimed |
in_progress |
Bridge claim, validated by server | Lease exists; native provider is not yet ready. |
| Preparing agent session | preparing |
in_progress |
Bridge ordered event | Materialize the selected profile and workspace. |
| Worker doing the task | running |
in_progress |
Bridge running event with native provider session ID | Worker produces a clean Git candidate and evidence reference. |
| Candidate ready for tests | awaiting_verification |
in_progress |
Server after valid worker completion | Server creates a separate verifier offer. This is not acceptance. |
| Verifier picked up work | claimed, then preparing |
in_progress |
Verifier offer claimed; Bridge prepares a fresh session | active_purpose=verify distinguishes these phases from worker claim/preparation. |
| Independent tests under way | verifying |
in_progress |
Bridge running event for verifier session | Verifier submits a verdict for every frozen criterion. |
| Changes required | changes_requested event |
in_progress |
Server after a valid failed verdict (or, with no verifier, a worker that reports unmet criteria) | If budget remains, a fresh worker attempt is offered and current phase becomes queued in the same transaction; the event remains in history. UI labels the new queue as a correction. |
| Correction in progress | queued → claimed → preparing → running |
in_progress |
Server and Bridge, with incremented work count | New native worker session receives verifier feedback and candidate base. |
| Accepted, awaiting publication | done, publication_state=awaiting |
in_progress |
Server after a valid all-pass independent verdict (or a worker completion when verification was not requested) | Exactly one acceptance receipt and completed handoff are written atomically. The Bridge publishes only a done workflow; it pushes the branch and reports the pull request. |
| Published, GitHub not asked yet | done, publication_state=unchecked |
in_progress |
Bridge publication report the server could not check on GitHub | The server asks GitHub again every 2 minutes, at most 10 times; an unchecked report never counts as confirmed. |
| Accepted and published | done, publication_state=confirmed |
done |
Server once GitHub confirms the pull request (head = accepted commit on the task branch) | The handoff names the pull request. Merge and deployment are separate. |
| Accepted, not published | done, publication_state=blocked |
blocked |
Server: no pull request 10 minutes after acceptance, the Mac reported publishing failed, GitHub refused the report, or GitHub never confirmed it | Read the reason. After a refusal or a missing report the Mac can still publish and the task becomes done once confirmed. When GitHub never answered, the server asks again every 30 minutes for 24 hours and completes the task once GitHub confirms (details). Or send the task again. |
| Cannot continue safely | blocked |
blocked |
Server on failed/interrupted/missing evidence, exhausted corrections or expired lease | Read the reason; a new authorized workflow revision is required. No ambiguous automatic replay. |
| Operator cancelled | cancelled |
blocked |
Authorized operator through workflow control | The attempt is cancelled; no acceptance receipt is invented. |
publication_state is NULL until acceptance, and for work accepted before
it existed. Leaving done (a CI correction)
clears it; the next acceptance starts its own.
A worker that completes with criteria it reports as fail takes the same
path as any candidate. With an independent verifier, the candidate goes to
it (awaiting_verification): the worker's criteria results are evidence,
and the verifier's verdict accepts the candidate or sends it back within the
correction budget. Without a verifier (verification: none), the worker's
unmet criteria are the findings of the usual correction: changes_requested
with "Worker reported unmet criteria", then, while an attempt is left, a new
work attempt (queued, "Correction requested after the worker reported
unmet criteria") whose feedback lists those criteria with
"source": "worker"; with no attempt left, blocked with "Correction
budget exhausted".
ready and changes_requested remain durable events even when their
current phase immediately advances in the same transaction. The task list can
therefore show queued while history shows the failed verdict and correction
request. A plain task.status=in_progress never proves which agent is active.
The assignment is explicit at dispatch: workflow_dispatch_catalog selects
worker and verifier agent_id and version, provider account, pinned instruction
sources, Bridge enrollment identity, Git base and acceptance criteria. The
server freezes both profiles; Bridge does not choose or substitute an agent.
Before dispatch an ordinary todo task has no assignee field. The operator
or client is responsible for selecting both roles when issuing it.
For attribution, task_list/task_get include worker and verifier profile
versions and the current attempt purpose/ID. workflow_get includes the frozen
contract, current attempt, ordered events and a bounded list of every execution
attempt: purpose (work or verify), selected profile/version/model, Bridge
enrollment ID, execution ID, process state and native provider session ID.
The event's execution_id joins to that list. actor_subject=server on a
server transition identifies the writer of the durable event, not the
human or native agent who performed the work. Each terminal attempt also has
a work receipt; final acceptance has its own server receipt.
The server verifies sequence, lease, attempt ownership, candidate commit,
contract digest, independent verifier session and complete criterion results.
It validates references and attribution; it does not independently run the
tests described in a verifier's evidence. Work Center is a refreshed view of
these records. A stale lease is displayed as expired even before reconciliation
changes the phase to blocked.