Transition engine

The lifecycle table defines every state and transition of a contribution. engine.py applies it: engine.apply_transition(record, verb, ...) is the write path of the lifecycle fields phase, activity, paused, revision, and generation. This page describes how a transition is taken, which parts of the pipeline take their transitions through the engine, and how an existing record is brought to a table state.

Contents
  1. Taking a transition
  2. What the pipeline takes through the engine
  3. Work identity and budgets
    1. The upstream base branch
  4. Development
  5. CI reruns
  6. Upstream review and release
  7. The plan decides
  8. Errors while a tick runs
  9. Worker reports, history and steering
  10. Stop and resume
  11. Commands
  12. Tracking issue entries and the status page
  13. Reminders
  14. Requesting upstream submission
  15. The submission rewrite and review
  16. The handoff operations
    1. The submission package
  17. Record schema and its migration
  18. Remote operations
  19. Checks

Taking a transition

apply_transition takes a contribution record and a verb of the table. It never performs a remote effect; it returns the new record and the event to persist, or the reason the transition is refused.

  1. Resolve the verb. The record’s state is phase.activity. The verb is a row of that state, a rule row, or a setter or clearer of the paused flag. A verb that does not leave the state is an error of the caller.
  2. Apply the mask of the flag. While paused is set, a controller tick is refused, a Result takes record_late_effect only, and of the commands only resume, park, refresh, retract-pr, abandon, and resolve-operation apply.
  3. Evaluate every guard. Each guard text of the table is registered once in engine.PREDICATES under a name. A guard is one of two kinds:
    • a record predicate is decided by the engine from the record, the policy, the time, and the command: the exact revision, the candidate head, the pending human action, quiescence, staleness of a stop, the reminder interval, and the budgets;
    • a fact is something only the caller can observe, such as a CI verdict, an operation receipt, or a free worker slot. The caller asserts the fact by its name. A fact that is not asserted does not hold.

    A transition is refused unless every guard is established. A budget remains while its count is below its limit from policy.json; a budget whose count lives outside the record (dispatcher runs, an operation’s attempts) is refused until the caller supplies the count. The rerun counts of the current head are in the record, in budget.reruns (head_sha, flaky, and interrupted); counts recorded for another head, or no counts at all, are counts of zero for the current head. Whether a failing CI job is recorded for the head is decided from the evidence last_ci_evidence_id names, which the caller supplies from the store (ci_evidence.failing_job: the first executed blocking job of the head that did not succeed); passing evidence, evidence of another head, and review evidence name none, and without one repair_attempts_cluster is neither charged nor exhausted. When the record names evidence the caller does not supply, every guard that reads the failing job is refused. The controller supplies it from the store, from which evidence is never removed, so a record in a state that allocates Work whose last_ci_evidence_id names evidence the store does not hold is an unexpected error of that contribution: the controller takes pause_on_processing_error (see Errors while a tick runs) instead of deferring it silently. Two facts that state the opposite of each other, such as a CI failure on the candidate head and its absence, are refused together.

  4. Apply the effects of the row. The engine sets and clears exactly the fields the row names. The caller supplies the value of a field the engine cannot derive; a value for a field the row does not set is an error. The requested Work is kept, cleared, or replaced as the row states. Some values are always derived by the engine: Work that a row allocates for a patch or a revision carries the pending feedback ids present at that moment (active_work.feedback_evidence_ids), a fresh Work graph and a Result held for a publish retry carry the same ids, and a row that records a new head starts budget.reruns again for that head. A row may clear a part of a field: a published Result clears exactly the feedback ids its Work carried. A generation bump resets every mutable lifecycle field and keeps identity and replay fences.
  5. Charge and restart budgets. Each budget in the row’s charges is counted. A resume starts again the one counter named in pending_human_action.counter, and no other.
  6. Enforce the revision rule. The revision changes exactly when the row states a bump.
  7. Emit the event. The event kind is the verb. Its details record the source and target state, the budgets charged, the counter started again with its count and the acting human, and what the caller adds (for the handoff entry, the exact head and revision).

engine.apply_command resolves an /upstreaming command to the one verb whose guards hold in the record’s state and takes it. A resume of a paused contribution clears the flag first: it takes resume_pause, or resume_stale after a long stop in provisioning or development.

What the pipeline takes through the engine

engine.PIPELINE_VERBS lists the verbs that pipeline code takes through the engine; engine.UNWIRED_VERBS is every other verb of the table. The two sets partition the table, and a test fails when a verb is in neither or in both. A verb is unwired only while an open decision blocks it: engine.OPEN_DECISIONS names, for each, the entry of the known gaps page that records the decision, and a test requires the two to be equal and the entry to name the verb. Today no decision is open, so every verb of the table is taken by the pipeline. uv run --locked python -m engine prints both sets, the open decisions, and the number of record and fact guards.

Every state of the handoff phase is written by the engine only. The stop flag, its commands, and the reminders are taken by the engine in every phase, for a record in a state of the table:

Verb Taken by When
nominate_for_handoff CI observation In development.waiting_ci, every required CI job executed and passed on the exact head, with no requested Work, no pending actionable feedback (pending_feedback_evidence_ids is empty, a record predicate), and every series requirement of the verified plan met on the exact head (the fact series_requirements_met; it also holds when the plan records none, and when the series is too large to read, which the event’s details say). The contribution enters handoff.awaiting_submission with the pending action submit_upstream.
return_for_repair CI observation An executed blocking failure on the candidate head. The evidence of the failure is recorded as last_ci_evidence_id.
record_actionable_review CI observation Authorized actionable review feedback on the development PR, in development.waiting_ci, or at the gate while CI has not failed on the candidate head, or in development.fix_needed on the recorded head while Work is due (the state is kept, the revision is bumped); or on the upstream PR in upstream_review.waiting_ci (to upstream_review.fix_needed). The contribution is in development.fix_needed afterwards, with one revision bump, the feedback is recorded in pending_feedback_evidence_ids, and the CI evidence is kept: review feedback is never recorded as CI evidence.
record_explanation CI observation An authorized explanation-only comment on the development PR, in development.waiting_ci or at the gate, or on the upstream PR in upstream_review.waiting_ci. The state, revision, head, and CI evidence are kept; the event log of the status page links the comment, and the tracking issue receives no entry. No Work is requested and nothing is answered automatically.
record_head_change CI observation The observed fork head differs from the recorded head (development.waiting_ci, which it keeps, and development.fix_needed, to development.waiting_ci) or from the candidate head (the gate, to development.waiting_ci); in upstream_review.waiting_ci, the upstream PR head changed and the pipeline did not publish the change (to upstream_review.waiting_human with the pending action upstream_head_changed). The rerun counts start again for the new head, and the CI evidence of the old head is cleared.
record_ci_failure CI observation An executed blocking failure on the exact head in development.waiting_ci. The evidence is recorded as last_ci_evidence_id, and the contribution enters development.fix_needed without a revision bump.
return_for_series_requirements CI observation Every required job passed on the exact head in development.waiting_ci without pending feedback, and a series requirement of the verified plan is unmet there. The unmet requirements are recorded as series_requirements evidence (its id is the same for the same head), which becomes the pending feedback; the passing evidence is recorded as last_ci_evidence_id, and the contribution enters development.fix_needed at a new revision, charging nothing; request_patch then requests a repair carrying the feedback. The event names the unmet requirement ids.
return_for_feedback CI observation Every required job passed on the exact head in development.waiting_ci while actionable feedback is pending. The passing evidence is recorded as last_ci_evidence_id, and the contribution enters development.fix_needed without a revision bump; request_patch then requests a repair carrying the feedback.
rerun_interrupted_ci, exhaust_interrupted_reruns CI observation In development.waiting_ci and handoff.waiting_ci, a required job on the head the state reads CI of was cancelled or lost its runner and no job failed on its own: a ci_rerun operation within interrupted_reruns, and the human wait ci_interrupted once it is spent. See CI reruns.
record_pr_mismatch CI observation In development.waiting_ci, the development PR on GitHub does not match the recorded fork, riscv64-dev, or PR number (it does not exist, its head is in another repository or ref, or it targets another base). The contribution waits in development.waiting_human with the pending action development_pr_mismatch.
record_publish_success, reject_patch_proposal, replan_development, request_ci_rerun, schedule_publish_retry, exhaust_publish_recovery Reconciler The Result of patch Work in development.agent_running. See Development.
record_revision_publish_success, require_reviewer_answer Reconciler The Result of revision Work in upstream_review.agent_running, with reject_patch_proposal, schedule_publish_retry, and exhaust_publish_recovery. See Upstream review and release.
record_upstream_ci_failure, record_pr_closed_unmerged, record_merge Upstream PR observation In upstream_review.waiting_ci: an executed blocking failure of a CI run on the upstream PR head that is not recorded yet, the upstream PR closed without merge, or merged. See Upstream review and release.
record_release_incomplete, require_release_intervention, verify_release Release observation In release_wait.idle, the official release evidence against the acceptance contract. See Upstream review and release.
retry_dispatch, exhaust_dispatch_recovery Reconciler A dispatcher run ended with the requested Work absent from the queue or unclaimed, within dispatch_recovery, and the wait once it is spent.
rearm_dispatch Reconciler A record that waits with dispatch_failed once the installed work-queue Policy was published after the failure and the compiled policy preserves it: the dispatch failed while the queue refused every dispatch, and the dispatcher has since reinstalled the compiled policy.
submit_upstream, retract_submission Command handling See Requesting upstream submission and The handoff operations.
request_submission_rewrite, request_submission_review Controller The submission rewrite Work is due in handoff.review_due, and the review Work in handoff.review_pending, and a worker slot is free; exhaust_work_total instead once work_total is spent. See The submission rewrite and review.
expire_submission_rewrite Controller The publication artifact of the accepted rewrite expired or expires within a day, in handoff.review_pending or before an attempt of the build of riscv64.
accept_submission_rewrite, reject_submission_rewrite, accept_submission_review, reject_submission_review Reconciler The Results of the rewrite and the review Work, decided by their trusted checks; an unusable Result takes allocate_work_retry or exhaust_work_recovery, and a dispatcher that never claims the Work exhaust_dispatch_recovery. See The submission rewrite and review.
confirm_clean_head, retry_upstream_branch, exhaust_upstream_branch_retries, require_branch_intervention, confirm_submission_package, retry_submission_comment, exhaust_comment_retries Reconciler and controller, through the operation The verified receipt of an attempt of a handoff operation, read back independently; the retry and exhaustion rows also when the controller closes an attempt whose launches are spent without a receipt. See The handoff operations. return_for_repair is fired as well by a build of riscv64 whose reviewed series does not rebuild or whose lease conflicts, and by a moved package attempt that the reconciler reads back as moved.
accept_clean_head_ci CI observation Every required CI job executed and passed on the clean head of riscv64 in handoff.waiting_ci (on the candidate head when the clean head has its tree); a blocking failure there takes return_for_repair and records the failing evidence as last_ci_evidence_id, annotated with the candidate head it was built from (ci.candidate_head_sha) when the clean head is another commit, and a riscv64 head that is not the clean head takes return_for_repair and keeps the recorded evidence; CI that is not complete there takes require_clean_head_ci when no run exists and its workflow cannot be dispatched, or after the bounded wait.
verify_upstream_pr, record_audit_observation Upstream PR observation In the locked handoff.waiting_upstream_pr: exactly one upstream PR that satisfies every filter is verified; when none does, a single PR that satisfies every filter but the base, and targets the name GitHub now redirects the frozen base to, whose history still contains upstream.base_sha, is verified too, and upstream.base_ref follows the new name; anything else that does not match is recorded once for audit.
pause, resume_pause, resume_stale, park_contribution, refresh_planning, restart_generation, abandon Command handling Every command of the table (pause, resume, park, refresh, abandon, submit-upstream, retract-pr) on a record in a state of the table, in every phase; in the handoff phase every command. See Stop and resume and Commands. A command no row of the state takes is rejected with the state it does not apply in and the states it applies in.
withdraw_request Controller The intake label was removed from the tracking issue of a request in queued.idle with no Work, no plan, and no fork. The contribution is closed with terminal_reason withdrawn. A request that already waits for a human (for example in planning.waiting_human because its base branch is unavailable) is no longer withdrawn by the label: it is parked, then abandoned.
resume_planning, resume_provisioning, resume_ci, resume_clean_head_ci, resume_development, resume_submission_review, resume_upstream_branch, resume_submission_preparation, resume_upstream_review, resume_upstream_revision, resume_release_observation Command handling /upstreaming resume in a human wait of the table, guarded by the pending human action; each starts again the one counter that pending_human_action.counter names.
record_reminder Controller A pending human step in a state of kind gate, human_wait, or locked, once human_sla_business_days.reminder business days have passed since the request or the last reminder. See Reminders.
pause_on_identity_change Controller The observed upstream repository identity differs from the recorded one.
record_source_unavailable, require_base_branch, require_renamed_upstream, exhaust_source_reads, require_upstream_access Controller The upstream repository or base branch could not be read where Work or the fork provisioning is due: a read without a definitive answer is charged to source_reads, at most once per spacing slot; the upstream’s answer that the branch does not exist or was renamed, or GitHub answering for the same repository id under another name, leads to the human wait at once (require_base_branch, require_renamed_upstream), and the exhaustion of source_reads leads there with the cause of most of the counted reads: the base branch, or the repository itself. See The upstream base branch.
follow_renamed_base, resume_renamed_base Controller In upstream review, the upstream renamed the base branch while the upstream PR is open, and the verified PR now targets the new name: the record follows it, and a wait the rename caused ends. See The upstream base branch.
resume_upstream_read, resume_renamed_upstream Controller A wait that failed reads caused (pending_human_action.counter is source_reads) ends once a tick reads the upstream again (resume_upstream_read), and the wait a renamed repository caused (upstream_unavailable with no counter) once a tick reads the repository under its recorded name and id again (resume_renamed_upstream). See The upstream base branch.
pause_on_processing_error Reconciler An unexpected error while the tick processed the contribution, see Errors while a tick runs. The caller states paused_reason; the engine refuses the verb without one.
begin_planning, dispatch_planning Controller Planning Work is due and a worker slot is free. A request in queued.idle takes begin_planning in the tick that allocates its Work, then dispatch_planning. See Work identity and budgets.
request_patch, request_repair Controller Development Work is due in development.fix_needed, under write admission, with a worker slot and capacity: request_repair when a failing CI job is recorded for the head (the failing CI job of the head, or of the clean head built from it), request_patch otherwise.
request_upstream_revision, request_review_revision Controller Revision Work is due in upstream_review.fix_needed: with a failing CI job, or driven by review feedback only.
exhaust_work_total, refresh_on_exhaustion, exhaust_repair_attempts Controller A budget of the Work that is due is exhausted; taken without a worker slot, in place of the allocation.
allocate_work_retry, exhaust_work_recovery Reconciler and controller The requested Work graph is terminal (completed or cancelled in the queue) without a folded Result, or the Work an allocation row just named has a graph that returned a Result in the tick or is terminal. No deadline ends requested Work.
admit_development, readmit_development, park_planning, close_planning Reconciler The verified plan of the requested planning decides. See The plan decides.
reject_plan, exhaust_planning_recovery Reconciler A planning run Result has no plan, a plan whose decision is none of develop, park, and close, a patch scope that is incomplete where the admission checks it, or a decision close that PyPI does not confirm.
start_operation Controller A planned fork provisioning operation of a record in provisioning.idle, with capacity, within operation_launch. See Remote operations.
require_provisioning_intervention Controller The planned provisioning operation is still without a receipt after its last launch and operation_launch is exhausted, or a human resolved the operation failed.
confirm_provisioning Reconciler, through the operation The provisioning operation is confirmed by its receipt and the exact readback of the fork and riscv64-dev.

A CI evidence record lists the jobs of its run in job id order, whatever order the API returns them in, and observing the same run again writes nothing: an evidence record that differs from the committed one only in collected_at is not staged, so the committed record keeps the time it was first collected.

At the submission gate the collector reads the review comments and CI on the candidate head in one observation and then takes at most one of the two rows that leave the gate for repair. Their guards are exclusive: when CI failed on the candidate head, return_for_repair applies and, in the same observation, the review is recorded by record_actionable_review in development.fix_needed; the two events keep separate causes, and the repair Work requested next carries the failing CI evidence and the review; otherwise record_actionable_review applies. The ids of the comments a row recorded are added to the replay fences of the record in the same write.

