Disable gh-aw's daily AI-credits guardrail with `max-daily-ai-credits: -1` on the Z.AI agentic workflows
This pull request was posted by Claude Code using claude-opus-5-5 on behalf of David.
Why we make these changes
Our gh-aw workflows keep exhausting the repo's GITHUB_TOKEN rate limit ("API rate limit exceeded for installation"). When that happens, CodeQL, Package Label, Protect .github and PR Bots go red. The largest single consumer is gh-aw's daily AI-credits guardrail in each workflow's activation job. To total the last 24h of AI credits, it lists every run's artifacts and downloads each usage artifact. In CI Review run 39522281523 that took about 700 REST calls: 6 run-list pages, 586 artifact listings and 108 downloads. CI Review activates about 126 times a day, so that is roughly 76–90k calls/day (estimate).
The guardrail can't trigger for us. All 108 runs it inspected computed aic: 0 ("not exceeded (0/5000)"). AI credits are gh-aw's pricing unit, not the Z.AI Coding Plan quota, which shared/provider-health.md already gates. The pydantic-ai gh-aw engine in development does report non-zero AI credits. After that migration the guardrail would start blocking CI Review on busy days (estimate), instead of just sitting there unused.
max-daily-ai-credits: -1 is now set in all 13 pydantic-ai-*.md sources, and the locks are recompiled with the same gh-aw v0.86.2. The field goes in each source, not in shared/engine-zai.md. In v0.86.2, only a -1 in the workflow's own frontmatter removes the guardrail (hasWorkflowExplicitMaxDailyAICDisable). An imported -1 only skips the scan at run time, and the conclusion job's cache steps still run whenever the conclusion job runs. stale-issues-finder doesn't import engine-zai.md anyway.
Each lock loses these pieces:
- the activation cache-restore, artifact-fallback and guardrail steps, and their outputs;
- the
daily_ai_credits_exceededterm in the agent and conclusionif:; - the conclusion job's AIC cache restore/write/save/upload steps.
The conclusion jobs of attention-triage, community-demand and feature-digest drop from actions: write to actions: read. gh-aw grants write only to jobs that save a cache.
A new daily-aic-guardrail check in .github/scripts/agentic_workflow_guard.py rejects any lock that still compiles the guardrail step, so a new workflow can't bring it back. The rationale lives once, in that check's row in .github/workflows/AGENTS.md, and each source comment points there.
New public surface
None.
Verification
- gh-aw v0.86.2 recompiles the unmodified sources byte-identical. After the change, no lock contains
daily-effective-workflow-guardrail,GH_AW_MAX_DAILY_AI_CREDITSordaily_ai_credits. uv run python .github/scripts/agentic_workflow_guard.py check --base-ref upstream/mainpasses. The new check flags the pre-changepydantic-ai-pr-review.lock.ymland a lock compiled with-1only inshared/engine-zai.md.test_daily_aic_guardrail_*in.github/scripts/test_agentic_workflow_guard.pypass.
This PR can't exercise its own change. CI Review runs on workflow_run from the default branch. After merge, take the first CI Review run that activates and list its activation steps:
gh run list -R pydantic/pydantic-ai --workflow pydantic-ai-pr-review.lock.yml --limit 10
gh api repos/pydantic/pydantic-ai/actions/runs/<run-id>/jobs --jq '.jobs[] | select(.name=="activation") | .steps[].name'
The list should contain neither "Check daily workflow token guardrail" nor "Restore daily AIC usage cache".
What changes for existing users
Nothing; this only touches the repo's own workflows.
PR decisions
2026-10-21 · pre-push review 1 of 3 at 099e343ab1634245970fee0b8bafa344f491840a · iter -
- Decision: reserved; dispatching
- Why: tree fb73ecb86e93a95717d5cd2776c7c89911f0bb5e; scope aca285c48153f645c3e469e1b37962d7557a81cb..099e343ab1634245970fee0b8bafa344f491840a (full branch, first review)
- Source: https://github.com/pydantic/pydantic-ai/tree/disable-gh-aw-daily-aic-guardrail
2026-10-21 · pre-push review 1 of 3 at 4cdcc6ebe6c7e9c7dfc0553779762d132fe6d497 · iter -
- Decision: remediated: rationale moved to a daily-aic-guardrail row in .github/workflows/AGENTS.md, one-line source pointers, new lock-level guard check + tests; stale-issues-finder max-ai-credits comment/lock mismatch skipped as pre-existing
- Why: reviewed tree d783774756c78782c08f194c2f8ac6e71fab114a; scope 3d56e35c0..4cdcc6ebe (full branch; reservation was logged at 099e343ab before a conflict-free upstream merge)
- Source: https://github.com/pydantic/pydantic-ai/tree/disable-gh-aw-daily-aic-guardrail
2026-10-21 · max-daily-ai-credits set per source, not in shared/engine-zai.md · iter -
- Decision: Set max-daily-ai-credits: -1 in each pydantic-ai-*.md frontmatter and enforce it with a lock-level guard check
- Why: gh-aw v0.86.2 hasWorkflowExplicitMaxDailyAICDisable reads only RawFrontmatter; an imported -1 compiled with the guardrail steps still present
- Source: https://github.com/github/gh-aw/blob/v0.86.2/pkg/workflow/daily_aic_workflow.go
2026-10-21 · pre-push review 2 of 3 at e295843b2b6e9065cbe4e6dce19052dfd56cb8ba · iter -
- Decision: reserved; dispatching
- Why: tree 372df16a6fd366f0383daf6c0120f77f4f7b7349; follow-up scope 4cdcc6ebe..e295843b2b6e9065cbe4e6dce19052dfd56cb8ba, verifying review 1 finding
- Source: https://github.com/pydantic/pydantic-ai/tree/disable-gh-aw-daily-aic-guardrail
2026-10-21 · pre-push review 2 of 3 at e295843b2b6e9065cbe4e6dce19052dfd56cb8ba · iter -
- Decision: remediated: guard message, docstring and AGENTS.md row now say an imported -1 skips the scan but keeps the conclusion-job cache steps running
- Why: reviewed tree 372df16a6fd366f0383daf6c0120f77f4f7b7349; scope 4cdcc6ebe..e295843b2; review 1 finding verified fixed
- Source: https://github.com/pydantic/pydantic-ai/tree/disable-gh-aw-daily-aic-guardrail
2026-10-21 · pre-push review 3 of 3 at 60c88ef0dd7bd0367571e39257e474939535ae6d · iter -
- Decision: reserved; dispatching
- Why: tree fc8a77010661df1fe454e390fd4b865efb832b87; follow-up scope e295843b2..60c88ef0dd7bd0367571e39257e474939535ae6d, verifying review 2 finding
- Source: https://github.com/pydantic/pydantic-ai/tree/disable-gh-aw-daily-aic-guardrail
2026-10-21 · pre-push review 3 of 3 at 60c88ef0dd7bd0367571e39257e474939535ae6d · iter -
- Decision: remediated after budget: 'on every run' -> 'whenever the conclusion job runs' in guard message and AGENTS.md row; review 2 finding verified fixed; no fourth review
- Why: reviewed tree fc8a77010661df1fe454e390fd4b865efb832b87; scope e295843b2..60c88ef0d; locally checked remediation commit 0c5f7074b69e75652b58f15d6afaf2fa97e28dfa (guard check, guard tests, pyright, ruff pass)
- Source: https://github.com/pydantic/pydantic-ai/tree/disable-gh-aw-daily-aic-guardrail
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.