Repository navigation
chore(ci): cover the agent-task scripts, clear the description budget - #741
Merged
Merged
Conversation
Two of the three open items from #740. The third — promoting `workflow pins (S9)` to a required check — is branch-protection configuration rather than a file in this tree, and is applied separately. COVERAGE FOR THE AGENT-TASK SCRIPTS (`scripts/ci/agent-task-test.sh`, 25 assertions, in the ungated S9 job). `agent-task.yml` is `workflow_dispatch` only and needs `CLAUDE_CODE_OAUTH_TOKEN` and `AGENT_APP_KEY`, neither of which this repo has — so dispatching it to exercise the extraction would die at the agent step having proved nothing about the three scripts that run before and around it, and would leave an `agent-wip/<run-id>` branch on the remote for the trouble. All three are pure logic over environment variables, so a test covers them completely and covers them on every PR rather than once. The load-bearing half is input validation. `resume` is a dispatch input that reaches `refs/heads/agent-wip/$RESUME` and the agent's prompt, so it is attacker-shaped text until proven numeric: the suite rejects command substitution, backticks, path traversal, leading and trailing whitespace, negatives, decimals and over-length digits, and accepts the documented 20-digit bound so the rule cannot degrade to "reject everything long". It also pins that `agent-task-summary.sh` renders absent, empty, status-less and malformed structured output as three distinct cells without failing a step that runs on `always()`, and that `agent-task-checkpoint.sh` refuses an empty WIP rather than pushing to `refs/heads/`. Mutation-tested: unanchoring the regex, dropping the length bound, removing the validation entirely, and removing the jq fallback are each caught, on the assertions that should catch them. The other two extractions #740 left unexercised are now verified by real runs instead, both dispatched against `main`: - `drift.yml` (read-only by construction — the role holds no S3 write): `tf-drift-plan.sh` succeeded on all four stacks, and `classify the refresh` consumed its output, so the script really did write both the redacted text and the JSON. - `kind.yml`: `reclaim-disk.sh` and `install-kind-tools.sh` both succeeded. The probe job itself is a ~2h executor e2e that fails for reasons predating this work; the two steps this change owns are early and are proven. DESCRIPTION BUDGET. All four skills in the warning band are trimmed under it, so the generated budget table now reads "none; every skill can take another clause" — which was the point of the warning: headroom to absorb a routing tail without an unrelated PR discovering the cap as a failed gate. Only redundancy and prose were cut, never a routing clause or a `Use when` trigger — CLAUDE.md's generated routing table is byte-identical after regen, which is the check that the triggers survived. Headroom now: land-pr 891 (+133), project-board 913 (+111), skill-audit 956 (+68), security 957 (+67). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes two of the three open items from #740. The third — promoting
workflow pins (S9)to a required check — is branch-protection configuration rather than a file in this tree, so it is applied separately once this is green onmain; see the bottom of this description.1. Coverage for the agent-task scripts
scripts/ci/agent-task-test.sh, 25 assertions, in the ungated S9 job.A test rather than a real run, and that is the finding, not a shortcut.
agent-task.ymlisworkflow_dispatchonly and needsCLAUDE_CODE_OAUTH_TOKENandAGENT_APP_KEY— this repo has no secrets. Dispatching it would die at the agent step having proved nothing about the three scripts around it, and would leave anagent-wip/<run-id>branch on the remote for the trouble. All three are pure logic over environment variables, so a test covers them completely, and covers them on every PR instead of once.The load-bearing half is input validation.
resumeis a dispatch input that reachesrefs/heads/agent-wip/$RESUMEand the agent's prompt, so it is attacker-shaped text until proven numeric. Rejected: command substitution$(whoami), backticks,../../refs/heads/main,1/../../evil, leading/trailing whitespace,-1,1.0, over-length digits. Accepted: the documented 20-digit bound — otherwise the rule degrades to "reject everything long".Also pinned:
agent-task-summary.shrenders absent / empty / status-less / malformed structured output as distinct cells without failing a step that runs onalways(); andagent-task-checkpoint.shrefuses an emptyWIPrather than pushing torefs/heads/.Mutation-tested — each caught, on the assertions that should catch it:
[0-9])^[0-9]+$)jqfallback removed2. The other two extractions, verified by real runs
Both dispatched against
main, which already carries #740:drift.yml(run) — read-only by construction; the role holds no S3 write and nothing applies.tf-drift-plan.shsucceeded on all four stacks (core, dev, prod, state-backend), andclassify the refreshconsumed its output — so the script really did write both the redacted text and the JSON, which a step conclusion alone would not prove.kind.yml(run) —reclaim-disk.shandinstall-kind-tools.shbothsuccess. The probe job itself is a ~2h executor e2e that fails for reasons predating this work; the two steps this change owns are early and are proven.So of #740's three unexercised extractions: two are now verified against real infrastructure, and the third is covered by a mutation-tested suite on every PR.
3. Description budget cleared
All four skills in the warning band trimmed under it. The generated budget table now reads "none; every skill can take another clause" — which was the warning's whole purpose: headroom to absorb a routing tail without an unrelated PR discovering the cap as a failed gate.
land-prproject-boardskill-auditsecurityOnly redundancy and prose were cut — never a routing clause or a
Use whentrigger. The check that the triggers survived is that CLAUDE.md's generated routing table is byte-identical afterregen; only thedocs/agent-skills.mdinventory and budget blocks move.The remaining item, for the record
workflow pins (S9)is still not a required check. It now carries six gates: theuses:pin check,detect-paths-test,pass-gate-test, the newagent-task-test,scripts-home-checkandworkflow-shell-check. None can block a merge — on #740 the PR readmergeStateStatus: CLEANwith all 13 required contexts green whilepass-gate-testwas failing in S9. Three of the six guard the gating machinery itself (which jobs run, whether a pass marker may be trusted), so a regression there is invisible by construction.It is safe to promote: the job has no
needs:and noif:, andrust.ymlcarries nopaths:filter, so it reports on everypull_requestand everymerge_group— it cannot become a required check that never reports.🤖 Generated with Claude Code