A worker Result is folded only when it matches the Work identity: the contribution is in a working phase (planning, provisioning, development, or upstream_review), it is not paused, the generation and revision the Result’s task names are the record’s, and the Result answers the requested Work (its Work id, active_work.dedupe_key) or the trusted publication of the same worker run (a publish-only retry). Each phase requests its own Work only (planning Work in planning, patch Work in development, revision Work in upstream_review), so a Result of Work of another phase is late as well; a plan is folded in planning only, and a Result held for a publish retry in development and upstream_review only. park and pause clear the requested Work and the pending publication without a revision bump, so an equal revision alone is not a match. Every other Result takes record_late_effect, in every state: a Result of another generation, of another revision, of other Work, a Result that arrives when the record holds no requested Work, a Result for a record that waits for a human, and an older publication artifact of the same Work once the newest is folded. The reconciler marks the publication artifact as processed and appends one event with the Result’s status, task generation, revision, and Work id, and nothing else in the record changes. An artifact that is already marked as processed is not recorded again, so each late Result is recorded once.

A stop invalidates what is held for publication. park_contribution, abandon, the verbs that set paused, and every other transition that ends the generation clear pending_publication together with the requested Work; python -m lifecycle check verifies it. proposal_artifact only ever holds a published Result, which a stop keeps: no patch is held without a write to the provisioned fork, and a worker outcome proposal, which no publisher produces any more, is rejected in trusted validation. Nothing is therefore published after a stop: the resume finds nothing held and requests fresh Work. The publication Result that arrives afterwards takes record_late_effect. No publication is launched for a paused record: the publish-only retry skips it. A stop therefore never keeps /upstreaming resume from applying because of a publication that was pending when it was taken.

A branch that the worker run already pushed is recorded by head observation, which reads the fork’s development branch riscv64-dev in development.fix_needed, development.waiting_ci, and handoff.awaiting_submission, also while the record is paused: the observed head replaces the recorded one and the revision is bumped. The recorded head is the head of the branch the phase works on (lifecycle.recorded_head): fork.head_sha of riscv64-dev, and in upstream review the head of the upstream PR from riscv64 (upstream_pr.head_sha, which verify_upstream_pr records), so the first observation after the verification is no head change and bumps no revision. Upstream revision Work names that head as its expected head; how upstream review observes it is described in Upstream review and release. While the record holds requested Work, or a Result held for a publish retry, a changed head is not recorded: the table has no head row in an agent_running state, so the Result is folded at the revision its Work was requested for, and the head it published is recorded by the observation after it. In development.fix_needed, where Work is due, a head that moved is recorded by record_head_change, which leads to development.waiting_ci (see Development). A record that waits for a human in a state of the table that has no observation row (a state of kind human_wait with a recorded pending action, such as development.waiting_human or upstream_review.waiting_human) is not observed either: its head, CI, and review comments are read again once a resume, park, or refresh has left the wait, so observation never changes its state, revision, evidence, or pending action. A parked or closed record is not observed. Its recorded head stays as it was, and the pushed commit stays on the fork branch; a refresh from parked.idle begins a new generation that records the fork and its head again at provisioning.

Every state the pipeline writes is a state of the table, and only engine.py decides a state change. It is the one module that assigns a field an effect of the table names (engine.FENCED_FIELDS: the state, the flag, the revision, the generation, the requested Work, and every field a row sets or clears, by its top-level name); a test scans the source of every other module for such assignments. The plan decides by the table’s rows (see The plan decides), provisioning is planned, launched, and confirmed from provisioning.idle (see Remote operations), development follows the rows described in Development, and upstream review and release those in Upstream review and release.

A few fenced fields are recorded beside the row a tick takes, or without a row where the table has none; each is named in engine.BESIDE_ROW with the fields, or the parts of a field, it may change, and goes through engine.record_beside, which refuses any other field and any change of the state, the flag, the revision, or the generation:

Write Fields When
operation_planned active_operation_id the controller records the intent of a planned operation (provisioning, a development PR or CI bootstrap, a handoff attempt)
operation_released active_operation_id a closed operation is released: active_operation_id names an open operation only
development_pr_recorded fork.pr_number, active_operation_id a verified development PR receipt (no row is fired by it)
upstream_identity_bound upstream.repository_id, upstream.base_ref, upstream.base_sha the upstream identity and base, bound once per generation from trusted API data, in the tick that restarts a generation from parked as well
review_fences the processed review and comment ids beside record_actionable_review
dispatcher_run_decided active_work.dispatched_run_id beside retry_dispatch
handoff_work_dropped active_work Work held in a handoff state that requests none
scope_checked scope_coverage_complete beside admit_development and readmit_development
patch_published scope_paths, budget.no_progress_streak beside record_publish_success and record_revision_publish_success
ci_rerun_recorded active_operation_id a verified receipt of a ci_rerun operation the collector planned releases it (no row is fired by it)
publication_answered, publish_retry_launched pending_publication the Result of a publish-only retry is folded, or the retry is launched

The final check before a fork write (lifecycle.publication_check) reads the table for a record in a handoff state: an automated writer may write the fork only in a handoff state the table marks as writing, which is handoff.building_upstream_branch alone. At the submission gate it may not. A publication writes the branch of its phase (lifecycle.work_ref): riscv64-dev in development, with the record naming riscv64-dev as its development branch, and riscv64, the branch of the upstream PR, in upstream review.

State validation applies the same rule to committed records: a contribution is in a table state, and a handoff wait carries a pending action with which the table enters that wait.

Work identity and budgets

Work is allocated by the rows of the table, and every allocation is an event whose kind is the verb. The controller considers a contribution in planning.idle (or queued.idle, which first takes begin_planning), development.fix_needed, handoff.review_due, handoff.review_pending, or upstream_review.fix_needed that is not paused and holds no Work, pending publication, or open operation. When the guard of an exhaustion row of that state holds, the row is taken in place of the allocation, without a worker slot. Otherwise the allocation row whose guards hold is taken once a worker slot (and, for write Work, capacity) is free; while none is free the contribution is reported as deferred and nothing changes. Every row that allocates Work, and allocate_work_retry, is guarded by upstream identity and base bound (upstream.repository_id, upstream.base_ref, upstream.base_sha), since the Work payload names them; while they are not bound the contribution is reported as deferred with that guard. The controller binds them from the verified upstream snapshot before commands are applied, for every record that is not parked, and again once the commands are applied, for a record that left parked in this tick: restart_generation clears them, except the target branch the request asked for at intake, which it keeps as upstream.base_ref (read from the issue description frozen at intake; a record created before intake froze it keeps none), and the collector reads the upstream of a parked contribution when its tracking issue carries a refresh command the controller can still take: a comment that parses as /upstreaming refresh, by an actor of command_authority, that the command ledger has not consumed. It reads the upstream at that target branch, or at its default branch when the request named none. A snapshot of another branch than the one the record names binds nothing, and the contribution is reported as deferred. A refresh from parked therefore allocates its planning Work in the same tick when the snapshot is available and the record is not paused (a restart accepted while paused binds the identity and allocates nothing until a resume). When the upstream base branch cannot be read, the record is handled as The upstream base branch states: it waits for a human at once when the upstream answered that the branch does not exist or was renamed, and otherwise stays in queued.idle within source_reads, a later tick binding it. /upstreaming refresh branch=NAME from parked restarts on the branch NAME instead of the requested one; a later restart without branch returns to the requested one.

The Work identity is the generation, the revision, and the Work id. The Work id is active_work.dedupe_key, <contribution>@g<generation>.r<revision>:<task>, and the queue graph is derived from it, so Work of another generation or revision is another graph and a terminal graph is never submitted again. Once request_ci_rerun has charged flaky_reruns for the head, the id also names that count (<contribution>@g<generation>.r<revision>.rerun<count>:<task>): the row keeps the revision, so the repair Work requested after a rerun is not the Work whose Result requested it. A row that keeps the revision can allocate Work whose graph returned a Result in the same tick or is completed or cancelled in the queue: after a revision Result that left the revision unchanged, failing CI is answered at the same revision. That Work is terminal without a usable Result and is never submitted: in the same tick the controller takes allocate_work_retry, a fresh graph at a new revision, within work_recovery and work_total, or exhaust_work_recovery to the human wait of the phase. active_work.generation records the generation. The Work payload (task.json) carries generation and dedupe_key beside revision, and the reconciler and the publisher’s final check (lifecycle.publication_check) compare all three with the record: the publisher writes the fork only for the record’s generation and revision, and only while the record holds that Work, or a Result held for a publish retry. A payload written before the identity carried the generation names neither generation nor dedupe_key; it is generation 0, its Work is recognized by its revision, and its Result can never be folded into a later generation. Requested Work recorded without active_work.generation is generation 0 in the same way, and a replay of it submits the payload it was first submitted with, without the new fields.

The task the Work asks a worker for follows the row: dispatch_planning asks for a planning run, request_repair for a repair of the failing CI job, request_patch for a patch, or for a repair when feedback is pending for it to answer, and the two upstream rows for a revision. Work that a row allocates carries the pending feedback ids present at allocation (active_work.feedback_evidence_ids), and the payload passes exactly those ids to the worker in feedback_evidence_ids; feedback recorded later is not carried. Its reason ids are the carried feedback, then the CI evidence and the plan. Every Work also carries its history: the reports of the successful workers before it, what followed them, and the owner’s steering (see Worker reports, history and steering).

The budgets of BUDGETS are counted where the table charges them:

Budget Count Charged by Exhausted by
work_total budget.attempts_used, per generation every allocation, once: dispatch_planning, request_patch, request_repair, the upstream revision rows, allocate_work_retry exhaust_work_total (a human wait whose pending action names work_total), exhaust_work_recovery
work_recovery active_work.attempt allocate_work_retry exhaust_work_recovery (names work_total when that is exhausted, work_recovery otherwise)
planning_attempts budget.planning_attempts reject_plan exhaust_planning_recovery (names planning_attempts)
repair_attempts_cluster budget.clusters[<failing CI job>] request_repair and request_upstream_revision, at allocation, for the failing CI job of the head, or of the clean head built from it refresh_on_exhaustion once per generation, then exhaust_repair_attempts (parks); in upstream review a human wait that names the counter
no_progress budget.no_progress_streak every rejected or blocked worker outcome (reject_patch_proposal); started again by a published patch and by refresh_on_exhaustion as repair_attempts_cluster
dispatch_recovery the dispatcher runs that ended since active_work.requested_at retry_dispatch exhaust_dispatch_recovery (names dispatch_recovery)
publish_recovery pending_publication.attempts schedule_publish_retry, for a Result that reports an infrastructure error of the publication or a push that was not read back (uncertain) and for a launched publish-only retry that returned no Result exhaust_publish_recovery (names publish_recovery)
flaky_reruns budget.reruns.flaky, for the head in budget.reruns.head_sha request_ci_rerun counts as reject_patch_proposal
interrupted_reruns budget.reruns.interrupted, for the head in budget.reruns.head_sha rerun_interrupted_ci, once per planned ci_rerun operation exhaust_interrupted_reruns (names interrupted_reruns)
operation_launch external_ids.launch_attempts of the planned provisioning operation start_operation require_provisioning_intervention (names operation_launch)
source_reads budget.source_unavailable, the counted failed reads (at most one per spacing slot of retries.source_unavailable_minutes divided by retries.source_unavailable_reads, counted from the first failed read), with budget.source_unavailable_since, the time of the first of them, budget.source_unavailable_at, the time of the last, and budget.source_unavailable_repository, how many could not read the repository itself; a tick that reads the upstream clears them all. Exhausted by the first failed read once retries.source_unavailable_minutes minutes have passed since the first failed read and the count, that read included when it is counted, reaches retries.source_unavailable_reads record_source_unavailable exhaust_source_reads, require_upstream_access (both name source_reads)

A rejected or blocked outcome charges nothing else: work_total and the cluster are charged when the next Work is allocated. A resume from a human wait an exhausted budget caused starts again exactly the counter the pending action names.

The upstream base branch

The collector reads the upstream repository and the base branch the record names (upstream.base_ref, or the default branch while none is named) for every contribution that is not parked or terminal, and the controller binds or verifies the identity from it. It reads one branch per upstream; every failed read carries the branch it asked for (ref), and the controller never applies the answer for one branch to a record that names another: such a snapshot is reported as deferred and charges nothing. An intake request for an upstream that already has a contribution that is not terminal reads nothing. GitHub answers a read of a renamed branch with a redirect to the new name; a response that names another branch is not that branch. Where the base branch is needed, in queued.idle, planning.idle, provisioning.idle, development.fix_needed, handoff.review_due, handoff.review_pending, and upstream_review.fix_needed (lifecycle.BASE_BRANCH_WAITS), a read that fails is decided in the tick, after the commands:

  • When the upstream answers definitively that the branch does not exist (HTTP 404 for the branch of a repository that was read) or was renamed (the redirect), the controller takes require_base_branch to the human wait of the phase (planning.waiting_human for a request in queued.idle, whose phase has none) with pending_human_action base_branch_unavailable and no counter.
  • When GitHub answers the read of the repository for the recorded repository id (upstream.repository_id, or any id while none is bound) under another name, the repository was renamed or transferred: a definitive answer, so the controller takes require_renamed_upstream at once (pending_human_action upstream_unavailable, no counter), without spending the retry window on a read that cannot change; no failed read is counted for it.
  • Any other failure (a network or server error, a rate limit, a repository that cannot be read, HTTP 404 or 403 for the repository included) takes record_source_unavailable, which keeps the state and charges source_reads. The time since the first failed read of the run (budget.source_unavailable_since) is cut into spacing slots of retries.source_unavailable_minutes divided by retries.source_unavailable_reads (engine.source_read_slot_length, 20 minutes), and a failed read is counted only when it is the first of a run or falls in a later slot than the last counted read (budget.source_unavailable_at); a failed read in the same slot writes nothing and is reported as deferred (one deferred entry per contribution and tick), so a burst of ticks adds no events and no commits. Ticks do not come on time: a scheduled run of controller.yml is delayed or skipped, and most ticks come from issue, comment, workflow run, and push events. Because the slots are counted from the first failed read rather than from the last counted one, a regular tick counts once per slot whatever its jitter (a minute early or late, or every 3 minutes), and the wait begins at the first tick once the minimum time has passed. After a long pause between ticks, the next failed read counts once, like any other. Its count, budget.source_unavailable, counts the counted failed reads, budget.source_unavailable_since records when the first of them failed, and budget.source_unavailable_repository counts those that could not read the repository itself; a tick that reads the upstream clears them all (the write upstream_read beside the rows), and a resume of the wait starts them again. The budget is exhausted by the first failed read once retries.source_unavailable_minutes (60) minutes have passed since the first failed read and the counted failed reads, that read included when it is counted, reach retries.source_unavailable_reads (3): controller.yml also ticks on issues, comments, workflow runs, and pushes, so a burst of ticks alone never exhausts it, and a schedule that skips runs for hours still leads to the wait at the third spaced read instead of days later. The read that meets both conditions is never held back by the spacing (engine.source_reads_spent); it takes require_upstream_access (upstream_unavailable) when most counted failed reads, this one included when it is counted, could not read the repository itself, and exhaust_source_reads (pending_human_action base_branch_unavailable) otherwise; both name source_reads as the counter, and the event records both counts. Which rows are the exhaustion of a budget is declared on the row (Transition.exhausts), never read from the wording of its guards.

The tracking-issue entry states which cause applied in plain words: the branch does not exist, it was renamed and to which name, reads of it kept failing (how many were counted, since when, how many could not read the repository itself, and the last error), the repository could not be read, or GitHub now names it otherwise. It then says what can be done: a wait that failed reads caused continues on its own once the upstream can be read again, and a resume reads it again at once; a repository GitHub names otherwise continues on its own if GitHub answers for the same repository under its recorded name again (or, for a request whose id GitHub did not give, says that only a resume continues), and a resume before then only waits again; for a missing or renamed base branch, resume once it can be read again, or, to continue on another branch, park first and then, once it is parked, post /upstreaming refresh revision=N branch=NAME reason="..." (named with the new name of a rename); while the upstream PR is open, no restart is offered, since restart_generation refuses it. For the repository, a repository that moved is a new request (park, then abandon). The plain words name no state either.

