Skip to content

chore(ci): cover the agent-task scripts, clear the description budget - #741

Merged
athvin merged 1 commit into
mainfrom
chore/s9-required-and-gate-coverage
Nov 6, 2026
Merged

athvin merged 1 commit into
mainfrom
chore/s9-required-and-gate-coverage

Conversation

@athvin

@athvin athvin commented Nov 6, 2026

Copy link
Copy Markdown
Owner

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 on main; 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.yml is workflow_dispatch only and needs CLAUDE_CODE_OAUTH_TOKEN and AGENT_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 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 instead of 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. 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.sh renders absent / empty / status-less / malformed structured output as distinct cells without failing a step that runs on always(); and agent-task-checkpoint.sh refuses an empty WIP rather than pushing to refs/heads/.

Mutation-tested — each caught, on the assertions that should catch it:

Mutation Caught
regex unanchored ([0-9]) 7 assertions
length bound dropped (^[0-9]+$) the over-length case
validation removed entirely 12 assertions
jq fallback removed the 3 malformed-output cases

2. 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.sh succeeded on all four stacks (core, dev, prod, state-backend), and classify the refresh consumed 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.sh and install-kind-tools.sh both success. 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.

Skill Before After Headroom
land-pr 979 891 +133
project-board 1012 913 +111
skill-audit 1017 956 +68
security 1004 957 +67

Only redundancy and prose were cut — never a routing clause or a Use when trigger. The check that the triggers survived is that CLAUDE.md's generated routing table is byte-identical after regen; only the docs/agent-skills.md inventory and budget blocks move.

The remaining item, for the record

workflow pins (S9) is still not a required check. It now carries six gates: the uses: pin check, detect-paths-test, pass-gate-test, the new agent-task-test, scripts-home-check and workflow-shell-check. None can block a merge — on #740 the PR read mergeStateStatus: CLEAN with all 13 required contexts green while pass-gate-test was 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 no if:, and rust.yml carries no paths: filter, so it reports on every pull_request and every merge_group — it cannot become a required check that never reports.

🤖 Generated with Claude Code

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]>
@athvin
athvin merged commit efad03e into main Nov 6, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants