Repair agent workflow completion and incident recovery

Merged
DS
2mo ago
+2570-262

This pull request was posted by Codex Desktop using gpt-6-luna on behalf of David.

Why we make these changes

Incomplete candidate decisions and transient or misclassified run failures can leave automated workflows stalled or obscure what actually failed. This change makes completion and recovery decisions depend on the recorded candidates and trusted execution evidence (issue #10428).

New public surface

Optional recovery_issue input on 12 workflow_dispatch workflows for default-branch workflow incident recovery admission.

User-visible behavior

  • Attention completion retries only missing candidate IDs; shared status-completeness checks report missing candidate snapshots or sink configuration explicitly.
  • Shared positive-integer parsing keeps rejecting oversized values that cannot be converted safely.
  • Z.ai quota parsing accepts an explicit null reset only for a zero-consumption quota window; a missing reset field or a null reset on a consumed window remains invalid, and exhausted weekly quota remains blocking.
  • Attention triage filters mutating tools so a Write cannot alter its candidate snapshot; ordinary workflows retain writes, and plan mode and allowlists remain supported.
  • At request-limit exhaustion, partial or invalid Attention output cannot report success; complete Attention output and ordinary-workflow output preserve success.
  • Monitoring selects the trusted triggering run attempt before resolving downloaded agent artifacts; same-attempt ambiguity and workflow, task, or event identity mismatches remain rejected. It classifies wrapped request timeouts, paginates trusted jobs for the exact run attempt, and recognizes restored post-agent record_attention_decision allowlists as validation while pre-agent preparation remains setup. It recognizes Execute Pydantic AI CLI and the trusted pre-activation Setup Scripts job/step as setup, with unrelated-job evidence left unclassified. Hash-prefixed artifacts are discovered directly. The unreachable queue-classifier branch is removed while existing manual queue markers retain parsing and guidance. Absent or ambiguous evidence does not invent a failure stage. Trusted setup, inference, validation, and publication incidents point to host-stage logs; provider and request-limit incidents retain their own guidance.
  • Local transient 529s and request timeouts stay local to the failed attempt; they do not block later tasks or replay the whole task. Failures with no runner, no steps, and no REST annotation remain unclassified and do not create incidents.
  • A selected recovery_issue permits healthy default-branch dispatch past one matching workflow-wide incident; matching task incidents remain gated. Rejected recovery requests return safe diagnostics. Fresh task/head work follows normal task scope and does not close an older task incident. The UI path uses a fresh eligible PR event and existing Environment approval. Manual closure requires verified agent and host execution.
  • Review uses balanced delegates; verified blocking findings yield REQUEST_CHANGES, while incomplete coverage without blocking findings yields COMMENT. The Regression Detector stops after one candidate and follows its publish rule.
  • Refresh the mutable clai2-bleeding tag before restoring version tags.

Verification

On PR head 41af9c358e7b4272615d221e0891ee67f244a939, the targeted controller, workflow guard, runner shim, tag-fetch, review-context, and PostgreSQL pilot tests passed locally; the workflow guard, scoped Pyright, and normal merge hooks passed. The CI run passed, including coverage at 100.00%; the aggregate and quality jobs passed, as did all 11 native PostgreSQL startup and teardown checks. CodeQL passed its JavaScript, Python, and Actions analyses. The required CI Review run succeeded without reviewing: it ran from default-branch commit b86a877bcffd9aaa4b51e7f2e131eff65e23bc3a and produced an exact-head artifact for this commit, but the eligibility gate found that #10501 already had CHANGES_REQUESTED. The exact-head provider-health check was not ready because #10583 had unknown quota (missing_windows, HTTP 200), so agent and safe_outputs were skipped with zero steps and no runner. No model review or publication occurred. A fresh local review of the full 41-file range 1edeed76af08df1d3e9256be96e9e4a333b91515...41af9c358e7b4272615d221e0891ee67f244a939 found no actionable findings, and no unresolved PR threads remain. Actual hosted review and production canaries remain pending.

What changes for existing users

No Pydantic AI framework API or behavior changes. Compiled locks retain v0.86.2; model versions, limits, and concurrency are unchanged.

Related work

The attention completeness guard remains self-contained, preserving #10347 package-only staging. Merged #10356 owns provider-only cooldown behavior. Open #10583 tracks the latest provider-wide gate; this PR does not restore account allowance. Provider ticket #10582 closed externally at 2026-10-18 03:08:17 UTC; that closure does not establish incident recovery, which still requires deployed execution proof. Equivalent native Coder write/shell filtering is tracked separately in #10347 and is not implemented here. The ongoing recovery-evidence and status update tracks operational markers.

Relates to #10428, #10427, #10424, #10367, #10415, #10354, #10510, #10542, #10564, #10568, #10570, #10571, #10572, #9951, and #9897.

Checklist

  • No breaking changes in accordance with the version policy.
  • Any permitted compatibility impact has a label, warning, migration, release note, and exact API-check waiver.
  • PR title is fit for the release changelog.