A wait that failed reads caused (pending_human_action.counter is source_reads: exhaust_source_reads and require_upstream_access) heals itself: the collector keeps reading its upstream on every tick, and once a tick reads the repository and the recorded base branch again, with the recorded repository id, the controller takes resume_upstream_read after the commands (so that a resume posted in the same tick is taken as posted). It is the same transition as the posted resume of the wait (lifecycle.UPSTREAM_READ_RESUMES): a new revision, the pending action cleared, and source_reads started again; the tracking issue states that the contribution continues (status_ledger.NOTICE_VERBS). A paused wait takes neither: once a resume clears the stop (resume_pause), a tick that reads the upstream again ends it. The wait a renamed repository caused (require_renamed_upstream: upstream_unavailable with no counter) is read on every tick too, and once GitHub answers for the recorded repository id under its recorded name again, the controller takes resume_renamed_upstream the same way (it carries no counter, so it starts none); while GitHub still names it otherwise, a posted resume returns to the step (in provisioning.waiting_human too, where it is one of the waits the controller entered, controller.PROVISIONING_WAITS) and the next read waits again at once. require_renamed_upstream sets upstream.repository_id to the id GitHub answered for: the recorded one when it is bound, and for a request not bound yet the id of the renamed repository, so that the wait ends only on the same repository and another repository later created under the recorded name pauses it (pause_on_identity_change) instead of being bound in its place. When GitHub gave no id, nothing under the recorded name is bound while the wait lasts (the tick reports it as deferred), and only a resume continues. Once GitHub answers for the same repository id under its recorded name but the upstream says that the base branch does not exist or was renamed (the collector records the repository_id it read with such an answer), the controller takes require_base_branch in the wait itself, a tick row that keeps the state: the pending action becomes base_branch_unavailable with the entry it posts from the state the step was due in, and the wait is no longer read until a resume is posted. A wait the upstream’s own answer about the branch caused (a missing or renamed branch, no counter) still needs a resume.

In upstream review, a base branch renamed while the upstream PR is open heals without a human, once the contribution is not paused and no operation is open (a paused contribution follows it after its resume). GitHub retargets the open PR to the new name, so when the redirect names the new branch of a contribution in upstream review, the collector also reads the PR the record names: when it is open, targets the new name of the same repository, and the new branch’s history contains upstream.base_sha, the snapshot carries that verified base, and the controller takes follow_renamed_base in upstream_review.waiting_ci and upstream_review.fix_needed (the state is kept) or resume_renamed_base from upstream_review.waiting_human when the rename had caused the wait (to upstream_review.fix_needed, at a new revision, the pending action cleared and source_reads started again). Both set upstream.base_ref and upstream_pr.base_ref to the new name and keep upstream.base_sha, which the renamed branch still contains, and both post an entry on the tracking issue that states the rename (status_ledger.NOTICE_VERBS). A failed read of the PR is a failed read of the upstream, charged to source_reads, never a definitive answer. A PR that does not follow the rename leaves the definitive answer as it is.

Before the upstream PR is verified, in the locked handoff.waiting_upstream_pr, a base branch the upstream renamed after the package was posted heals the same way: a human opens the PR against the new name, and when no candidate satisfies every filter, a single candidate that satisfies every filter but the base, targets the name GitHub now redirects upstream.base_ref to, and whose new branch still contains upstream.base_sha (collect.base_redirect and collect.base_contained; only the candidates on that name count, so a candidate on another branch never makes it ambiguous), takes verify_upstream_pr, which then sets upstream.base_ref to the new name and records the rename in the event; the tracking issue states it in plain words.

While a contribution waits with base_branch_unavailable or upstream_unavailable, the collector does not read its upstream, unless failed reads caused the wait (above), a renamed repository caused it (upstream_unavailable with no counter, above), its tracking issue carries a resume the controller can still take (parsed, authorized, not consumed), or it waits in upstream review for a renamed base branch (so that the rename it follows ends the wait). The resume of the wait (resume_planning, resume_provisioning, resume_development, resume_submission_review, resume_upstream_revision) is accepted as usual, and starts source_reads again when it caused the wait; when the upstream still cannot be read in that tick, the wait is entered again with a new entry. A paused contribution, or one with an open operation, takes none of these rows and is reported as deferred.

Development

Development Work is requested only in development.fix_needed (request_patch, request_repair, or an exhaustion row), and its Result is folded only in development.agent_running, by exactly one row:

Result Row Leads to
Published record_publish_success development.waiting_ci. The row records the published Result (proposal_artifact, with the outcome published, and publication_operation_id, the confirmed branch operation, which the development PR request requires), clears exactly the feedback ids its Work carried, and starts the rerun counts again. Beside the row the published files join scope_paths and no_progress starts again.
no_change (the development worker reports a failure not caused by the patch), the Work carries no feedback, flaky_reruns remains, and the outcome carries the receipt of the trusted rerun request_ci_rerun development.waiting_ci at the same revision, charging flaky_reruns for the head; the recorded CI evidence is cleared, so CI on the head is read again there. The event names the receipt (its status, the runs, the attempts read back) and the confirmed ci_rerun operation is recorded. A no_change outcome without the receipt, where the row would apply, is a failed publication (below). See CI reruns.
Rejected in trusted validation, blocked, a proposal, or no_change when the Work carries feedback or flaky_reruns is exhausted reject_patch_proposal development.fix_needed at a new revision, charging no_progress; the pending feedback is kept. A blocked Result’s rehearsal evidence is stored and named in the event.
Rejected as stale (the fork head moved) replan_development development.fix_needed at a new revision, charging nothing.
Uncertain (the push was not read back) schedule_publish_retry, or exhaust_publish_recovery once publish_recovery is spent The Result stays held in development.agent_running, as for an infrastructure error below, and its Work is cleared, so no Work recovery takes its completed graph. The branch observation discovers the operation of the push. record_publish_success is taken once the publication is confirmed: when the publish-only retry reads back the head the lost push left (it confirms the open operation of the earlier attempt when its Result is folded) or publishes the same commit, or when its Result finds the operation of the earlier attempt confirmed, including a retry rejected as stale behind a confirmed operation (the head moved after the push landed; the later head is recorded by record_head_change). The row then names the confirmed operation in publication_operation_id.
An infrastructure error of the publication (also a rerun that was refused or not read back, and a no_change outcome without a rerun receipt where request_ci_rerun applies), publish_recovery remains schedule_publish_retry development.agent_running with the Result held in pending_publication (carrying the feedback ids of its Work) and the Work cleared; publish_recovery is charged.
An infrastructure error, publish_recovery exhausted exhaust_publish_recovery development.waiting_human with the pending action publication_infrastructure_failure that names publish_recovery; the held publication is marked exhausted.

Every development Result carries the worker’s report (report.json). It is stored as worker_report evidence when record_publish_success or request_ci_rerun folds the Result, or when the Result’s push may have landed (an uncertain Result held for a retry), and discarded by every other row. When CI then fails on the published head, the repair Work receives that report beside the CI failure, in its history.

A publish-only retry is launched once pending_publication.next_attempt_at is due, for a record in development.agent_running that is not stopped: 15 minutes after the first failed publication, 60 after the second, and 240 after every later one. The launch records pending_publication.launched_at and charges nothing. The retry workflow uploads its Result as the porting-publication artifact with the task of the worker run it publishes and that run’s id, and the controller collects it like the Result of a worker run, from completed workflow_dispatch runs on main, whoever dispatched them; the same rows fold it. Only a retry names the worker run it publishes (worker-run-id): the collector deletes such a file from a planner or worker artifact, whose Result is the Result of its own run. The Result of a retry ends the held publication: pending_publication is cleared beside the row that folds it. A launched retry whose Result is not folded within 60 minutes is a failed publication: schedule_publish_retry charges publish_recovery and schedules the next retry after the backoff, or exhaust_publish_recovery waits for a human once the budget is spent, so a retry that never returns a Result ends in the human wait. Each failed publication is charged once: an infrastructure error that the Result of an already charged launch reports when it arrives later (its attempt is not above pending_publication.attempts, or no retry is launched) takes record_late_effect and charges nothing again. A held publication that is exhausted launches nothing more and is not pending: resume_development applies to its wait, clears it, and requests fresh Work.

request_ci_rerun is taken only once the failed jobs were rerun on the exact head and the new attempt was read back, or nothing needed rerunning (see CI reruns). development.waiting_ci after it records no pending action and no reminder, like the wait after a publish: CI itself ends it. The row is shown in the event log of the status page (the tracking issue receives no entry, since development.waiting_ci is not a human wait), and /upstreaming refresh and /upstreaming park leave the wait.

A fork head that moved while development Work is due (a push to riscv64-dev in development.fix_needed) takes record_head_change to development.waiting_ci at a new revision: no Work is requested for the head the record named, the CI evidence of that head is cleared, pending feedback is kept and is answered after CI passes on the new head, and the new head is observed in the same tick as below. On an unchanged head, development.fix_needed reads the review feedback of the development PR only: an actionable review takes record_actionable_review there and is carried by the Work requested next; CI, explanation-only comments, and the PR match are not read. In development.waiting_ci, in order: a new fork head takes record_head_change; a development PR that does not match takes record_pr_mismatch; an explanation-only comment takes record_explanation; an actionable review takes record_actionable_review, which ends the observation (a CI failure observed with it is not recorded, since development.fix_needed reads no CI, and the review would no longer match the head once the repair is published); then CI on the exact head, read with jobs that lost their runner classified, is not acted on while it is behind a confirmed rerun, and otherwise takes record_ci_failure for an executed blocking failure, rerun_interrupted_ci or exhaust_interrupted_reruns for a required job that was cancelled or lost its runner (see CI reruns), nominate_for_handoff when every required job passed, no actionable feedback is pending, and the series meets the series requirements of the verified plan, return_for_feedback when feedback is pending, or return_for_series_requirements when no feedback is pending and a requirement is unmet. The series requirements (a plan of schema version 4 records them; an earlier plan records none and needs no read) are read once when CI passes without pending feedback: one comparison of the upstream base and the head in the fork, and, when the series holds {debug} commits, one read of each other commit, so a path that only a {debug} commit changes, or that a later commit reverts, does not count. A series of more than 50 commits or 300 files or more is not checked and is nominated with a note in the event; a failed read skips the contribution until the next tick, as every failed read of the observation does. The Work requested after return_for_series_requirements carries the unmet requirements as context.series_requirements, only while the fork head is the head the evidence names, and the trusted worker gate rejects a patch of that Work whose non-debug commits do not change a matching path, which reject_patch_proposal charges to no_progress; a worker that finds a requirement does not apply reports blocked. Repeated rejection reaches the automatic refresh, where the planner can correct the requirement, then exhaust_repair_attempts or exhaust_work_total. Passing CI behind an open operation keeps the contribution in development.waiting_ci, and so does a run that waits for approval: that is collector health, not a contribution state. A planned or launched development PR operation keeps nomination and Work back until its receipt closes it. A repair that CI on its head no longer needs is not withdrawn: its Result is folded by the rows above, or arrives late.

Requested Work is recovered by the rows of development.agent_running: a dispatcher run that ended with the Work absent from the queue or unclaimed takes retry_dispatch (the dispatcher is launched again for the same committed request) within dispatch_recovery, and exhaust_dispatch_recovery once it is spent; each ended run is decided once, and the record names the last one in active_work.dispatched_run_id. A worker run that ends without a Result (cancelled, stopped by its 120 minute timeout, or lost with its runner) is not a lost dispatch: gh-aw cancels its Claim and holds the Work for another attempt after its backoff, within the retry attempts of the pool’s Policy (3), and cancels the Work itself once they are spent. The controller reads that retry from the validating replay (queue_result.work_retries: available Work with attempts and retry_not_before), counts the dispatcher runs only from the retry time, and when none was created since, launches the dispatcher at once, without a row and without charging anything (the entry of the Work in the tick report names queue_retry); a dispatcher run after the retry time that leaves the Work unclaimed is charged as usual, and its event names the retry (queue_retry, and why in plain words, which the tracking issue entry of the human wait shows). A Work the queue cancelled after its last attempt takes allocate_work_retry or exhaust_work_recovery. The dispatcher never submits again Work the queue already holds: a Work is immutable in the queue, and the payload the dispatcher builds for it changes with the control commit it pins and with a history recorded after the submission, so a second submission would be refused (work_conflict, which the trusted control step can only report as an unclassified failure that requires recovery). Its staging step (scripts/work_queue_stage.cjs) reads the ledger through the gh-aw library of the run and stages only the Work the queue does not hold, followed by the dispatch request, or the dispatch request alone when every planned Work is queued; a queued Work is dispatched with the payload it was first submitted with, and a payload built differently is reported as payload drift in the step log. When the ledger cannot be read, the plan is staged unchanged. A Work graph that the queue reports completed or cancelled without a folded Result takes allocate_work_retry or exhaust_work_recovery. Nothing reads active_work.deadline_at. The submission rewrite and review Work, in handoff.agent_running and handoff.reviewing, are recovered by the same rows of their states. The relaunch a dispatch recovery decides stands in a tick that also observes CI, unless the record no longer holds its Work once observed.

gh-aw refuses every dispatch (work_queue_policy_proposal_mismatch) while the work-queue Policy installed in the ledger declares a worker profile the compiled dispatcher policy no longer declares, for example after a worker workflow is renamed; the ref and logical contract of a profile change with every compilation and never cause it. The controller reads the compiled policy from the dispatcher lock (queue_policy.py) and compares it with the validating replay of the ledger. While the installed Policy drops a compiled profile and the queue is not quiescent, a dispatch is not decided: nothing is charged and nothing is launched. On a quiescent queue the dispatcher’s first steps publish the compiled policy as a new Policy epoch, an administrator policy request authenticated as the dispatcher run (scripts/work_queue_policy.cjs), before any Work is staged; the controller launches the dispatcher for it at most once every 30 minutes while a record holds or waits for dispatched Work. A dispatch decided before the reinstall is charged as usual, and a record that waits with dispatch_failed takes rearm_dispatch once the installed Policy epoch was published after the failure: the same effects as the human resume of the wait, starting dispatch_recovery again.

CI reruns

The failed or interrupted jobs of the workflow runs on the exact head are rerun by trusted code only, never by a model or a human command, as an operation of kind ci_rerun (ci_rerun.py). Its marker names each run and the attempt it was at (ci-rerun:<run>@<attempt>,..., at most 5 runs), and its receipt is the readback of a higher attempt of every run on the expected head (ci_rerun.discover, the discoverer of the kind): a rerun keeps the run id and its creation time, so a launch window cannot confirm it. The run attempt is a monotonic counter, so every request reads it first: a run already above its attempt on the head is a rerun that landed and is confirmed, never requested again, and a ci_rerun operation is never left uncertain. A run is rerun with rerun-failed-jobs, which reruns every failed, cancelled, or timed-out job of that run. The token that requests it is minted for the one verified fork with actions: write alone and is used for that request only (the public fork is read with the job’s own token); no new workflow exists for it, and the dispatcher has no part in it. A rerun reserves no runner capacity: it is bounded by its per-head budget only, like a push that triggers CI.

