Repository navigation
ci: guard tracked agent guidance against model names - #81
Conversation
Add scripts/check-guidance-names.sh, the rung-2 guard for the class #76 cleaned up: tracked agent guidance naming specific models or vendors instead of roles. The scanned set, pattern list, and entrypoint-name allowlist live at the top of the script. Allowlisted tokens are stripped from a hit line and the remainder is re-tested, so entrypoint files stay in the scan. The guard fails closed when a scanned entry matches no tracked file or git grep errors. pr-gate runs it first, before the toolchain and web installs. CONTRIBUTING.md lists it in the local sequence and names its rung; docs/development.md maps scripts/. Refs #78 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Match names joined to version digits or underscores (the prefilter no longer uses -w; awk applies the boundary rule), scan files git treats as binary, cover nested AGENTS.md and CLAUDE.md, and stop reading an awk failure as a residual hit. Refs #78 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep literal AGENTS.md and CLAUDE.md beside their glob entries so removing a root entrypoint still fails closed, and strip allowlisted tokens with the same boundary the name check uses. Refs #78 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 81bc8b7a68
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Fail closed when a scanned tracked file is missing from the working tree, and strip an allowlisted entrypoint name only when nothing word-like follows it, so a suffixed name such as a backup copy no longer hides a forbidden word. Refs #78 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Refuse tracked symlinks and other non-regular entries in the scanned set, paths whose working-tree copy is no longer a regular file, and any git grep stderr output, since git grep can skip such files while still exiting 0 or 1. Refs #78 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0f067487ff
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Strip an allowlisted entrypoint name only at line start or after whitespace, a path separator, or opening punctuation, so a prefixed variant such as MY_ or my- no longer hides a forbidden word. Refs #78 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 83e1b0ccfc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Add a git grep --cached pass so content staged for commit is checked even when the working tree differs, mark index hits as staged, and state the scan contract in the script header: working tree and index locally, the checked-out commit in CI. Refs #78 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 46d301b5bf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Strip an allowlisted entrypoint name only when end of line, whitespace, closing punctuation, or sentence-ending dots or dash follow it, so a backup or path suffix after the name no longer hides a forbidden word. Refs #78 Co-Authored-By: Claude Opus 5.5 <[email protected]>
A CRLF working tree left a carriage return after an end-of-line entrypoint name, which the right-side delimiter list rejects; drop one trailing CR before stripping and testing. Refs #78 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Primary Issue
Closes #78
Problem And Outcome
Model and vendor names in tracked agent guidance keep coming back. #71 introduced them, and #76 (merged in #79) removed them at the guidance rung only. After this PR,
pr-gatefails within seconds when tracked guidance names a model, a model family, or a vendor product. Contributors can run the same check locally with one command.Changes
scripts/check-guidance-names.sh: a POSIXshscript usinggitandawk, with no dependency on the systemgrep. Three lists sit at the top, each with instructions for extending it:How it decides:
git grepfinds candidate lines in the tracked files.awkstrips allowlisted file-name tokens, then re-tests the rest of the line. A name counts as a match when there is no letter or digit before it and no letter after it, so IDs joined to version digits or_are caught.Fail-closed behavior (exit 2):
AGENTS.mdandCLAUDE.md, matches no tracked file;git grepwrites anything to stderr or errors;awkerrors.A residual hit prints
path:line: textand exits 1..github/workflows/pr-gate.yml: aGuidance namesstep runs right after checkout, before the toolchain and web installs.CONTRIBUTING.md: the guard is the first command in the local sequence, and a paragraph names it as the rung-2 guard for this class.docs/development.md: a map line forscripts/.Correction-ladder rung: 2 (a repository guard the gates run). There is no ADR, because this enforces an existing rule and adds no product behavior.
Scope
AGENTS.md/CLAUDE.mdat any depth.(staged); in CI, the checked-out commit. Untracked files, stash entries, and other refs are not scanned.Verification
ada0485, onmainat6c4c477. Gates ran on81bc8b7,0f06748,83e1b0c,46d301b, andada0485, after each round of automated-review fixes.ada0485, and every step exited 0: the guard,npm ci/check/build,cargo fmt --check,clippy -D warnings,cargo test --workspace(28 result lines, all ok),cargo build -p consolebook-server, andnpm run e2ewith system Chrome 155 rather than the Playwright download (56 passed).git diff --check origin/main..HEADwas clean.30d6af6onada0485), never pushed, reintroduces one vendor name in prose atCLAUDE.md:6. The guard exits 1 and printsCLAUDE.md:6: …._; a name inside a file git treats as binary; a name in a nestedweb/AGENTS.md. A line holding only an entrypoint file name passes. A missing scanned entry, a removed root entrypoint, andgit greporawkerrors all exit 2.bash --posix.8317340throughworkflow_dispatch; itsGuidance namesstep printedok (11 files scanned). This PR'spr-gatepassed on81bc8b7,0f06748,83e1b0c, and46d301b, and runs again onada0485.Review And Merge Notes
_;-Iskipping files git treats as binary; nested entrypoints; anawkstatus ambiguity.81bc8b7raised two P2s: a scanned file deleted but not staged still passed, and suffixed allowlist tokens hid names. Both are fixed in896e3fc.0f06748. It also found left-side allowlist variants such asold_CLAUDE.md; these were first declined as out of class. Automated review on0f06748raised them as a P2, and the decline was reversed because the case mirrors the right-side fix. A leading-boundary rule is in83e1b0c, and independent delta review found nothing.83e1b0cfound that staged-only content was not scanned locally. This could not reachmain. The index pass and the scan contract are in46d301b, and independent delta review found nothing.46d301bfound that right-side suffixes such as@,~,+, and/still stripped. In622f8cathe right side became an explicit delimiter list, mirroring the left. Independent delta review then caught a CRLF regression, whichada0485fixes.0f06748found nothing blocking. Accepted as is: a localGIT_TRACEor an invalid global git config fails the guard, with the reason printed.🤖 Generated with Claude Code