Fix the gh-aw recovery dispatch, `noop` limit, CI Review deadline and open-issue prefetches, and retire stale task incidents
Merged
DS
1mo ago+929+929+012345678901234567890123456789-422-422-012345678901234567890123456789
This pull request was posted by Claude Code using claude-opus-5-5 on behalf of David.
Fixes the gh-aw infrastructure bugs behind this month's operational-alert issues. Addresses #12139, #11096, #11820 and the task incidents named in item 2 without closing them; #12139, #11096 and #11820 close by hand once a recovery run shows the model executed.
New public surface: none. Every change is under .github/.
Workflow behavior, before and after
- Recovery dispatch 404.
GitHubClient.sendbuiltrepos/<repo>/for an empty path, sodefault_branch()failed everyworkflow_dispatchwithrecovery_issuein the gate (runs 41710465686, 41710470745, 41710476148). nooplimit (E002). gh-aw allows onenoopper run; a second call spent the single tool retry and the next ended the run. This is the crash behind the task incidents #12438, #12448, #12454, #12457 and #12477._RecoverMCPToolErrorsnow answers a safe output past its limit with a result, and CI Review's model is no longer offerednoop(its stale-PR skip step writes the only one); its prompt now says so.- CI Review deadline. Inside the 5-minute reserve, CI Review is offered only
submit_pull_request_reviewandcreate_pull_request_review_comment, and eachBashcommand stops when the reserve starts. A call to a withheld tool is answered, not charged as an unknown tool. - Checkout of a moved PR.
Skip a PR that closed or moved on while queuednow runs beforeCheck out the PR head, which skips a PR the step skipped. - Duplicate
[aw] Failed jobsissues. Every Z.AI source setssafe-outputs.report-failed-jobs: false,provider-health-reportingenforces it, and the 14 locks are recompiled with gh-aw v0.86.2. That step filed all 24[aw] Failed jobsissues of 2026-11-04, 19 of them during a Z.AI1302rate-limit burst; the provider-health controller already tracks these failures. The compiler also dropsactions: read, andissues: writewhere nothing else used it, from the conclusion jobs. - Context prefetch cap.
prefetch-github-context.shdropped the open-issue list once it reached 1000; the repository has over 1,200 open issues. The cap is now 10,000, and a list that reaches it is still rejected. - Stale Issues Finder corpus.
prefetch-open-issues.shlisted issues with--search "sort:updated-asc", and GitHub search returns at most 1,000 results whatever--limitasks for, so the finder saw 1,000 of 1,237 open issues. It now lists without search, sorts byupdatedAtlocally, and fails the step when the list reaches its cap of 10,000. - Summariser fallback (#11820). Both fallbacks of
_compact_historykeep the run's first request ahead of the tail, which otherwise starts with an assistant message that Z.AI rejects (HTTP 400, code1214). - Retired task incidents. The hourly provider-health run closes a task incident whose PR is merged or closed, or whose head moved off the SHA in its key, and comments the PR state it read. A failed read or write leaves that incident open without stopping provider recovery. The monitor job gains
pull-requests: read. - Shim telemetry. The summariser runs as
history-summariserinside acompact historyspan whosegh_aw.compaction.outcomeisdone,failed,timed_outordiscarded. The root agent-run span recordsgh_aw.total_usage.*, which includes delegates, resumes and the summariser.service.versionis a digest of the shim's sources, which names the code that ran even when CI Review runs the shim from a PR head.
Verification
- Item 1:
test_default_branch_requests_the_repository_url_without_a_trailing_slash. - Items 2, 3:
test_safe_output_past_its_limit_does_not_spend_the_tool_retry,test_ci_review_withholds_noop_and_non_publishing_outputs_in_the_reserve,test_ci_review_bash_stops_when_the_time_reserve_starts. - Item 4:
test_compiled_stale_pr_skip_precedes_the_pr_head_checkout. Item 5:test_provider_health_readiness_must_be_required_in_every_or_branch(removingreport-failed-jobs: falseis aprovider-health-reportingviolation). - Items 6, 7:
test_prefetch_github_context_rejects_only_a_capped_corpus,test_prefetch_open_issues_keeps_every_open_issue_oldest_update_first,test_prefetch_open_issues_fails_on_a_capped_list(the last two fail on the old script). - Item 8:
test_compact_history_fallback_keeps_the_first_request_ahead_of_the_tail. Item 9:test_scheduled_recovery_retires_task_incidents_whose_pr_closed_or_moved,test_a_failed_retirement_write_is_retried_without_stopping_recovery. - Item 10:
test_compact_history_records_the_summariser_outcome,test_root_run_span_records_the_whole_runs_usage,test_observability_names_the_running_shim_sources. - Live:
gh issue list --search "sort:updated-asc" --limit 10000returns 1,000 of 1,237 open issues; the new script captured 1,233 of 1,233, matching REST. CI Review run 41935101823 shows the committed prompt is the live one.
What changes for existing users: nothing; these workflows are repository infrastructure.
Carried over by #10347
SAFE_OUTPUT_TOOL_PREFIX: safe-output tools are matched only through_safe_output_type, so #10347's prefix tuple changes that one function._CIReviewToolPolicymust joinbuild_agent()'s capabilities, with itsBashname changed to theCodershell tool's name._RecoverMCPToolErrors.wrap_tool_executecarries over with the class.compact_history(preserve_prompt=True)keepsmessages[0]on every path; this PR's fallback change is then redundant there._RecordRunTotals, thecompact historyspan andservice_versionmove withbuild_agent()andconfigure_observability.shared/prompts/pydantic-ai-pr-review.mdtells CI Review thatnoopis unavailable. Keep_CIReviewToolPolicywithholding it, or drop that sentence.
Telemetry baseline (Logfire, 10-15 to 11-03)
- CI Review on the current shim: 55 of 66 runs posted a review, 8 died on
E002, 3 timed out. - Every
E002was a spentnoop. 40 of the 45 runs that callednoopfirst did so inside the final window. - 5 of the 6 runs whose
Bashcall crossed minute 23 posted no review. - The only summariser timeout in 32 runs produced the only
1214. - The summariser's span was a second
invoke_agent agent, a timeout ended itUNSET, a discarded summary left no trace, and the root span's usage counted only the root's own requests.
PR decisions
2026-11-03 · C1/C2 scoped to CI Review, not every review run · iter -
- Decision: Withholding noop, the reserve narrowing and the Bash cap apply to CI Review only; E002 recovery applies to every safe-output tool
- Why: UI Security imports shared/security-findings.md, which ends a private report with noop, and needs report_security_finding in the reserve; the defects were reproduced on CI Review
- Source: https://github.com/pydantic/pydantic-ai/issues/12250
- Session: 01664f52-0b64-4f5f-a844-70b441a8bb03
2026-11-03 · Withhold CI Review tools from the request, not the toolset · iter -
- Decision: _CIReviewToolPolicy drops withheld tools from model_request_parameters and answers calls to them, instead of a PrepareTools filter
- Why: A PrepareTools filter makes the name unknown; tool_manager charges unknown names against the single tool retry, so a second call ends the run, and rigor.md/tool-hints.md still name noop
- Source: https://github.com/pydantic/pydantic-ai/issues/12139
- Session: 01664f52-0b64-4f5f-a844-70b441a8bb03
2026-11-03 · report-failed-jobs false in all 14 Z.AI sources · iter -
- Decision: Set safe-outputs.report-failed-jobs: false in every Z.AI source, not only CI Review
- Why: The guard rule provider-health-reporting covers every Z.AI source, and every Z.AI lock compiled the Report failed jobs step
- Source: https://github.com/pydantic/pydantic-ai/issues/12249
- Session: 01664f52-0b64-4f5f-a844-70b441a8bb03
2026-11-03 · Prefetch cap raised, truncation still rejected · iter -
- Decision: corpus_limit 1000 -> 10000; a list that reaches the cap is still dropped with a warning
- Why: A silently partial corpus defeats duplicate checks, and the prompts already handle a missing corpus; 1,223 open issues fetched in about 10 s
- Source: https://github.com/pydantic/pydantic-ai/issues/12139
- Session: 01664f52-0b64-4f5f-a844-70b441a8bb03
2026-11-04 · AGENTS.md wording signed off · iter -
- Decision: David signed off the three AGENTS.md hunks as drafted: CI Review noop sentence, report-failed-jobs rule, hourly task-retire rule
- Why: Instruction text needs David's sign-off before the PR opens (relayed in local-notes/dispatch-20261104T000549Z.md)
- Source: https://github.com/pydantic/pydantic-ai/blob/main/.github/workflows/AGENTS.md
- Session: 01664f52-0b64-4f5f-a844-70b441a8bb03
2026-11-04 · Compile locks with a scratchpad gh-aw v0.86.2 · iter -
- Decision: Download gh-aw v0.86.2 darwin-arm64 into the session scratchpad, verify its digest against the release, recompile the 14 Z.AI locks with it; leave the global v0.88.2 alone; if the download is blocked again, stop and report the exact denial text, no other route
- Why: David's choice; every lock is built with v0.86.2 and compiler-version-drift rejects mixed versions (relayed in local-notes/dispatch-20261104T000549Z.md)
- Source: https://github.com/github/gh-aw/releases/tag/v0.86.2
- Session: 01664f52-0b64-4f5f-a844-70b441a8bb03
2026-11-04 · Fold prefetch-open-issues.sh into this PR · iter -
- Decision: Fold the Stale Issues Finder prefetch fix: failing check first, same fix shape as item 6, named in the PR body
- Why: Manager's call: same root cause (--limit 1000 with no truncation check), reproduces on main with 1,223 open issues (relayed in local-notes/dispatch-20261104T000549Z.md)
- Source: https://github.com/pydantic/pydantic-ai/blob/main/.github/scripts/prefetch-open-issues.sh
- Session: 01664f52-0b64-4f5f-a844-70b441a8bb03
2026-11-04 · Changed shapes for items 2, 3, 5, 6 accepted · iter -
- Decision: Manager accepted: E002 answered at the toolset wrapper; CI Review-only request-level withholding and Bash cap; report-failed-jobs in all 14 Z.AI sources; prefetch cap 10000 with truncation still rejected
- Why: Each rests on the code evidence in the stop-point report (relayed in local-notes/dispatch-20261104T000549Z.md)
- Source: https://github.com/pydantic/pydantic-ai/issues/12139
- Session: 01664f52-0b64-4f5f-a844-70b441a8bb03
2026-11-04 · Fold the Logfire telemetry gaps into this PR · iter -
- Decision: Give the summariser a distinct span name and an outcome attribute, put delegate tokens on the root span, add a resource attribute recording the shim revision; keep to what the Logfire analyst found and state it in the PR body
- Why: David's choice, so the post-deploy comparison sees the summariser and full run tokens (relayed in local-notes/dispatch-20261104T000549Z.md)
- Source: https://github.com/pydantic/pydantic-ai/issues/11820
- Session: 01664f52-0b64-4f5f-a844-70b441a8bb03
2026-11-04 · Stale Issues Finder prefetch drops --search · iter -
- Decision: List open issues without --search and sort by updatedAt with jq; drop ISSUE_LIMIT: 1000 from the source so the script default of 10000 applies
- Why: Live: gh issue list --search returns 1000 of 1237 open issues even at --limit 10000; GitHub search caps results at 1,000, so a raised cap alone would pass the length check while truncated
- Source: https://github.com/pydantic/pydantic-ai/blob/main/.github/scripts/prefetch-open-issues.sh
- Session: 168bbeda-751f-409c-9bf6-86afba878d7b
2026-11-04 · Capped open-issue list fails the step · iter -
- Decision: prefetch-open-issues.sh exits 1 with ::error:: when the list reaches the cap, instead of warning with no corpus like prefetch-github-context.sh
- Why: The corpus is the Stale Issues Finder's whole input and its prompt has no missing-corpus path; the script already fails the step on a gh error, which the monitor reads as a workflow incident
- Source: https://github.com/pydantic/pydantic-ai/blob/main/.github/workflows/shared/prompts/pydantic-ai-stale-issues-finder.md
- Session: 168bbeda-751f-409c-9bf6-86afba878d7b
2026-11-04 · agentics-maintenance.yml left out of the recompile · iter -
- Decision: Restored agentics-maintenance.yml after gh aw compile; only the 14 locks are committed
- Why: The compiler drops the description comment #11093 added by hand to every hand-written workflow
- Source: https://github.com/pydantic/pydantic-ai/pull/11093
- Session: 168bbeda-751f-409c-9bf6-86afba878d7b
2026-11-04 · pre-push review 1 of 3 at 309cd99e9fbecc2b179932a43e7c6c76594a0688 · iter -
- Decision: dispatched (reserved); outcome appended under the same anchor
- Why: tree 0d8d2f47aaa2614e07c2e2b6e9a95551029cab32; full branch f379d17dae..309cd99e9f; policy base 46a6aedf5a; first substantive review
- Source: https://github.com/pydantic/pydantic-ai/tree/fix/gh-aw-incident-causes
- Session: 168bbeda-751f-409c-9bf6-86afba878d7b
2026-11-04 · pre-push review 1 of 3 at 309cd99e9fbecc2b179932a43e7c6c76594a0688 · iter -
- Decision: 7 findings. Fixed in f70557bde: #1 a failed retirement comment or close escaped and skipped hourly provider recovery; #7 E002 marker scoped to its class. Dismissed: #2 (E002 arrives as a bare McpError chained as the ModelRetry cause), #4 (recovery and retirement rules cover disjoint cases; the edit would drop manual close of a recovered task incident), #6 (the reply names the safe-output type like the existing reminder, so the prefix rename leaves it). Pending sign-off: #3 rigor.md/tool-hints.md still advise noop to CI Review; #5 guard table row omits report-failed-jobs
- Why: reviewed tree 0d8d2f47aaa2614e07c2e2b6e9a95551029cab32; E002 evidence local-notes/triage/cluster-workflow-failures.md (JSON-RPC -32602) and mcp.py _call_tool_checked cause=e
- Source: https://github.com/pydantic/pydantic-ai/tree/fix/gh-aw-incident-causes
- Session: 168bbeda-751f-409c-9bf6-86afba878d7b
2026-11-04 · Guard table row names failed-job reporting · iter -
- Decision: provider-health-* row reads "generic failure-as-issue or failed-job reporting left enabled"
- Why: David signed off the wording as drafted; the guard now also rejects report-failed-jobs (pre-push review 1 finding 5) (relayed in local-notes/dispatch-20261104T233739Z.md)
- Source: https://github.com/pydantic/pydantic-ai/blob/main/.github/workflows/AGENTS.md
- Session: 168bbeda-751f-409c-9bf6-86afba878d7b
2026-11-04 · CI Review prompt says noop is unavailable · iter -
- Decision: Add to shared/prompts/pydantic-ai-pr-review.md exactly: "
noopis not available in this workflow; when in doubt, submit a COMMENT review." (option B); rigor.md and tool-hints.md unchanged - Why: David chose B; the committed prompt is live: run 41935101823 logged LOGFIRE_READ_EXTERNAL_VARIABLES not set, using the committed default (relayed in local-notes/dispatch-20261104T233739Z.md)
- Source: https://github.com/pydantic/pydantic-ai/actions/runs/41935101823
- Session: 168bbeda-751f-409c-9bf6-86afba878d7b
2026-11-04 · pre-push review 2 of 3 at 61ae00d244f1a5e0e5158d3860a6e6077d915ee7 · iter -
- Decision: dispatched (reserved); outcome appended under the same anchor
- Why: tree 641c3a7558f5de7d5a213f5a86969007ef1f96e8; follow-up scope 309cd99e9fbecc2b179932a43e7c6c76594a0688..61ae00d244f1a5e0e5158d3860a6e6077d915ee7 (review 1 remediation and the two signed-off instruction edits); full branch f379d17dae1569ea5722b9f1f8bf9a4aa24c5e4b..61ae00d244f1a5e0e5158d3860a6e6077d915ee7 as context; policy base 1baa00fcf2
- Source: https://github.com/pydantic/pydantic-ai/tree/fix/gh-aw-incident-causes
- Session: 168bbeda-751f-409c-9bf6-86afba878d7b
2026-11-04 · pre-push review 2 of 3 at 61ae00d244f1a5e0e5158d3860a6e6077d915ee7 · iter -
- Decision: 1 finding, fixed in 222719334e: a comment that posted before a failed close was posted again every hour; the run now skips the POST when the first comment page already holds a Retired: comment, keeping the signed-off comment-then-close order
- Why: reviewed tree 641c3a7558f5de7d5a213f5a86969007ef1f96e8; review 1 raised the same repeat, so two reviewers converged; incident reuse adds no comments (_create_or_reuse_incident), so the first page holds it
- Source: https://github.com/pydantic/pydantic-ai/tree/fix/gh-aw-incident-causes
- Session: 168bbeda-751f-409c-9bf6-86afba878d7b
2026-11-04 · pre-push review 3 of 3 at 222719334ec5bfcf116d4ef6970d0db66f02d7cb · iter -
- Decision: dispatched (reserved); outcome appended under the same anchor
- Why: tree d3c2e73ff077f2d1560c86e172ed45cfcecf19eb; follow-up scope 61ae00d244f1a5e0e5158d3860a6e6077d915ee7..222719334ec5bfcf116d4ef6970d0db66f02d7cb (review 2 remediation); policy base a5e02e2722
- Source: https://github.com/pydantic/pydantic-ai/tree/fix/gh-aw-incident-causes
- Session: 168bbeda-751f-409c-9bf6-86afba878d7b
2026-11-05 · pre-push review 3 of 3 moved to f9cc66ac8c020c0544a4e26a3f4b604ec5f75504 · iter -
- Decision: the reservation at 222719334 was not dispatched; review 3 runs on the merge of main instead
- Why: main touched .github/workflows/AGENTS.md and the UI Security source and lock; the lock conflicted and was recompiled with gh-aw v0.86.2, so the merge is not an exempt delta
- Source: https://github.com/pydantic/pydantic-ai/tree/fix/gh-aw-incident-causes
- Session: 168bbeda-751f-409c-9bf6-86afba878d7b
2026-11-05 · pre-push review 3 of 3 at f9cc66ac8c020c0544a4e26a3f4b604ec5f75504 · iter -
- Decision: 2 findings; budget exhausted, no further review. #1 AGENTS.md manual-close sentence vs the retirement paragraph (raised again after review 1): wording drafted for David's sign-off, not applied. #2 the comment check reads one page: skipped as net-neutral (needs ~99 human comments plus a POST-ok/PATCH-fail; cost is one duplicate comment); code comment corrected in 0256bad954
- Why: reviewed tree 91e3a19b861bd58fe8cc252ccb1f4365defc0ab2; the remediation is comment-only
- Source: https://github.com/pydantic/pydantic-ai/tree/fix/gh-aw-incident-causes
- Session: 168bbeda-751f-409c-9bf6-86afba878d7b
2026-11-05 · Manual-close rule scoped to task incidents the hourly run does not retire · iter -
- Decision: AGENTS.md: "For workflow incidents, and task incidents the hourly run does not retire, inspect ..." and "The run comments the pull request state it read once, then closes the incident."; the manual-dispatch sentence stays (option A)
- Why: David chose A; pre-push reviews 1 and 3 both read the unscoped manual-close sentence as contradicting the retirement paragraph (relayed in local-notes/dispatch-20261105T003455Z.md)
- Source: https://github.com/pydantic/pydantic-ai/pull/12570
- Session: 168bbeda-751f-409c-9bf6-86afba878d7b
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
- PR title is fit for the release changelog.