There are two paths:

  • A failure not caused by the patch (request_ci_rerun, within flaky_reruns). The rerun is the publication of the development worker’s no_change Result. The trusted publication job of the worker run, and of a publish-only retry, checks without any token (python -m ci_rerun preflight) that the Result is a no_change Result of development Work (development_patch or development_repair, the Work of development.agent_running) that passes the proposal checks, that request_ci_rerun applies to the record (no carried feedback, flaky_reruns remaining, not paused), that the policy is not read-only, and that the fork is the recorded one; then it mints the token and runs python -m ci_rerun publish, which applies the final check before a fork write (lifecycle.publication_check: revision, head, pause, generation, Work id) and reruns the latest attempts of the completed runs on the head that hold a failed job (a publishing job the fork has no credentials for is not rerun). Its outcome:

    Receipt Outcome Row
    rerun: the new attempt of every run read back no_change with the receipt and the confirmed ci_rerun operation request_ci_rerun
    superseded: a run on the head is in progress on a later attempt (a rerun of a run that held a failed job), or the run the recorded evidence names already has a newer attempt (that run is not rerun again), and no other completed run on the head holds a failed job; any other run still in progress does not hold back the completed failed runs, which are rerun, so a retry after a rerun of only some runs reruns the others no_change with the receipt request_ci_rerun
    nothing_to_rerun: no failed job on the latest attempts no_change with the receipt request_ci_rerun; the same failing evidence is then recorded again by record_ci_failure, so the contribution cannot stall
    the final check fails, or the run is on another head (stale) rejected, failure class stale replan_development
    a definite refusal (HTTP 403, 404, 422, closing the operation failed), a network error, or an attempt not read back after six polls 5 seconds apart infra_error, failure class infrastructure schedule_publish_retry, then exhaust_publish_recovery

    A no_change outcome without a valid receipt (a worker run on older trusted code, or a publication job that died) is a failed publication when request_ci_rerun applies, so the publish-only retry performs the rerun; the outcome counts as reject_patch_proposal when the row does not apply. On this path the operation is built from the runs requested and delivered in the outcome, so its intent is not recorded before the request; this is safe because every retry reads the attempt of each run first, and a run already above its attempt on the head is confirmed and never requested again. The reconciler and the preflight admit the same Results: a no_change Result of development_patch Work (requested when no feedback is pending) is published by the rerun like one of development_repair Work, so with nothing failed on the head it takes request_ci_rerun with nothing_to_rerun and CI is read again in development.waiting_ci. The receipt is valid when its status is one of the three answered ones, each run it names carries integer run_id, from_attempt, and a higher run_attempt (at most 5 runs), superseded and nothing_to_rerun name no run, and, for rerun, the confirmed operation names the record’s fork, its head, the runs and attempts of its marker, and the attempts of the receipt.

  • Interrupted CI (rerun_interrupted_ci, within interrupted_reruns). In development.waiting_ci and handoff.waiting_ci (ci_rerun.INTERRUPTED_STATES), CI on the head is read with the failed jobs of its latest attempts classified (collect.classify_runner_loss, at most 20 jobs): a job that failed with a failure-level annotation matching ci_rerun.RUNNER_LOST (the runner received a shutdown signal, or a hosted or self-hosted runner lost communication with the server) lost its runner and did not execute. The annotation text is only compared with those constants, never stored or rendered. A required job that is cancelled or lost its runner is interrupted, the verdict is not_executed, and the evidence marks the job interrupted. A blocking job that no required pattern names and that lost its runner is interrupted too: it is not dropped from the verdict, because the gate, reading the same CI unclassified, would call it failed after a nomination. A timed_out job executed and is a failure, and any executed blocking failure gives failed and record_ci_failure, so a rerun never hides a real failure. For interrupted CI the observation, in order: keeps the state and reads CI again while an operation of the contribution is open or the contribution is paused; takes exhaust_interrupted_reruns to development.waiting_human with the pending action ci_interrupted and the counter interrupted_reruns once that budget is spent; and otherwise takes rerun_interrupted_ci, which charges interrupted_reruns (cause: the evidence id), and records the planned ci_rerun operation of the runs that hold an interrupted job (reason ids: the evidence id and rerun:<count>) with active_operation_id beside the row (operation_planned). The controller launches it like a development PR operation, through the development PR workflow, whose ci_rerun steps mint the actions: write token and run python -m ci_rerun operation: it executes only the record’s current planned intent (planned, active, same revision, not paused, in development.waiting_ci, the recorded fork, a policy that is not read-only) and returns stale when the head moved. The workflow uploads the receipt as the porting-ci-rerun artifact, which the controller collects (reconcile --ci-reruns). The reconciler reads every run of the operation back with its own reads: a confirmed readback closes the operation confirmed and releases it (ci_rerun_recorded, an event outside the table); a rerun receipt not readable yet, including a run that can no longer be read at all (deleted in the fork), is collected again next tick without holding back the rest of the contribution’s tick, so the launch budget below closes the operation; a stale or refused receipt closes the operation failed and releases it. The controller also closes a planned ci_rerun operation as failed when its launches are spent without a receipt (operation_launch, 300 seconds after the last launch) or when it no longer matches the record (another head, revision, or state), or when the contribution is paused: the workflow refuses a paused record, so no receipt can arrive, and an operation left open would hold park and a resume after refresh.stale_after_days. Nothing is launched or planned while the contribution is paused, and the first observation after resume_pause takes rerun_interrupted_ci again within the budget. No row is fired by a closed rerun: the next observation of interrupted CI takes rerun_interrupted_ci again within the budget, or its exhaustion row. resume_ci launches nothing itself: it restarts interrupted_reruns, and the first observation after it reruns through rerun_interrupted_ci, charging the restarted counter.

    In handoff.waiting_ci the same rows apply to CI on the clean head (handoff.ci_head: the clean head on riscv64, or the approved candidate head on riscv64-dev when the reviewed series has its tree), with these differences. The operation targets the head the runs are on and its branch (riscv64 for the clean head, riscv64-dev for the candidate head; ci_rerun.target_ref). The controller reports its launch in handoff_requests (kind ci_rerun) instead of dev_pr_requests, and controller.yml dispatches it to handoff.yml, the workflow that writes riscv64, whose ci-rerun job runs python -m ci_rerun check --phase handoff before any token (the checked-out state is the head of main, and the operation is the current intent of handoff.waiting_ci, planned, active, same revision, not paused, the recorded fork, a policy that is not read-only, and the head and branch of CI on the clean head from the accepted review), then mints the actions: write token and runs python -m ci_rerun operation --phase handoff. A refused check writes no receipt, because the refusal can be transient: the launch budget launches the operation again, then closes it. python -m ci_rerun operation --phase handoff runs the same final check at the head of main as the other handoff jobs immediately before the rerun request (handoff.unchanged_on_main, see The handoff operations) and, when it refuses, writes no receipt either. The stale fence of the executor is that riscv64 still resolves to the clean head, the guard of the observation; a moved riscv64-dev does not block it. The controller compares the operation with the head of CI on the clean head (ci_rerun.expected_head). rerun_interrupted_ci and resume_ci there also set clean_head_ci_since: CI was started again, so the bounded wait of require_clean_head_ci starts again, and one incident never needs two human resumes. Interrupted CI takes a row before the bounded wait applies: the wait applies only when no row could be taken (an open operation, a pause, or no completed run that holds an interrupted job). Passing CI on the clean head while an operation of the contribution is open keeps the wait (accept_deferred), as development defers nomination; the operation is closed within its launch budget.

In both paths, while a confirmed ci_rerun operation of the head recorded a newer attempt of a run than the CI snapshot shows (ci_rerun.awaited), the observation reads CI again and acts on nothing; a run the snapshot does not show is not awaited, so the wait cannot stall. CI at the submission gate and in upstream review is read without classification: their verdicts and evidence are unchanged, and only development.waiting_ci and handoff.waiting_ci rerun interrupted CI.

Upstream review and release

Upstream review observes the upstream PR the record names (upstream_pr), read from the upstream repository, in upstream_review.waiting_ci only. The observation takes, in order, the first row that applies:

  1. The upstream PR is merged: record_merge records merge (merge commit, time, target branch, and an evidence record of kind merge) and leads to release_wait.idle. A merged PR is recorded even when riscv64 was deleted.
  2. It is closed without merge: record_pr_closed_unmerged leads to upstream_review.waiting_human with the pending action pr_closed_unmerged.
  3. Its head differs from upstream_pr.head_sha: record_head_change leads to upstream_review.waiting_human with the pending action upstream_head_changed, at a new revision, with the new head recorded and the CI evidence cleared. The head a revision of the pipeline published is not such a change: record_revision_publish_success recorded it when the Result was folded.
  4. An authorized explanation-only comment on the upstream PR takes record_explanation: the comment is recorded and quoted on the tracking issue as a code span, so nothing in it renders; nothing is posted on the upstream PR.
  5. Authorized actionable review feedback on the upstream PR takes record_actionable_review to upstream_review.fix_needed at a new revision, with the feedback pending; the observation ends.
  6. An executed blocking failure of a CI run on the upstream PR head takes record_upstream_ci_failure to upstream_review.fix_needed, with the evidence as last_ci_evidence_id, once per head and CI run: a failure whose evidence is already recorded is not recorded again, so a resume does not request a revision for it again. Passing CI keeps the state, and CI that is not complete is read again. The pipeline never reruns upstream CI.

Review feedback on the upstream PR is authorized as on the development PR: its author is in the command authority, and it is bound to the recorded head; the ids of the comments a row recorded join the replay fences. upstream_review.fix_needed and upstream_review.agent_running have no observation row and are not read. upstream_review.waiting_human is not observed either, except that with the pending action pr_closed_unmerged the upstream PR is read without any change, because its resume requires the PR open again; a parked record that names an upstream PR is read the same way, because restart_generation requires that no upstream PR is open. /upstreaming resume is refused until that observation finds the PR open again, and /upstreaming refresh from parked.idle until it finds the PR closed or merged; a failed read establishes nothing and holds no other command back.

Revision Work is allocated in upstream_review.fix_needed by request_upstream_revision (a failing CI job is recorded for the head; charges work_total and the cluster of that job) or request_review_revision (feedback only; charges work_total), and exhaust_repair_attempts leads to upstream_review.waiting_human with the exhausted counter once a budget is spent. Its Result is folded in upstream_review.agent_running by the rows of Development with three differences: a published Result takes record_revision_publish_success to upstream_review.waiting_ci at a new revision, which clears exactly the feedback its Work carried and records in upstream_pr.head_sha the head the publisher read back on riscv64 (the commit of its confirmed branch operation, or, for a publish-only retry that found the push of an earlier attempt on the branch, the candidate it read there), so the event names the head and the next revision Work is a new Work graph; a published Result that names no head read back is refused; a no_change report takes require_reviewer_answer to upstream_review.waiting_human with the pending action answer_reviewer (a human answers the reviewer on the upstream PR; the pipeline posts nothing there, and review_response.py answers nothing for a record in upstream review); and a proposal rejected as stale takes reject_patch_proposal, as every other rejection there. An uncertain Result (its push was not read back) is a failed publication, as in development, and the publish-only retry reads back the head a lost push left without pushing again. Publish-only retries run in upstream_review.agent_running as in development. Every exhaustion leads to upstream_review.waiting_human; nothing parks from upstream review without /upstreaming park, which applies in upstream_review.waiting_human only. resume_upstream_review (after pr_closed_unmerged, answer_reviewer, or upstream_head_changed) returns to upstream_review.waiting_ci without Work and clears the pending feedback; resume_upstream_revision (after failed revision Work or an exhausted budget) returns to upstream_review.fix_needed.

In release_wait.idle the official release is observed at most every 60 minutes (release.RELEASE_POLL_MINUTES, recorded in next_poll_at). The acceptance contract is the target contract the record names (target_contract_id): its distributions and the matrix rows (release_rows: interpreter, ABI, libc family, and platform floor) their official release must cover. release.decide takes one row:

  • require_release_intervention to release_wait.waiting_human when no such contract is recorded (pending action release_contract_missing) or PyPI has no such distribution (release_distribution_missing);
  • verify_release to released.idle when, for every distribution, the oldest official release that was uploaded after the merge and whose tag (v<version> or <version>) contains the merge commit covers every row with non-yanked wheels (release.coverage); it records release_acceptance and an evidence record of kind release_acceptance;
  • record_release_incomplete otherwise, recorded once per distinct observation (the event’s observation_key).

A failed read of PyPI or of GitHub is a collector failure: nothing changes, and the next tick reads again. resume_release_observation returns to release_wait.idle.

The plan decides

A planning run Result is folded in planning.agent_running only, through the table’s rows. The plan is recorded as evidence first; then exactly one row is taken:

Plan Row Leads to
None, a decision that is none of develop, park, and close, or a decision close that PyPI does not confirm (including a PyPI project that does not name the upstream repository) reject_plan, or exhaust_planning_recovery once planning_attempts is spent planning.idle at a new revision (a new planning run is due), or planning.waiting_human
Develop, and a refresh recorded that began with the fork and development PR the record still holds readmit_development development.fix_needed on the recorded fork, at a new revision
Develop otherwise, with a complete patch scope admit_development provisioning.idle at a new revision; the fork is provisioned before any patch Work
Develop otherwise, with an incomplete patch scope reject_plan (or exhaust_planning_recovery) as for an invalid plan
Park, with a recorded admission_override that names a class and paths admit_development, or readmit_development as for develop as for develop, with the override’s class and paths
Park, with an override that names no class or no paths reject_plan (or exhaust_planning_recovery) as for an invalid plan
Park, without an override park_planning parked.idle, with the plan’s rationale as parked_reason; the generation ends without a revision bump
Close, and PyPI confirms it close_planning closed.idle with terminal_reason already_released (a riscv64 wheel of the latest release is on PyPI) or no_work (pure-Python wheels only); a recorded override is not applied, and the event and the tracking-issue entry say so
Close, and PyPI does not confirm it reject_plan (or exhaust_planning_recovery) as for an invalid plan

The patch scope is a guard of admit_development (the fact “the verified plan names scope_paths, and scope_coverage_complete holds”): the reconciler establishes it when the admitted scope has an admission class, names 1 to 32 safe scope paths, and matches every path the plan’s path_coverage lists as possibly needing a riscv64 change (plan_gate.scope_problem). For an override the paths are the human’s scope: the class and the paths are required, and the coverage is recorded but does not refuse it. readmit_development has no scope guard. Both admissions record the plan, the admission class, and the scope paths, clear the refresh and the override, and record beside the row in scope_coverage_complete whether the coverage was complete for the admitted scope; repair Work reads it. A rejected plan keeps the override and the refresh for the next planning.

A decision close ends the contribution for good, so the plan’s word alone never closes it: the reconciler reads PyPI itself (collect.pypi_project) for every distribution the record names and confirms the close (plan_gate.close_confirmation, the fact “PyPI serves riscv64 for the latest release of every distribution, and each PyPI project names the upstream repository”) when each PyPI project names the record’s upstream GitHub repository in its metadata (a project URL, the home page, or the download URL, compared without case and without .git) and the latest release of each publishes a non-yanked riscv64 wheel (linux_riscv64, manylinux_*_riscv64, or musllinux_*_riscv64, any interpreter), or pure-Python (platform any) wheels only. The reconciler derives terminal_reason itself, never from the plan: already_released when at least one distribution has a riscv64 wheel, otherwise no_work. A missing PyPI project, a PyPI project that does not name the upstream repository (the recorded packages may be names of any registry, and a PyPI project of the same name from another repository confirms nothing), an sdist-only release, platform wheels without riscv64, and an empty or invalid list of distributions do not confirm it, and the plan is rejected. PyPI is the one registry a close is confirmed from: the trusted research gate already refuses a close whose plan records no PyPI release channel, a release channel without riscv64, or no recorded package, so a project of another ecosystem that already serves riscv64 is parked with that evidence. A failed PyPI read is a collector failure: the contribution is skipped for the tick with no state change, and the same Result is folded at the next tick. The tracking-issue entry of the close shows the release and one wheel PyPI serves, quoted; the plan’s rationale stays in the event.

Errors while a tick runs

An error in one contribution does not stop the controller tick. Every step of a tick that works on one contribution runs inside isolation.contribution(contribution_id, step): the confirmation of a development PR or provisioning receipt, the fold of a worker Result, dispatch recovery, the recovery of recorded review feedback, the observation of the fork branch and CI, the canary recovery, the intake-label check, the source identity check, the application of a command, the discovery alerts of an operation, the provisioning and development PR plans, Work selection, the publish-only retry, the history of requested Work (work_history), and the check of the operations the tick stages. An exception that leaves such a block is attributed to that contribution and classified by its class:

Exception Class What the tick does
collect.CollectError, http.client.HTTPException, OSError Collector failure: GitHub could not be read for the contribution. The contribution is skipped for the tick: no state change, no pause. The report lists it under skipped_contributions with the step, the error class, and the message.
Every other exception, including lifecycle.TransitionError and schemas.SchemaError raised outside the application of a command Unexpected error (isolation.ProcessingError). Everything staged for the contribution is discarded, none of its effects is requested, the other contributions are processed, and the contribution takes pause_on_processing_error.

Development happens on riscv64-dev. A record in the development, handoff, upstream_review, or release_wait phase whose fork names another development branch (fork.head_ref) is a shape no row of the table handles: the first step of the tick (record_shape) raises a TransitionError for it, so it takes pause_on_processing_error and nothing is done for it, and a paused one is left as it is. The pipeline has no migration for such a record.

Every GitHub read of the collector goes through collect.Api, which turns each failure to read a response into collect.CollectError with a bounded message: an HTTP error status, an error of the HTTP layer (http.client.HTTPException, for example IncompleteRead or RemoteDisconnected), an error of the transport (OSError, which covers urllib.error.URLError, TLS errors such as ssl.SSLEOFError, socket timeouts, and reset connections), and a response body that is not JSON (json.JSONDecodeError, UnicodeDecodeError), for example one cut off in transit. The body itself is never quoted. Only the read and the decoding are converted: a KeyError, TypeError, or ValueError raised while a well-formed response is used is an unexpected error. The HTTP-layer and transport classes are also in the collector class above, as a safety net for a read that does not go through collect.Api.

Expected rejections never reach the block and pause nothing, as before: a TransitionError raised while a command is applied and a command the table refuses are recorded as a rejected command with the reason, a command that fails authentication or the grammar is recorded as rejected, and an intake form that raises intake.IntakeError is reported as invalid. A malformed development PR receipt (KeyError, ValueError) is ignored until a valid one arrives.

Staging is all or nothing per contribution. reconcile.tick computes the tick on a copy of the committed state. When a contribution fails, the tick is computed again from the committed state with that contribution left out: no step processes it, so no record, event, operation, evidence, or command receipt is staged for it and no Work, dispatcher launch, provisioning, development PR, publication, or publish retry is requested for it. It still counts as an existing contribution for the others: it keeps its worker slot and its upstream. A command posted on its tracking issue, resume included, is left unconsumed and gets no reply: it is read again by every tick until one processes the contribution, and is applied or rejected then. A request that would become a new contribution in this tick is deferred and read again by the next tick. Before the result is returned, the tick verifies that nothing staged and nothing requested names the contribution, and stops otherwise.

After an unexpected error the controller takes pause_on_processing_error on the record as it was committed before the tick, through the engine. The verb sets paused with paused_by controller and paused_at, clears the requested Work and the pending publication, and keeps the revision; from an agent_running state it leads to the state in which the Work is due again; paused_reason is processing_error: <error class>: <message> (step <step>, run <run id>). The record and the event are the only things the tick stages for the contribution. The event carries the step, the error class, the message, and the run id in its details; the status ledger posts them on the tracking issue with the statement that everything else of that run was discarded. The report lists the error under controller.alerts and, with its fields, under processing_errors. python -m reconcile still exits with status 0, since the tick goes on, and prints one GitHub Actions ::error:: annotation per processing error, built from the same bounded text and escaped as the workflow command format requires, so that a pipeline bug charged to a contribution is visible on the workflow run. /upstreaming resume at the current revision clears the pause and bumps the revision.

The error text is bounded and sanitized before it is stored or posted (isolation.clean_text): the text normalization of the state store is applied, everything that matches a credential pattern of the store is replaced, control characters and line breaks become one space, and the message is cut to 300 characters. The traceback is written to the log of the workflow run only.

A contribution that is already stopped is not paused again. The verb is guarded by not paused, like every verb that sets the flag, so an error in a contribution that is paused, by a human or by the controller, changes nothing and appends no event, whatever the error is; the same holds for a terminal contribution. Observations still fold while a contribution is paused, so an error that persists is met again by every tick: each tick leaves the contribution out, lists the error in its report, and writes nothing. The next error after a resume pauses it again. An error in a contribution that is already stopped, and in a contribution that the same tick would have created from an intake request, which has no committed record to pause, is reported only in the tick report (controller.alerts and processing_errors) and in the workflow annotation: no event is appended and nothing is posted on the tracking issue.

Stop commands are applied before any Work is selected. When applying pause or park fails with an unexpected error, the contribution is errored like in any other step: the tick is computed again without it, so nothing is launched for it, and it is paused by the controller.

The whole tick stops, nothing is committed, and no contribution is paused when:

  • unexpected errors occur in two or more contributions in one tick. Collector failures do not count: any number of contributions can be skipped. Neither do pauses that trusted code requests for one contribution (isolation.PauseRequest, such as an accepted Result whose report cannot be stored, worker_report.ReportError): each is handled like an unexpected error of its contribution (isolation.ContributionPause), and any number of them in one tick pause their contributions and leave the tick going;
  • pause_on_processing_error cannot be applied to the errored contribution, for example because its record is in no admitted state;
  • an exception is raised outside every block: the state load and the validation of the store, the policy, the text and record migrations, the collection of the tick’s inputs (intake issues, command comments, tracking issues, source snapshots), command authentication, the intake of a request that is not a contribution yet, a command on an issue that tracks no contribution, the staging of the result into the store, and the state commit.

python -m reconcile exits with status 1 and a message that names the contributions and their errors in the first two cases, and with the error itself in the third, as before. The record migration is in the third group although it works on one record: a record that awaits the migration is not in a state of the table, so no row could pause it, and the state load refuses a handoff record in any other shape.

Worker reports, history and steering

Every worker run of a patch, repair, revision, submission rewrite or submission review writes a report (report.json, schemas/worker_report.schema.json) beside its Result: a summary, what was attempted and why, each approach with its outcome (adopted, abandoned, failed, inconclusive), its evidence and its lesson, the failures with their evidence, what remains open, the verification done, and the earlier failed or abandoned approaches it tried again with the new evidence that justified it. The report is untrusted text. When the Work payload carries a history (context.history), the trusted gate requires a report that names the contribution, the revision, the task, and the digest of that history (worker_report.check): the worker gate rejects a patch Result that is otherwise accepted without one (reject_patch_proposal), and the submission checks treat a rewrite or review without one as Work without a usable Result. The worker gate checks the report last, after it classified the Result: a blocked Result is worker_blocked whatever its report, since that report is discarded anyway. Work dispatched before reports existed may finish without one. Planning writes no report: the verified plan is its report.

The report is stored only for a successful worker, one whose own Result is accepted and acted on, whatever CI says afterwards. The reconciler stores it as worker_report evidence (report-<contribution>-r<revision>-<worker run>, an id over 128 characters keeping its first 111 and 16 hex digits of its SHA-256, like the steering-<contribution>-<digest> ids; an id that still cannot be stored is a report that cannot be stored), bound to the Work id, generation, revision and task and the time the Work was requested, with the head before and after the Work and the changed files of the trusted operation, when one of these rows folds the Result (reconcile.REPORT_VERBS): record_publish_success, record_revision_publish_success, accept_submission_rewrite, accept_submission_review, request_ci_rerun, and require_reviewer_answer. The event of the row names the evidence (report_evidence_id), or records (report: absent) that Work dispatched without a history returned no usable report. A success row never drops the report of Work that carries a history: the gate accepted that Result only with a valid report, so when the reconciler finds it missing, unreadable or invalid, or cannot build its evidence, worker_report.evidence raises inside the contribution’s isolation block and the tick takes pause_on_processing_error instead of the row, whose reason names the Work and why its report cannot be stored. That pause is specific to the contribution: any number of them in one tick stop nothing else. The pause clears the Work, so the Result is never folded without its report: it takes record_late_effect the next time it is seen, which records it as processed (the artifact is not acted on again) and records in the event that its report could not be stored, and a branch effect it carried is seen by head observation after the resume. A Result that takes record_late_effect although its push landed (status published with a head read back, for example a Result of a revision the record has left) is the work of a successful worker whose head is on the branch, and CI runs on that head: its report is stored as worker_report evidence of the Work it answers (verb record_late_effect, head after the Work as for the success row of its task), named in the event, so a repair after failing CI on that head reads it. A late Result whose push was not read back (status uncertain) may have landed: its report is stored the same way with the commit it proposed as head_candidate and no head after it; a report that cannot be stored there is recorded in the event (report: not stored: ...) and changes nothing else. A Result whose push may have landed but that no success row folds stores its report too (reconcile.pushed_report_evidence), with the commit it proposed as head_candidate: an uncertain Result held for a publish-only retry stores it at the hold (verb schedule_publish_retry, or exhaust_publish_recovery when the budget is spent), since the Result is then marked processed and its artifact never read again, whatever ends the hold (a retry, the exhaustion of the retries, a pause, a controller stop, a park); a publish-only retry rejected as stale while the operation of the earlier attempt is still open (replan_development), or, in upstream review, behind a confirmed one (reject_patch_proposal), stores it with the commit of that operation. The success fold of a retry of the same worker run stores the same evidence id again with the head after the Work, so no report is stored twice. Like a success row, a report the gate accepted that cannot be stored there pauses the contribution. Every other fold (a rejection, a blocked worker, a replan, a failed rewrite or review verdict, an unusable submission Result, an infra_error publication, a late Result that published nothing) discards the report with its artifact; the rejection reasons of the trusted gate are not fed forward either. The head after the Work is the commit of the confirmed publication operation the row names: the Result’s own, or, for a publish-only retry that read the lost push back or was rejected as stale behind it, the confirmed operation of the earlier attempt (worker_report.head_after); else the candidate a publish-only retry found, or the head a revision read back. A report whose push was not read back (a held or late uncertain Result, or a stale retry behind the operation of an earlier attempt) records the commit it proposed as head_candidate (worker_report.head_candidate) and no head after it: the history matches it only to that very commit, so a CI run on that commit is linked to it and it is the report of the head only while the recorded head is that commit. A report file is bounded by worker_report.MAX_REPORT_BYTES (32 KiB) as written, in the artifact and at the gate; the worker’s instructions and the schema state that limit and that a larger report is refused with the Result, and the schema bounds each list and field so that a valid report cannot greatly exceed it. The reconciler reads the report file of the publication artifact exactly as the gate read it (worker_report.read: a regular file, at most one byte over the bound) and checks those bytes again, so a report accepted at the gate is never refused at the fold. A document that is not JSON, or is nested deeper than the parser allows, is an invalid report. A lone surrogate (an escape such as \ud800) is dropped from the stored text, since the store cannot encode it. No record field changes.

Human steering is collected when Work is allocated (collect.steering): the tracking issue description when it differs from the description frozen at intake and the issue author is in the command authority, the tracking issue comments, and the reviews, review comments and conversation comments of the development PR and of the upstream PR, each list bounded to its newest five pages of 100 (review comments sorted newest first by the API, every other list read from its last page backwards through the Link header), so the newest text is the text read. A review with an empty body is kept when its state is a verdict (APPROVED, CHANGES_REQUESTED, DISMISSED); since GitHub gives an edited review no new time, a review’s version is its submission time and the digest of its state and body, so an edited or dismissed review is a new version. A list with more pages than were read (a rel=next link left after the fifth page read, or a rel=last link past the fifth page, whatever the number of items on its last page) holds older items that were not read (an earlier collection read them while the list was shorter, unless it grew past the bound between two collections); it is flagged in omitted (<source>_list_cap_reached), recorded once in a human_steering record even when nothing else is new, and shown in the history. Only accounts whose immutable id is in command_authority.actor_ids steer (authority true). The REST API does not name the last editor of a text, and the collector reads no GraphQL. On the control repository and the fork, write access is part of the command authority’s trust: the edited tracking issue description is attributed to the issue author and trusted by that author’s authority, and an edited comment, review comment or review of an authority account steers like any other, also when it was edited before it was first collected. On the upstream PR, whose maintainers can edit those texts and are not in the command authority (collect.edits_unverified), a comment or review comment of an authority account that was edited after it was written (updated_at differs from created_at), and a new version of such an account’s review (its state or body changed), is recorded with authority false and edit_unverified true: the edited text is shown in the timeline as an unverified_edit entry and never steers; the version recorded before the edit still steers. On the upstream PR, accounts whose association is OWNER, MEMBER or COLLABORATOR are kept as maintainer review feedback (authority false), never as steering; every other account, every bot and every other empty body is counted per source and not recorded. New items are recorded as human_steering evidence with author, times and link (steering.new_evidence): an edited comment is a new version that names the one it supersedes, and a deleted comment stays recorded. One record holds at most 200 items (180 KB). What the histories of one tick stage is bounded in bytes, so the state commit always fits storage.max_commit_bytes with the rest of the tick: at most 256 KiB of new human_steering records per contribution (reconcile.STEERING_BYTES_PER_CONTRIBUTION), recorded newest first so that the history holds the newest steering, and at most 1 MiB of steering and histories per tick (reconcile.HISTORY_BYTES_PER_TICK). Items left out are recorded by the next tick that builds a history for the contribution and are counted meanwhile in the history’s omitted as steering_deferred and in the tick report; a Work whose history does not fit the bound of the tick is listed in the report and gets its history from a later tick, while the dispatcher defers it. The history’s omitted counts are those of the newest collection, not a sum over collections. Steering fires no row, never sets review_scope_extension, and never changes pending_feedback_evidence_ids, scope_paths, or any other field; the human relay and inquiry rows of the observation are unchanged. The frozen intake description stays the request identity and the plan’s digest.

The tick builds the history of every requested Work that has none (work_history.build), after the publish-only retries and only in a tick that observes: for the record as the tick leaves it, normally in the same commit as the allocation, and for any requested Work that has no history yet. The history is fixed when it is built, since the dispatcher pins it in the payload of that Work id: steering written after that, while the same Work waits for a worker slot or is dispatched again (retry_dispatch, or the queue’s retry after a worker run that ended without a Result), reaches only the next Work. A history recorded after its Work was submitted (Work requested before the history existed) reaches only the next Work too: the queued payload, which names no history, is never replaced. A Work re-armed after a refused dispatch (rearm_dispatch), resumed after a human wait, or retried after a terminal graph is allocated at a new revision, so it has a new Work id and a new history, built with the steering written during the wait. Its id is derived from the Work id (history-<32 hex>), so active_work needs no new field. The history is a pure function of the evidence of the contribution, all generations included: the steering items of the command authority in the order they were written, then one chronological timeline of the stored worker reports, the CI runs (each linked by after_report to the report whose published head it ran on, so a repair after failing CI reads what the passing worker tried), the review feedback and inquiries the observation recorded, the submission rewrite and review verdicts, and the reviews of upstream maintainers. A report stored by record_late_effect is placed at the time its Work was requested (work.requested_at of the report, which the payload carries; stored_at names when it was stored), never as the newest entry by the time it was stored. It is at most 64 KiB in canonical JSON, and every bound of it is in bytes of canonical JSON, so multibyte text counts as what it costs. A larger history is condensed deterministically, never dropped uncounted, and its size is checked after every step. Two things are protected. The reports (work_history.protected_reports): the newest report, by the Work it describes (its generation and revision, then its time), and the report of the head, the newest report whose head_after, or head_candidate (the commit of a push that was not read back), is the recorded head of the branch the record works on (the head CI ran on), else the newest report that published a head, together with the newest CI run of each workflow linked to it (at most 8); a report that published nothing (a CI rerun, a reviewer answer, a submission rewrite or review) is never the report of the head, so a repair after failing CI reads the whole report of the worker whose head failed whatever was stored after it. And the steering of the owner, whose newest items keep a reserve of 16 KiB. Everything else gives way first: (1) the other timeline entries (older reports and their CI runs, further CI runs, review feedback, submission verdicts, maintainer feedback) become a short form, oldest first (the worker’s summary and each approach’s title, outcome and lesson as separate fields, a CI state and its first failing jobs, the first 300 bytes of feedback); (2) the oldest steering items beyond the reserve are cut to 300 bytes; (3) the other timeline entries are folded, oldest first, into one counted earlier entry (those before the protected report that comes last) or one counted later entry (those after it), with counts per kind, times, evidence ids and the title and outcome of each failed or abandoned approach (each list bounded to 50, with the number left out stated); (4) the protected reports take their reduced form (reduced, with evidence_path): every section kept, each field cut to a bound (the summary to 1000 bytes, each approach’s title, outcome, lesson, evidence and description, each failure, open item and revisited entry, and shorter what was attempted and verified), so no steering item is folded while a protected report is whole; (5) the oldest steering items beyond the reserve are folded into one counted steering_earlier entry (times and evidence ids); (6) every steering item but the newest is cut short and then folded, oldest first; (7) only then are the linked CI runs, the newest steering item, the newest report and, last of all, the report of the head condensed and folded. A fully folded history always fits its bound; should it not, its lists of evidence ids are shortened with the number left out stated (condensed.degraded) rather than the Work held. sources lists at most the 100 newest source evidence ids and sources_not_listed counts the rest. The condensation keeps the size of the document up to date by the size change of each step and serializes the whole document only when it may fit, so its cost grows linearly with the evidence. A review feedback entry lists at most the 60 newest items of its record (20 once condensed) and counts the rest (items_not_listed). A review feedback item whose text is in the steering section is replaced by a pointer to it only when it is the same kind of GitHub object (review, review comment or comment) with the same id. Every cut passes through worker_report.clean, and the built record is checked for the credential patterns of the store and redacted again (worker_report.scrub), since a cut or a join of clean text can create a match; a record that still matches raises inside the contribution’s isolation block, so it pauses that contribution and never stops the tick. Entries with the same time are ordered with the worker report first, and a CI run is linked to the report that published its head whatever their order, so the CI observed in the tick that folds the Result is linked to that Result’s report. A condensed entry, of the timeline or of the steering, names the evidence file that holds it in full (evidence_path). A steering list that GitHub answers with 404, 410 or 451 (a deleted fork, an upstream repository or pull request that is gone or not accessible to the App) is one no retry will read: it is named in steering_unreadable and in a limitation of the history, and the Work proceeds with what could be read. Any other failed GitHub read while the steering is collected (a server error, a rate limit, a 403, a transport error) defers only the history: the allocation and the rest of the tick are committed, the entry of the Work in the tick report names the failure and how long the Work has waited (deferred), the dispatcher defers the Work, and each later tick reads the lists again. The grace is measured from the committed active_work.requested_at, which a deferral never moves: once the Work has waited an hour (reconcile.STEERING_FAILURE_GRACE), a list that still fails is read without: it is named in steering_unreadable like a list that is gone, what failed is reported under steering_failed and in controller.alerts (the HTTP status GitHub answered, or no HTTP answer and the error for a read GitHub never answered), and the history is built, so one failing list never holds the contribution. A list read for its newest pages whose first page names no last page is read forwards, keeping its five newest pages, for at most 50 pages (collect.NEWEST_SCAN_PAGES); a longer one is a failed read, never its oldest pages. A list page GitHub answers with an empty body is a failed read too (CollectError), never a pause.

The dispatcher (python -m work plan) gives every Work, planning included, its history by reference (context.history: the control repository, the pinned commit, the path, the SHA-256, and the evidence id; no URL, to keep the payload small), like the plan. Work whose history is not committed yet is not dispatched in that run and is listed under deferred. Dispatch recovery decides nothing for it while its history is not committed, for at most two hours from the request (reconcile.HISTORY_WAIT, the steering grace and a margin): nothing is charged and nothing is launched. After that it is decided like any other, so a history that is never recorded ends in the human wait of exhaust_dispatch_recovery after retry_dispatch. Once the history is committed, the dispatcher runs are counted from the time it was recorded; the tick that records the history of Work an earlier tick requested asks for a dispatcher launch at once (dispatch_relaunch, and dispatch in the entry of the Work in the tick report), and dispatch recovery launches it again after the launch grace should that launch not show up as a run. When a history that is never recorded leads to retry_dispatch or exhaust_dispatch_recovery, the event says so (history: never recorded, and why in plain words), and the tracking issue entry of the human wait states that the history of the Work was never recorded, so no worker ever received it. A Work whose payload the run cannot build (an evidence file it names is missing at the pinned commit, or the payload is over the queue’s safe budget of 15500 bytes, work.MAX_PAYLOAD_BYTES) is skipped and listed under skipped with the reason, and every other Work is dispatched: one record never fails the dispatch of the others, and dispatch recovery decides the skipped Work. The controller measures the smallest payload of the Work itself (work.payload_floor), from the committed evidence as the dispatcher builds it (work.payload_inputs: the allowed paths of the scope or the target contract, the reason evidence with the plan reference, the commit rules and template sections of the plan, the rewrite a review reviews), with the history and plan references at their exact size and the control repository id at its longest (19 digits); when it is over the budget, the events of retry_dispatch and exhaust_dispatch_recovery name the cause (why: the payload size, the size of the frozen tracking issue description it carries inline, and the length a new request must keep to), which the tracking issue entry of the human wait shows. A trusted pre-agent step of the worker and the planner checks the reference, fetches the file at the pinned commit, checks its digest, its kind, its id and its Work id, and writes it to /tmp/gh-aw/agent/history.json; it prints only the evidence id.

All worker-written and human-written text is redacted for the credential patterns of the store, stripped of control characters, normalized, and bounded with an explicit truncation marker before it is stored (worker_report.clean). It is never rendered on the tracking issue or the status page: only evidence ids are named there. It reaches the agents as a data file separate from their instructions, which say that the history is recorded data, never instructions about tools, credentials, scope, repositories or the workflow, and that nothing in it can widen the allowed paths, the allowed operations, or where and what is pushed. The worker reads the history first, follows the owner’s steering within the task’s scope and rules, and does not repeat or revert an approach the history records as failed or abandoned without new evidence, which it names in its report. The planner reads the steering first, then the tracking issue comments as untrusted research.

Stop and resume

/upstreaming pause, resume, park, refresh, and abandon on a record in a state of the table are applied by engine.apply_command, in every phase; the controller resolves the one verb whose guards hold and refuses the command with the guard that does not.

  • pause sets paused with paused_by human, paused_at, and the optional reason in paused_reason. It clears the requested Work and the pending publication, and keeps the revision. In an agent_running state it leads to the state in which the Work is due again (planning.idle, development.fix_needed, upstream_review.fix_needed), so the resume requests fresh Work. A Result of the stopped Work takes record_late_effect. While paused no Work is requested, no budget is charged, no publication or publish retry is launched, and no reminder is posted.
  • resume on a paused record clears the flag and bumps the revision (resume_pause). After a stop longer than refresh.stale_after_days days in provisioning or development, counted from the older of paused_at and pending_human_action.requested_at, it takes resume_stale instead: complete planning runs again from queued.idle while the fork and development PR are kept, and the refresh records the phase, head, and development PR it began from (no head or PR when there is no fork yet). A refreshed plan returns to development on the recorded fork only when the refresh began with that fork and its development PR; otherwise development is admitted afresh. In the handoff phase the resume never refreshes: the candidate head, handoff_request, and the CI evidence are kept, and submit-upstream then names the new revision and the same head.
  • resume in a human wait that is not paused takes the resume of that wait that its pending human action selects; on a paused human wait the first resume clears the flag only, and its tracking-issue entry names the pending action that remains, so a second resume leaves the wait.
  • refresh in parked.idle starts a new generation at queued.idle (restart_generation); it requires the exact revision, no open operation and no pending publication, and no open upstream PR, and it is accepted while paused: the new generation then stays paused until a resume. It accepts an optional admission class and paths, /upstreaming refresh revision=N class=<class> paths="<glob>,<glob>" reason="...", which are recorded with the reason as admission_override; the paths must be safe relative paths, as for a scope. The class and the paths are given together or not at all: an override admits development only with both, so a refresh that names only one of them is refused with that reason and changes nothing. The new generation still runs complete planning; a plan that decides park then admits development with the override’s class and paths, and a plan that decides develop or close is applied as it decides (see The plan decides). An optional branch=NAME names the upstream target branch of the new generation instead of the one the request asked for at intake, /upstreaming refresh revision=N branch=NAME reason="...": the way to continue on a branch the upstream renamed or replaced (see The upstream base branch); a name that is not a safe Git branch name is refused. class, paths, and branch are refused by every other refresh, and head by the refresh in parked.idle.
  • resume in parked.idle only ends a pause (resume_pause). On a contribution there that is not paused it is refused with the reply that a new generation starts with /upstreaming refresh revision=N reason="..." and that class= and paths= on it record an admission override; a resume that names class or paths is rejected when it is parsed, with the same refresh form.
  • abandon applies in parked.idle only, with a reason and at any revision, also while paused. It leads to closed.idle with terminal_reason abandoned; the reason the human gave is kept in the event. A closed contribution is final: no command resumes it. Elsewhere the command is rejected with the statement that it applies in parked.idle; park first.
  • Besides parked.idle (above), refresh applies in the states whose rows take refresh_planning: development.fix_needed, development.waiting_ci, development.waiting_human, handoff.awaiting_submission, and handoff.waiting_upstream_pr, with the exact revision, no requested Work, no open operation or pending publication, and a recorded development PR and head; it is accepted while paused. In handoff.waiting_upstream_pr it names the exact clean head, /upstreaming refresh revision=N head=<clean head> reason="..."; elsewhere a head is refused.
  • park takes park_contribution from every state the rule covers, with a reason and with no open operation; it is accepted while paused. It does not apply in handoff.waiting_upstream_pr, release_wait.*, and the upstream_review states other than upstream_review.waiting_human.

A stop command is honored at a stale revision; every other command names the current revision. The reply to a pause of a paused contribution says it is already paused, and the reply to a resume of a contribution that is neither paused nor waiting says it is not paused.

/upstreaming block is retired: the lifecycle has one stop flag, paused, with its reason and who set it. The command is rejected with a message that names pause. The controller sets the same flag when the upstream repository identity changes (pause_on_identity_change, paused_by controller, paused_reason upstream_identity_changed) and after a processing error.

Commands

The grammar (commands.GRAMMAR) has the commands of the table and two intake commands:

Command Applies in
pause, resume, park, refresh, abandon, submit-upstream, retract-pr The states whose rows, or the paused flag, take them; see Stop and resume and Requesting upstream submission.
authorize-followup A merged contribution (release_wait, released); it records a follow-up request. Outside the table.
resolve-operation An operation, by its id; see the operation table. Outside the table.

The retired commands are rejected with a message that names their replacement, and the reply on the tracking issue shows the replacement’s form:

Retired Replacement
request-handoff, approve-handoff, register-upstream-pr submit-upstream at the submission gate; the upstream PR is verified by observation.
block pause, with a reason.
approve-scope None needed: the verified plan decides admission and provisioning starts automatically. A parked contribution restarts from parked.idle with refresh, with class and paths as an admission override.
provision None needed: the fork is provisioned automatically. In provisioning.waiting_human, correct the prerequisite, then resume; the resume states that the prerequisite is corrected.
restart refresh from parked.idle; closed.idle is final.
clarify resume in the human wait once the cause is corrected.
revise-scope refresh, in parked.idle with class and paths.
force-develop refresh from parked.idle with class and paths: the admission override that a plan decision park then applies.

The tracking-issue entries offer, under “Possible next commands”, the commands the table takes in the contribution’s state (in parked.idle also the refresh with an admission override, prefilled with the recorded class and paths, also while paused; a resume is offered there only to end a pause), for every state. A retired command is never offered.

Tracking issue entries and the status page

The status ledger (status_ledger.publish) posts an App-authored entry on the tracking issue only for an event that needs a human, and the lifecycle table decides which those are:

  • the event enters a state of kind gate, human_wait, or locked (the kinds of lifecycle.REMINDER_KINDS, which name a pending human step), or keeps the contribution in such a state at a new revision, since the commands a human posts name the revision (the first resume of a paused human wait is one);
  • the event sets the stop flag (paused is true in the event’s to): pause, pause_on_identity_change, and pause_on_processing_error;
  • the event enters a state of kind generation_end (parked.idle) or terminal (closed.idle, with an abandon, a withdrawal, or a close, and released.idle);
  • the event is a reminder of a pending human step: the rule that applies in exactly the states of those kinds and keeps the state (record_reminder);
  • the event is a wait for an unavailable upstream (status_ledger.UNAVAILABLE_KINDS), also when it keeps the state: require_base_branch replacing the wait a renamed repository caused once the repository is back without its base branch;
  • the event is a change the pipeline made without a human that the human must know about (status_ledger.NOTICE_VERBS): follow_renamed_base and resume_renamed_base, the record following a base branch the upstream renamed while the upstream PR is open; verify_upstream_pr when it names a base the upstream renamed before the PR was opened; resume_upstream_read, a wait that failed reads caused ending once the upstream is read again; and resume_renamed_upstream, the wait a renamed repository caused ending once GitHub answers for it under its recorded name again.

The wording of an entry is generated from the table (status_ledger.table_message), for every row: the verb, how it was taken (by a command, observation, the Result of requested Work, a remote operation, or the controller), the guards of the row that say why it applies (the exact revision, the stop flag, and the other guards every command row states are left out), the row’s description, the state it leads to with the description of that state (or that the contribution stays in its state), the pending human action the row records, and the budgets it charges. What the event observed is added as bounded data after it: a head, the submission package or the upstream pull request the pipeline recorded, the human who requested the submission, a mismatch or an error (quoted as a code span or a block quote that cannot open a comment), the spent or exhausted counters, an admission override, and, for the nomination and a reminder at the gate, the exact submit-upstream command bound to the revision and head the event recorded. A comment an explanation row recorded is shown as a code span, so nothing in it renders. The entries about an unavailable upstream or a renamed base (require_base_branch, exhaust_source_reads, require_upstream_access, require_renamed_upstream, follow_renamed_base, resume_renamed_base, resume_upstream_read, resume_renamed_upstream, verify_upstream_pr when it names a renamed base, and the reminders of the waits for base_branch_unavailable and upstream_unavailable) are written in plain words instead (status_ledger.plain_message): what happened and why, what was observed, and what can be done (see The upstream base branch); they name no verb, budget, field, state, or pending action, and the commands below them are the only names a human types. An event recorded outside the table (intake, the record migration, a development PR receipt, authorize-followup) has fixed wording (status_ledger.RECORDED_KINDS), and an older kind is named as recorded.

An event that records neither the source nor the destination state in its details (an older event) is placed by folding the fields it changed over the events before it, and a state the table no longer has takes the kind of its phase when every state of that phase has the same kind. Every other event is shown only in the event log of the status page; the ledger reports it as status_page_only and never posts it, so it is neither retried nor a failure. A posted entry carries a hidden marker with the contribution and the event sequence, so an entry is posted once and a later tick repairs a failure after the state commit. Replies to commands are posted by command_feedback and command_reactions.

The status page is generated by scripts/generate_doc.py from committed state only. Under each contribution’s row a disclosure, closed by default, opens its event log, newest event first. Each event shows its sequence, its time in UTC, its verb, its cause type, its source and destination state, and its revision, with links to what committed data resolves: the workflow run of the control repository that a cause names (a worker, planner, dispatcher, or controller run), commits on the fork, the development PR and the upstream PR, the tracking issue and the command comment, operations and their workflow runs, and evidence, with the CI run, its head, and its failed jobs for CI evidence. No free text of an event, evidence, or comment is shown; every value is escaped, and the same state gives the same page.

The status of each contribution comes from the table (generate_doc.status_label): its phase, and what the kind of its state says it waits for. A state of kind gate, human_wait, or locked waits for a human and names the pending human action. In a state of kind auto_wait the status names the first row the controller takes whose record guards hold, with the guards only the controller observes (a free worker slot, available capacity) as what it waits for, or else the first guard of such a row that does not hold; there is no separate capacity wait. A state of kind work, and an auto_wait state that only observation leaves, waits for the trigger of the rows that leave it: observation, the Result of requested Work, or a remote operation. A parked or closed contribution shows its phase, with the terminal reason, and a paused one is shown as paused with the status of its state.

Reminders

Every tick, the controller takes record_reminder for each record in a state of kind gate, human_wait, or locked whose pending human step was requested, or last reminded, at least human_sla_business_days.reminder business days ago (Monday to Friday, counted in whole days from the exact time of the request or of the last reminder). The row sets pending_human_action.reminded_at and nothing else; the revision is kept. While the record is paused no reminder is posted. The event carries the pending action and, for handoff.awaiting_submission, the revision and candidate head; its tracking-issue entry repeats the exact submit-upstream command for them. In handoff.waiting_upstream_pr the event also carries the link to the posted submission package, the human who requested the submission, and what the observation of the same tick found that does not match: the entry links the package, names the exact clean head, mentions that human, and states the mismatch when there is one; its possible next commands carry the exact retract-pr command.

Requesting upstream submission

handoff.awaiting_submission is the gate at which a human requests upstream submission. The tracking-issue entry for nominate_for_handoff names the candidate head on which CI passed and shows the command to post:

/upstreaming submit-upstream revision=N head=<full head SHA>

The grammar requires the revision and the full 40-character head. The engine accepts the command exactly as the table defines submit_upstream: the revision is the current one, the head is the candidate head recorded in handoff_request and still the head of riscv64-dev, and the contribution is not paused. A resume from a pause bumps the revision and keeps the candidate head, so the command then names the new revision and the same head. Outside the handoff phase the command is rejected with a reason that names the state the contribution is in and handoff.awaiting_submission, the state the command applies in.

submit_upstream leads to handoff.review_due and authorizes the submission rewrite, its review, and the deterministic handoff preparation described in The submission rewrite and review and The handoff operations. It records handoff_approval (the command, its actor, the exact revision and head, and the CI and plan evidence it saw); the rewrite Work is allocated by the controller in the same tick when a worker slot is free. No second command is needed until the upstream PR is open. riscv64-dev and the development PR are never changed for the submission, and the development PR is never closed.

The commands request-handoff, approve-handoff, and register-upstream-pr are retired. Each is rejected with a message that names submit-upstream.

/upstreaming retract-pr revision=N head=<clean head> withdraws the submission package in handoff.waiting_upstream_pr (retract_submission, to development.fix_needed, with the exact revision, the exact clean head of riscv64, and quiescence). The row reads no reason, so the command takes none. It bumps the revision, clears the pending action, handoff_request, and handoff_approval, so reminders stop, and unlocks branch work. No upstream resource is changed, and riscv64 is left as it is: the next submit_upstream replaces it.

The submission rewrite and review

Two uncredentialed Work tasks prepare the submission, one after the other, each in a fresh context, and each charged to work_total like every Work. Both run in the worker workflow, with the verified plan and its contribution guidelines, the approved head of riscv64-dev, the frozen base, the plan’s measurable commit rules (context.commit_rules), and the required sections of the pull request template (context.template_sections).

In handoff.review_due the controller allocates the rewrite (request_submission_rewrite, task submission_rewrite). The model reshapes the non-debug commits of the approved series on the base after the project’s commit conventions (squashing only where the contributing instructions or the reviewers require it, with the same final tree, and keeping every commit’s tree a tree of the approved series without its debug commits, in its order), and writes the upstream PR title and description after the pull request template, every section filled and every checklist item answered honestly, and after the contributing instructions, which take precedence over the pipeline’s instructions for content and style but never widen the trusted gates, the scope, or the credentials. It returns a rewrite (schemas/submission_rewrite.schema.json: verdict, reasons, title, description, and the digest of the series) and the reshaped series as a git format-patch mbox. A rewrite that finds an expectation the series cannot meet without a code change fails with its reasons.

The worker’s trusted publish job checks the rewrite without any token (submission.check_rewrite), before any review: the rewrite answers the Work, the series matches its digest, has at most 50 commits (counted in the mbox before anything is rebuilt and in the rebuilt series before any commit is validated), rebuilds on the base under the App identity to a deterministic head, and passes the publisher’s validation of an upstream-facing rewrite (admitted scope, no debug commit, no merge, no forbidden workflow content, no symlink, gitlink, or new executable mode); so does every commit of the series, not only its head: each commit is validated against the base like the head, each path a commit touches is a path the approved series without its debug commits changes, every file of every reviewed tree is the base’s or has the path, mode, and blob it has in a tree of the approved series without its debug commits, and every reviewed tree is the tree of a commit of that series later than the tree of the reviewed commit before it, so commits may be squashed and reworded but a series that reorders them, splits them into other trees, or adds and later reverts anything, including content the approved series removed, is refused; every attribution trailer (Signed-off-by:, Co-authored-by:, Reviewed-by:, and every other *-by: line, the title included, recognized after NFKC normalization and case folding with every hyphen-like character read as - and every colon-like character as :) names the App’s commit identity or is byte-identical to a trailer of the approved commits, and no attribution trailer is followed by a line that starts with white space, which git interpret-trailers would fold into it; its final tree is exactly the tree of the approved series without its {debug} commits; every commit follows the measurable commit rules, including the number of commits; and the description has every required section of the template as a Markdown heading and at most 12000 characters. A plan of schema version 1 records no rules and no sections: the rules and sections the rewrite reports having found in the project are applied instead, which can only refuse.

The reconciler folds the trusted outcome. A pass takes accept_submission_rewrite to handoff.review_pending and records the rewrite evidence (submission_rewrite_id: the title and description and their digest, every commit message and tree, the rewritten head, the clean tree, the tree of the candidate head, and the worker run and publication artifact that hold the series); the revision is bumped, since the review is new Work. A failed rewrite or a failed check takes reject_submission_rewrite to development.fix_needed: the revision is bumped, the reasons are recorded as rewrite evidence and become pending feedback that the next development Work carries, and nothing is posted or written.

In handoff.review_pending the controller allocates the review (request_submission_review, task submission_review). Its payload names the accepted rewrite (context.rewrite: the evidence, the run and artifact, and the digests of the series and the text). Before the model runs, the trusted pre-agent step downloads the rewrite’s porting-publication artifact with the job’s own read token, checks its id, name, and run, and checks the series and the title and description against their digests; the model reads exactly those. It reviews the series and the text against the pull request template, the contributing instructions, the commit conventions, and the reviewers’ expectations, and returns pass or fail with one reason per problem and each expectation with whether it is met (schemas/submission_review.schema.json). It returns no series and changes nothing. The publish job checks it without a token (submission.check_review): it answers the Work and names the digests of exactly that series and text, and a pass lists no unmet expectation. A pass takes accept_submission_review to handoff.building_upstream_branch; the review evidence (submission_review_id) carries the rewrite it passed, which the build of riscv64 and the package read. A fail takes reject_submission_review to development.fix_needed with its reasons as pending feedback.

Both Work also return the worker’s report. The check refuses an outcome whose Work carries a history and whose report is missing or invalid, as an unusable outcome; the report is stored as worker_report evidence only by accept_submission_rewrite and accept_submission_review. The review reads the reports of the earlier workers in its history to know why the series has its shape.

An outcome of either Work that is not usable (the Result could not be verified, the check could not run, or the Result is malformed, answers other Work, or names another series or text) is Work without a usable Result, never a verdict: allocate_work_retry within work_recovery and work_total, then exhaust_work_recovery to handoff.waiting_human, whose resume_submission_review returns to handoff.review_due for a fresh rewrite. A pause in handoff.agent_running or handoff.reviewing leads to handoff.review_due.

The rewritten series is held in the rewrite run’s publication artifact, which GitHub keeps 30 days, or the number of days the repository variable GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS sets (the generated worker lock uses it, and the controller’s workflow hands it to the tick). When it has expired or expires within a day, expire_submission_rewrite leads back to handoff.review_due for a fresh rewrite: in handoff.review_pending before the review is allocated, and in handoff.building_upstream_branch before an attempt is planned, also after a long human wait that resumed to the build.

The handoff operations

Two handoff states each run one remote operation through the trusted workflow handoff.yml, which also runs the ci_rerun operation of handoff.waiting_ci (its ci-rerun job, see CI reruns). No model runs there and no credential can write upstream; the authorized human opens the upstream PR under their own account.

State Operation kind Effect and readback Token
handoff.building_upstream_branch upstream_branch The reviewed series is downloaded from the porting-publication artifact of the worker run the accepted review names (the artifact’s id, name, and run are checked, and the series must match the review’s digest), rebuilt on the frozen base in a fresh repository without any credential (the public fork and upstream are fetched anonymously), and checked again, all before any token is minted: the reviewed head, the clean tree, the commit messages, and every check of the submission check. After the mint only the series digest and the head and tree of the prepared repository are verified again; the write token only pushes and never fetches. riscv64 is then created at that head (--force-with-lease=refs/heads/riscv64:, which requires that it does not exist) or replaced (--force-with-lease=refs/heads/riscv64:<observed head>), and read back. Nothing is written while a pull request is open from riscv64 (upstream or in the fork), while riscv64-dev is missing, or while the record does not develop on riscv64-dev, and nothing is written when riscv64 already resolves to the reviewed head. riscv64-dev is only read. When the clean head has another tree than the candidate head, the same attempt dispatches the project’s required CI workflow on refs/heads/riscv64 if it can be dispatched, and reads its run back by head. destination App, the one fork, contents: write, workflows: write; a second token of the destination App on the one fork with actions: write only (the CI dispatch), minted only for an attempt whose clean head has another tree than the candidate head; the job’s own token reads the control repository’s artifact (actions: read)
handoff.preparing_submission submission_comment One App-authored comment on the tracking issue carries the submission package, found again by its hidden marker (contribution, approved revision, clean head) so it is posted once; it is read back. control App, porting-agent, issues: write

Each job of the workflow checks out the state at the head of main when it starts, not the commit the run was dispatched at, and before it mints its token checks that this commit is still the head of main (handoff.current_state) and that the state still runs the operation, of the job’s kind (python -m handoff check); a refusal there is the job’s receipt and its later steps do not run, so a queued or re-run job never acts on state that main has left. Before any effect the workflow checks the operation against that state again (handoff.load_request): the operation is planned and of the kind of the record’s state, the record names it as its active operation and is not paused, the policy permits the write, and the target is the recorded fork and riscv64 with the approved head and the accepted review whose head, tree, and series digest the operation names, or the tracking issue at the recorded clean head. A refused check writes nothing and its receipt is not folded. Immediately before each write (the push of riscv64, the CI dispatch, the post of the package, the rerun request of the ci-rerun job) the workflow reads the head of main again (handoff.unchanged_on_main): the same commit as the checkout passes; otherwise main must contain the checkout, and none of the policy, the record, the evidence it names (plan, CI, rewrite, review), or the operation (other than its launch count) may have changed, read from the comparison of the two commits. An unrelated commit (another contribution, an event) does not refuse, and neither does a change to code or workflows on main: pause and read_only are the operator’s stops. Anything else, an unreadable or truncated comparison included, refuses without the write, as a refused receipt (no receipt for the rerun) that is not folded and is launched again within operation_launch; a refusal after the push of riscv64 and before the CI dispatch leaves riscv64 at the reviewed head, so the next launch writes nothing and only dispatches. A change committed after that read is not seen: an effect that passed it may finish, as the table says of a pause, and the reconciler still reads every effect back. Every other failure of an attempt is reported by a receipt: invalid for a reviewed series that does not rebuild to the reviewed head or a lease on riscv64 that conflicts (the branch moved), blocked for an upstream PR open from riscv64, infrastructure for everything else.

The controller records the intent of each attempt and launches it like the other workflow operations: counted on the operation (operation_launch), again after LAUNCH_INTERVAL_SECONDS without a receipt, and not while the contribution is paused. Each attempt is its own operation of the same intent: its reason ids are the approval, attempt:<n>, and count:<k>, the count of the budget of the state (upstream_branch, submission_comment) at that attempt, and for the build the accepted review. The reconciler folds a receipt only for the open operation the record runs, reads back what it reports (riscv64 at the reviewed head and tree, and the series from the base to it with exactly the reviewed commit messages; the App-authored comment with its marker and digest), and fires the row bound in recovery.FIRES:

  • a confirmed attempt fires confirm_clean_head (sets clean_head_sha to the head of riscv64 and starts the rerun counts) or confirm_submission_package (sets the pending action open_upstream_pr and handoff_request, whose command_id is the package operation);
  • a failed attempt fires the retry row while the count is below the limit (retries.infrastructure_per_head_failure plus one attempts), and the next attempt is planned and launched in the same tick; at the limit it fires the exhaustion row to handoff.waiting_human with the pending action and the counter of the budget, and the next attempt counts from one after the resume;
  • an invalid build fires return_for_repair to development.fix_needed, and a blocked one require_branch_intervention to handoff.waiting_human with the pending action upstream_branch_blocked, whose resume_upstream_branch builds riscv64 again;
  • a moved package attempt, read back by the reconciler, fires return_for_repair to development.fix_needed; one the reconciler does not read back as moved is retried. A moved class on any other kind is an infrastructure failure.

An attempt whose launches are spent without a receipt (a cancelled or timed-out run, a lost runner, a dispatch that failed) is a definite infrastructure failure: once the last allowed launch is LAUNCH_INTERVAL_SECONDS old and the contribution is not paused, the controller closes it as failed (begin_effect, record_failure, with failure infrastructure and launches_spent) and fires the same retry or exhaustion row as a failed receipt (handoff.fail_attempt); a retry plans and launches the next attempt in the same tick. Every handoff work state therefore ends in its next state or in handoff.waiting_human, whose resume starts the budget again. A receipt of the closed attempt that arrives later is not folded.

Git receives the fork token as configuration in the environment of the git process (GIT_CONFIG_COUNT), never on its command line; the publisher does the same.

handoff.waiting_ci is observed like development CI, on the clean head of riscv64, with jobs that lost their runner classified: accept_clean_head_ci when every required job executed and passed (kept while an operation of the contribution is open), return_for_repair for a blocking failure, which records the failing evidence as last_ci_evidence_id (annotated with the candidate head when the clean head is another commit, so the repair names the failing job and charges its cluster), or for a riscv64 head that is not the clean head, which keeps the recorded evidence, and rerun_interrupted_ci or exhaust_interrupted_reruns for a required job that was cancelled or lost its runner while no job failed on its own (see CI reruns). The ci-rerun job of handoff.yml holds one token, of the destination App, for the one fork, with actions: write only, minted after its check. CI is a function of the tree: when the reviewed series has the tree of the candidate head (the approved series had no debug commit), the CI evidence of the candidate head on riscv64-dev is read for it. A run still in progress, a missing run, or interrupted CI that no row could rerun keeps the wait, within bounds: riscv64 has no pull request, so when the clean head has another tree, the build of riscv64 reads the workflow of the required CI run on the candidate head (workflow_path of its evidence) at the clean head, as data, and when its triggers include workflow_dispatch with no required input it dispatches it on riscv64 and reads its run back by the head SHA (external_ids.ci_dispatch of the operation records dispatched, exists, unsupported, or not_needed). The wait starts when the clean head is confirmed (clean_head_ci_since). require_clean_head_ci leads to handoff.waiting_human with the pending action clean_head_ci_missing at once when no run exists and the workflow cannot be dispatched, and in any case once CI on the clean head is not complete 12 hours after the wait began (lifecycle.CLEAN_HEAD_CI_WAIT_HOURS). Reminders apply. resume_clean_head_ci returns to handoff.waiting_ci, observes CI on the clean head again, and starts the bounded wait again; rerun_interrupted_ci and resume_ci start it again too.

handoff.waiting_upstream_pr is locked: its exits are verify_upstream_pr, retract_submission, and refresh_planning (with the exact clean head), and nothing else changes its state. The observation lists the open pull requests of the upstream repository whose head is riscv64 of the fork owner and verifies exactly one that is open, against the upstream repository and the frozen base, from the fork’s riscv64 at the exact clean head, and authored by a human whose account id is in command_authority.actor_ids. It records upstream_pr with that author and enters upstream_review.waiting_ci. A riscv64 head that is not the clean head, a candidate that fails a filter, or several matching candidates take record_audit_observation once per distinct observation (its key is in the event), and the next reminder states it. No Work, no publication, no write to the fork, and no automatic exit happens in the wait.

The submission package

The package is derived from the committed record, the verified plan, the accepted submission review, the CI evidence of the clean head, and the commits from the base to the clean head of riscv64, which must be the reviewed series (handoff.build_package), so the same inputs give the same bytes:

  • the title is the reviewed title, at most 120 characters;
  • the description is the reviewed description, written after the project’s pull request template and contributing instructions; at most 12000 characters;
  • the prefilled link is https://github.com/<upstream>/compare/<base>...<fork owner>:riscv64?quick_pull=1&title=<encoded>&body=<encoded>, every value percent-encoded; when it would be longer than 8000 characters it carries the title only and the comment says to paste the description;
  • in the title and the description an HTML entity of an at sign (&#64;, &#x40;, &commat;, and those of the fullwidth and small at signs) is decoded, then every at sign that is followed by any character other than white space (a character reference such as &#117; can decode to a login character) and not preceded by an ASCII letter or digit gets a word joiner (U+2060) after it, whatever the Markdown around it (code, emphasis, escapes, unclosed fences), so the upstream pull request notifies nobody; an e-mail address keeps its at sign. The comment says so whenever anything was changed;
  • the comment shows the upstream repository and base with its id, the source fork and branch riscv64 with its id, the approved head of riscv64-dev it was built from and the development PR, which stays open, the exact head, the changed files (cut with the count of the files it leaves out when the whole list would not fit the comment), the number of required CI jobs that passed and the head they ran on, the package operation, the approval command, the plan evidence, and the review evidence, a warning to check that the compare form shows exactly that head (with the exact retract-pr command otherwise, and a note that after a pause and its resume the latest tracking-issue entry carries the current revision), the title and the full description outside the link, the contribution rules of the plan, that the pull request is opened at exactly that head with no commit added to riscv64 and no file edited in the form, that a change the contribution policy needs in the series (for example a CHANGELOG entry or a commit sign-off) withdraws the package with the retract-pr command for a repair in development instead of being submitted, and that only steps outside the series (such as signing a CLA) are the human’s before submitting, the admitted paths the series does not change as a reason to withdraw, that the title and description follow the template and should be reviewed before submitting, what to do when the human’s account cannot open the pull request (another human of the command authority opens it from the same package, never from another fork or branch), and the hidden marker;
  • every untrusted value (the contribution rules, the admitted paths, the changed files, the commit messages, the CI job names, the reviewed title and description) is in a code span with its backticks replaced or in a fenced block longer than any backtick run it contains, so none of it renders as a mention, a link, an image, or HTML; the only mention is the human who requested the submission. Untrusted text is also stripped of credential patterns and of HTML comment openers and closers, removed until none is left, so no removal joins the rest into a new one.

The workflow posts the package only while riscv64 still resolves to the clean head; a branch at another head, or one missing (deleted or renamed) from the fork read under its recorded repository id, fails the attempt with the class moved, and a read that establishes neither is an infrastructure failure. The reconciler reads riscv64 again (handoff.moved_readback): when it is still off the clean head, return_for_repair returns the contribution to development.fix_needed, keeps the recorded CI evidence (a moved branch has no CI verdict), and charges no submission_comment budget; when it is read at the clean head or cannot be read, the failure is folded as an infrastructure failure (retry_submission_comment, then exhaust_comment_retries). A package already posted is found by its marker and read back: only an App-authored comment whose bytes are this package, or whose last line is the marker and which names the approval command in its package operation line, counts, so a comment of anyone else or one that only carries a marker is never taken for the package.

Record schema and its migration

The record schema (schemas/contribution.schema.json) is strict: every field of the record is required, as are the counts of budget (reruns among them) except source_unavailable and source_unavailable_since, which an absent count reads as zero and no migration adds, the counter of a pending human action, and the fields of the Work identity in active_work (generation, attempt, dispatched_run_id, reason_ids, and feedback_evidence_ids, which the allocation rows set, empty for Work that carries no feedback). The stop flag is paused alone: the record has no blocked_reason. The enums of phase and activity are the phases and activities of the states of the table, and the counter a pending human action names is a budget of the table; scripts/generate_state_machine_doc.py writes them into the schema, and its --check fails when the committed schema differs. A record is in a state of the table, and a human wait of the handoff phase carries a pending action the table enters it with.

A record written before the schema was strict can lack fields the table added later and can still carry blocked_reason, always null. The controller rewrites such a record itself, before it does anything else in a tick (state.migrate_record_fields):

  • Each missing field is added with the value the pipeline read for an absent one: null, an empty list, false, or zero, as engine.RECORD_DEFAULTS, engine.BUDGET_DEFAULTS, and engine.WORK_DEFAULTS list them. budget.reruns starts for the recorded head (zero reruns), as the engine counted absent rerun counts. A missing pending_human_action.counter is null. The null blocked_reason is removed, and so is budget.reruns.answered_ci_evidence_id, whatever its value: the fence of the CI run a request_ci_rerun answered before the trusted rerun, which the confirmed rerun operation replaces.
  • Nothing else changes: the state, the revision, the generation, the fork, the development PR, the head, the evidence, the budgets that are recorded, and the replay fences are kept.
  • A record with a set blocked_reason, a state outside the table, or any other difference from the strict schema has no migration: the controller stops with an error and writes nothing.
  • The record and one appended event of kind record_fields_migrated (cause migration, strict-record-schema, with the added and removed fields in its details) are the only paths of that state commit; the tick requests no effect. The event is shown in the event log of the status page only. The state publisher’s final check accepts the commit and refuses any commit that writes a record without the fields again. The migration is idempotent: a migrated record is not selected again.

The planning phase and its plan were once named investigation and dossier; lifecycle.HISTORIC_NAMES maps each name that is no longer written (the phase and its states, the verbs of its rows, the budget investigation_attempts, the pending action investigation_failed, the evidence kind dossier, and the field dossier_evidence_id) to the name that replaced it. The controller rewrites state written under the historic names in the same migration-only commit, before the field migration (state.migrate_record_names, with engine.with_current_names for a record):

  • A record: the fields dossier_evidence_id and budget.investigation_attempts take their current names with their values, and the historic values of phase, previous_phase, pending_human_action.kind, and pending_human_action.counter their current values. A project: the field dossier_evidence_id. An evidence record: the kind dossier becomes plan; its id is kept, since operations and events name it.
  • Nothing else changes, updated_at included. Requested Work of the historic task investigation has no migration (its queued payload names a worker profile that no longer exists), and neither has a record that carries a field under both names: the controller stops with an error and writes nothing.
  • One appended event of kind record_names_migrated per contribution (cause migration, plan-rename, with the renamed places, the renamed evidence of the contribution, and the renamed projects of which it is the first contribution in its details) records it. Until the controller runs, python -m state validate reads each such file as the migration rewrites it and names it as awaiting the migration; the state publisher refuses any commit that writes a historic name again.
  • Committed events are never rewritten: they are the history as it was written, and the event schema accepts any kind. The tracking-issue ledger reads a historic verb, state, or phase of an event under its current name (lifecycle.current_name), and the event log of the status page shows an event as it was recorded. A submission package posted before the rename names its plan evidence dossier evidence, and its discovery accepts both.

Records written before the lifecycle table (the old handoff approval wait, the blocked stop flag, the terminal phases abandoned, no_work, deferred, and already_released, and the provisioning and development states the table replaced) were rewritten by earlier migrations, whose events stay in the event log. A record in one of those shapes is not valid state any more: the controller stops with an error and writes nothing.

Remote operations

Every remote effect is an operation (.state/operations/), whose states and transitions are the operation table, lifecycle.OPERATIONS. recovery.py is its engine and the one write path of an operation’s status:

  • recovery.plan takes the initial verb record_intent: the operation is planned, before any effect.
  • recovery.apply_operation(op, verb, ...) takes one row from the operation’s status: every guard is a named predicate in recovery.PREDICATES, either a fact the caller establishes or a check of the command (resolve-operation names this operation, a resolution evidence record with the id the command names, the disposition). The row’s effects are applied exactly: external_ids merged, one discovery entry appended, resolution recorded from the command, its actor, and the evidence. A refused row changes nothing; a row the table does not have raises.
  • The caller names its observation with the helpers: mark_applying (begin_effect: capacity available, the contribution not paused, the final check before the effect passed), mark_result (record_response for a success or a lost response, record_failure for a definite failure), record_discovery (confirm_by_discovery for the exact resource, record_discovery for an absent or unrelated one; only an uncertain operation is discovered), fold_receipt, and resolve.

Who takes which rows:

Operation Rows Taken by
branch_update, branch_rewrite record_intent and begin_effect once the publisher’s final check passed (the publication check read the contribution not paused, and the head re-read right before the push matched the lease; a push reserves no runner capacity), then record_response or record_failure, then a discovery row the publisher (fork_publish.py); an uncertain operation is discovered again by the branch observation, and an operation the store holds as applying (its push response was lost) first takes record_response. A publish-only retry Result that read the push of an earlier attempt back on the branch (it carries no operation of its own) confirms the open operation of that attempt when it is folded, by the same discovery rule. When the final check does not pass, no intent is recorded and the outcome carries no operation.
ci_rerun the flaky path: record_intent, then fold_receipt once the new attempts are read back, or fold_failure_receipt for a definite refusal, by the publication job (ci_rerun.publish), in the outcome it delivers; the interrupted path (development.waiting_ci, executed by the development PR workflow, and handoff.waiting_ci, executed by the ci-rerun job of the handoff workflow): record_intent by the observation, fold_receipt by the reconciler once its own readback confirms the receipt, fold_failure_receipt for a stale or refused receipt and by the controller for spent launches or an operation that no longer matches the record. See CI reruns. publication job, observation, controller, reconciler
fork_provision, dev_pr_create, dev_pr_update record_intent by the controller; begin_effect, record_response, and confirm_by_discovery when the verified receipt of the trusted workflow is folded with the exact readback (fold_receipt): the receipt states that the workflow’s final check (the operation planned and current, the contribution not paused) passed and the call returned. A verified provisioning receipt whose status is not provisioned reports a definite failure: begin_effect and record_failure (fold_failure_receipt) controller, reconciler
upstream_branch, submission_comment record_intent by the controller for each attempt; fold_receipt for a verified receipt with its readback, fold_failure_receipt for a receipt that reports a failed attempt. See The handoff operations. controller, reconciler
every kind resolve_confirmed, resolve_failed, resolve_not_launched /upstreaming resolve-operation

A planned operation that a trusted workflow runs stays planned across its launches: each launch is counted on the operation in external_ids.launch_attempts, the counter of operation_launch, and a launch is repeated only after LAUNCH_INTERVAL_SECONDS (300) without a receipt. For a record in provisioning.idle the launch is the lifecycle row start_operation: the controller records the intent and takes the row in the same tick, the row charges operation_launch, and the controller counts the launch on the operation. Once the budget is exhausted (retries.infrastructure_per_head_failure plus one launches) and the last launch is older than the interval, the controller takes require_provisioning_intervention to provisioning.waiting_human with the pending action provisioning_launch_exhausted and the counter operation_launch; nothing is launched while the contribution is paused. A resume that starts operation_launch again sets the launches of the planned operation back to zero. The launches of a development PR operation and of a ci_rerun operation are counted the same way, within the same limit, without a row of the table.

resume_provisioning requires that the prerequisite is corrected. The controller establishes that fact for /upstreaming resume in provisioning.waiting_human when the pending action is one it wrote: provisioning_launch_exhausted with the counter operation_launch, or provisioning_operation_failed. The human’s resume is the statement that the cause is corrected. After exhausted launches the planned operation is still open: the resume bumps the revision, starts its launches again from zero, and the same operation is launched again from provisioning.idle. The provisioning workflow accepts an operation of an earlier revision when the record names it as its active operation. After a failed operation the record names no operation: the resume returns to provisioning.idle, where a new operation is planned at the new revision, with a new id. A provisioning receipt that arrives while the record waits closes the operation and keeps the wait, so the resume also plans a new operation then.

An operation id is derived from the contribution, the revision, the kind, and the reason ids (recovery.operation_id), so the same intent yields the same id. An id is never used again once its operation closed: a ci_rerun operation of interrupted CI names the count of interrupted_reruns before its charge, and one of the publication job names the evidence, the Work, and the publish attempt; a publish-only retry of the same Result adds publish-attempt:<attempt> to the reason ids from the second attempt on (the attempt the retry was dispatched with), and a CI bootstrap dev_pr_update planned again after a failed or never-launched one adds replan:<n>, the number of earlier ones for the same head. The first attempt and the first plan keep the id they always had.

An operation that closes fires the lifecycle row bound to it in recovery.FIRES, by the state of the contribution and the end state of the operation, through engine.apply_transition (trigger operation): a confirmed fork_provision operation in provisioning.idle takes confirm_provisioning to development.fix_needed with the fork, without a revision bump; a failed one takes require_provisioning_intervention with the pending action provisioning_operation_failed and no counter. The handoff operations fire their confirm, retry, and exhaustion rows, and return_for_repair for an invalid build and for a package attempt that finds riscv64 moved. When several rows are bound, the one whose guards hold is taken: the caller supplies the count of the budget for a failed handoff attempt, and none for an invalid build or a moved branch, so exactly one applies. active_operation_id names an open operation only: the record’s reference is released in the same write when the operation closes, also when no row is bound (a receipt that arrives in a human wait closes the operation and keeps the state).

/upstreaming resolve-operation operation=<id> disposition=confirmed|failed|not-launched evidence=<id> is accepted from an authorized command actor (checked at intake) and takes the one resolve_* row whose guards hold; the evidence is a record of kind resolution in the state store. A resolution fires the bound lifecycle row only when it establishes the row’s guards: a failed provisioning operation takes require_provisioning_intervention with the pending action provisioning_operation_failed and no counter; confirm_provisioning needs the receipt and the readback, so a provisioning operation resolved confirmed only closes the operation.

An open operation (planned, applying, or uncertain) fences its contribution exactly as the guards of the table say: park, refresh, the stale resume, restart_generation, and the resumes guarded by quiescence are refused with the open operation named, planning Work is not dispatched, and the publisher’s final check refuses a fork write while the record names an active operation.

The state publisher’s final check refuses a commit that changes an operation’s status along no sequence of rows (a closed operation never changes status). Before that, reconcile.tick checks every operation the tick stages against the committed one with the same check (recovery.transition_problem). A staged operation that fails it is an unexpected error of its contribution in the step operation_check: the tick is computed again without the contribution, which takes pause_on_processing_error, and the commit goes ahead for the others. The check admits the transitions of the table only. A test scans the source: no module other than recovery.py writes an operation’s status.

Checks

tests/test_engine.py derives its cases from the table: every row is taken through the engine with its guards established and its effects verified, every row is refused when one of its facts is missing, every command row that requires the exact revision refuses another one, and the mask of the paused flag is verified for every row. tests/test_live_handoff_migration.py runs the migration and the ordinary controller on a copy of a committed record in the old approval wait. tests/test_terminal_migration.py runs the terminal migration on fixtures of each old terminal shape, and tests/test_provisioning_migration.py the provisioning migration on fixtures of each old provisioning shape. tests/test_plan_admission.py folds every plan decision (develop, park, close, and the invalid ones) with and without an admission override and with and without a refresh, folds a close that PyPI confirms, does not confirm, or cannot be read for, and follows an override from parked.idle to the provisioned fork. tests/test_command_grammar.py verifies that the grammar is the table’s commands plus the intake commands, that every retired command names its replacement, and that each table command applies in exactly the states whose rows take it. tests/test_operations.py takes every row of the operation table with its effects and refuses it without each guard, scans the source for status writes outside recovery.py, verifies the state publisher’s status check, and runs the provisioning launches, their exhaustion, the receipt, a failure receipt, the resume and the park from every provisioning wait, the fence of an open operation, resolve-operation, and a new id for a re-planned operation. tests/test_handoff.py runs the live record from submit-upstream through the submission rewrite and review, the expiry of the rewrite, the build of riscv64, CI on the clean head, and the package to the verified upstream PR with the development PR left open, each retry, exhaustion, and resume, the return for repair, the locked wait and its three exits, the reminders, the discovery filters, the package bounds and encoding, the idempotent comment, the checks before any write, and the build of riscv64 against a local fork. tests/test_submission_review.py checks the rewrite Result (pass, fail, a changed tree, an intermediate commit that adds and reverts content, a foreign attribution trailer, a broken rule, a missing template section, an unusable Result) and the review Result (pass, fail, an unmet expectation, another series or text). tests/test_fork_publish.py commits a failed publish attempt and its retry through the state publisher’s check. tests/test_processing_errors.py injects an exception into each step of a tick for one of two contributions and verifies each case of Errors while a tick runs; tests/test_late_results.py injects one into every step for a record in every admitted state.