Skip to content

Promote Develop to Main: Fine-Grained Attention Read and Write-Guard Hook-Path Denials - #4594

Merged
ptr727 merged 6 commits into
mainfrom
develop
Dec 1, 2026
Merged

ptr727 merged 6 commits into
mainfrom
develop

Conversation

@ptr727

@ptr727 ptr727 commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Promoted pull requests

Promotion review findings

Copilot raised one finding on head ed0326f, that the lean retry could hide an unrelated null node. It was declined in its thread with the code path: the lean re-read tolerates nothing, so a null that persists still fails the read and exits 1.

Copilot raised three findings on head 9acbb87, all against #4592:

  • Stepped alphabetic brace ranges were left literal. This was real, and Expand Stepped and Signed Brace Ranges in the Write Guard #4596 fixed it (6797d691). The fix also reads a leading + sign as bash does. Copilot's own example, -{a..z..2}, was already denied, since its literal word carries an a, so the regression rows use cases that develop really allowed.
  • An empty brace word must be kept. Declined, because bash drops the empty word: printf "[%s]" {,--all} prints [--all].
  • The zero-padded self-test fixture was wrong. Declined, because the fixture creates the directory 01 and the self-test passes.

Copilot's round on head 6797d69 opened on a verdict naming no defect: that synthetic tests cannot establish live behavior. It was answered with the live evidence and acknowledged as declined.

A local frontier pass against main at head 6797d69 raised two findings against #4592, and #4597 fixed both (9a5af3f9). The decision-flow diagram lacked the brace-cap denial, and requirement 11 as well, as #4597's own review found. One self-test table was split by hand rather than through _rows.

A second local frontier pass against main at head 9a5af3f raised four findings, and #4599 fixed them (e60890ad). They were the brace cap missing from the guard's fail-closed docs, a phrase with no referent, two drifted lists of state-changing builtins, and a refused workflowRun failing the attention read.

Closes #4584
Closes #4582
Closes #4514
Closes #4583

🤖 Generated with Claude Code

Closes #4584

## What changed

`backlog_metrics.py --format json` exited 1 under a fine-grained token
whenever a private repository had an open pull request. The attention
query reads `statusCheckRollup.contexts` and `checkSuites`, and no
fine-grained permission covers Checks. GitHub answers those fields with
`FORBIDDEN` and null nodes, so the whole attention read failed.

- The full query is unchanged, byte for byte, and still runs first. A
token that can read checks gets exactly today's output.
- A `FORBIDDEN` on a head's `contexts` or `checkSuites` connection, or
on one of its nodes, is tolerated. That page and every later page of the
repository are then read with a lean query that keeps only the rollup
state. The lean query walks the same connection with the same arguments,
so the cursor carries over.
- A lean pull request whose rollup is `FAILURE` or `ERROR` is named from
its head's Actions runs (`gh run list --commit`) and the failing jobs of
each run's listed attempt (the REST jobs endpoint). Both need only
Actions read. Each workflow counts by its newest run, and conclusions
match the full read's `FAILING_CHECKS`, `action_required` included.
- A failed rollup with no failing newest Actions run is listed as
`status check rollup FAILURE` or `ERROR`. It is never dropped, since the
rollup alone cannot tell a failing check outside Actions from a
cancelled or replaced run.
- Each repository's `attention` object gains `unread`, and each entry is
also printed as a note. The run exits 0.
- A `FORBIDDEN` on any other field, a `workflowRun` inside a check node
included, or any other error still fails the read as before.
- `actions_runs` is now the single `gh run list` helper for both the
branch read and the head read.
- `scripts/README.md` documents the token the default JSON run needs,
the fallback, and `unread`.

## The testing gap that let #4392 ship this

1. The attention tests patched `bm.graphql` with success-shaped pages.
No test went through `gh_graphql.request`, the layer that turns an
`errors` array into a raise, so a permission error could not show up.
2. One test pinned the exact fields that break (`checkSuites(last: 50)`,
`contexts(...)`). It checked agreement with the review gate, not that
the fields work under the consumer's token.
3. The live check ran under the maintainer's own `gh` auth, which can
read Checks. #4392 already knew about the fine-grained consumer (that is
why it made `--billing` opt-in), but never ran that check against the
new attention fields.
4. The token requirement was written down nowhere, so no reviewer had a
requirement to check against.
5. A precedent was missed: `pr_review.py` already tolerates a
`workflowRun` `FORBIDDEN` for this same token limit.

`TokenLimitTests` closes items 1 and 2. It drives the real
`gh_graphql.request` under a fake `gh` that returns the issue's error
shape and exits 1. The new tests fail against the old script and pass
against this one. The README change closes item 4.

## Verification

- 128 tests pass, and ruff, mypy, and the prose gate are clean.
- A live run under my own auth over the registry exits 0, with every
repository's attention populated and `unread` empty.
- I hold no fine-grained token, so a real exit 0 under the consumer's
token is shown only by the synthetic fixture. It will be confirmed by
the consumer's next weekly run once this reaches `main`.

## Out of scope

The failing-branch read's active-workflow filter and 30-day bound are
#4587.

## Local review

Recorded `local-strict-review` passes ran at the `frontier` tier before
each push. The three findings the opening push listed here are fixed in
`0b1bdc3e`: the README now gives the real reason status contexts go
unread, the failed-rollup test is decided once at its call site, and a
test covers every page after a fallback reading lean. That commit's own
pass raised two more, both fixed in `18a552cf`: a docstring line over
the file's length, and run fields the lean path never read.

The pass over `18a552cf` raised two more, both fixed in `932a5a3a`: the
`unread` bullet no longer claims the run always exits `0`, and
`head_runs` takes the matched head's oid rather than re-reading it
behind a guard that could not fire. The pass over `932a5a3a` found
nothing. `bf3fa91a` then answers a Copilot thread by telling Checks from
Commit statuses in the token requirement. Its pass raised two wording
findings, both fixed in `3abe79d1`: the `unread` note now names check
runs and check suites as unreadable, and the README names a refusal on
the connection itself as sending the read lean. The pass over `3abe79d1`
found nothing. `eec8f71d` answers CodeRabbit by reading jobs for the
listed attempt over REST, which avoids the workflow-definition read `gh
run view` makes. It also drops the marker written into the lean
response. Its pass found nothing, and it is attested on the head.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 30, 2026 21:29
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An active moderate issue remains because the retry logic treats unrelated null pull-request, commit, or branch nodes as tolerated check-detail failures, potentially hiding genuine read errors.

1 open issue
What changed in this PR

This pull request updates backlog_metrics.py to support fine-grained tokens that cannot read GitHub Checks details while preserving the full read for tokens with access.

Changes:

  • Adds a lean GraphQL fallback using rollup state when check details are forbidden.
  • Uses Actions runs and job results to identify failing pull requests and records unread check information.
  • Adds comprehensive fallback tests and documents token requirements and behavior.
File Description
tests/​test_backlog_metrics.py Adds fine-grained-token fixtures and coverage for fallback behavior, pagination, Actions jobs, unread reporting, and error handling.
scripts/​README.md Documents token requirements, fallback behavior, unread output, and exit-status semantics.
scripts/​backlog_metrics.py Implements lean attention reads, Actions-based failure detection, unread reporting, and shared run-list handling.

Review effort: Lite

Comment thread scripts/backlog_metrics.py Resolved
@codecov

codecov Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.34831% with 83 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.33%. Comparing base (6af58f8) to head (e60890a).
⚠️ Report is 535 commits behind head on main.

Files with missing lines Patch % Lines
host-setup/agent-safety/claude/gh-write-guard.py 21.05% 75 Missing ⚠️
scripts/pr_cleanup_modules.py 96.80% 3 Missing ⚠️
scripts/backlog_metrics.py 97.95% 2 Missing ⚠️
scripts/pr_cleanup.py 94.44% 2 Missing ⚠️
scripts/pr_cleanup_reach.py 98.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4594      +/-   ##
==========================================
+ Coverage   79.16%   79.33%   +0.16%     
==========================================
  Files          52       55       +3     
  Lines       17234    17588     +354     
==========================================
+ Hits        13644    13954     +310     
- Misses       3590     3634      +44     
Flag Coverage Δ
python-3.13 79.33% <81.34%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptr727

ptr727 commented Nov 30, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@ptr727

ptr727 commented Nov 30, 2026

Copy link
Copy Markdown
Owner Author

/review

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

…in the Write Guard (#4592)

## Summary

Closes two write-guard bypass gaps, for #4582 and #4514. The closing
keywords go on the promotion pull request.

- **#4582, requirement 4.** A commit or push is refused when its command
text sets a variable whose name starts with `GIT_CONFIG`, or sets `HOME`
or `XDG_CONFIG_HOME`. Each one changes which hooks git runs, either by
setting `core.hooksPath` or by dropping the config that sets it. The
text-set environment now also takes assignments made through `declare`,
`typeset`, `readonly`, and `local`, alongside `export`. The
`GIT_CONFIG*` branch of `_overrides_remote` could no longer be reached,
so it is removed.
- **#4514, shared lexer.** An unquoted bash brace expansion is read as
the words the shell expands it to. That includes comma lists and
`{x..y}` ranges over integers or letters, and repeated words are kept.
So `git add {.,a.txt}` and `git commit {-a,-m} x` read as the sweeps
they are, under both requirement 6 and requirement 11. A quoted brace
stays one word, as does a prefix assignment. A word in a `git` or `gh`
command that expands past 64 distinct words is denied as unreadable.
- **#4514, glob exception.** The live selftest now pins it. A path
holding a glob character that names an existing file no other file
matches is allowed. The same path is refused once another file matches
it.
- Packing the selftest tables freed room, so the guard stays at the
2500-line cap in `tests/test_guard_size.py`. The ceiling is not raised.

Per #4514, this file sits under `host-setup/agent-safety/`, so the
develop merge waits on the maintainer reading the diff.

## Verification

- `gh-write-guard.py --selftest`: `SELFTEST PASS`
- `pytest tests/test_guard_size.py host-setup/agent-safety/claude/ -q`:
`294 passed, 1 skipped, 164 subtests passed`
- ruff check and format, mypy, the prose gate, and the eol gate all
pass, both at the pre-commit hook and when run by hand.
- Four local strict review passes, at `frontier`, were recorded. They
raised 7, then 4, then 1, then 0 findings, and every one was fixed.
- The PR review's two Copilot findings, bash zero-padding and the
undocumented 1024-word raw bound, are fixed in `81511ad1`. The raw bound
was also the third pass's finding.

## Declined in local review

- Refusing `GIT_CONFIG_NOSYSTEM` and `GIT_CONFIG_GLOBAL=/dev/null` is
kept, even in a scratch repository with no origin. Removing a config
source can remove a `core.hooksPath` setting, and `--no-verify` is
refused whatever the origin.
- `printf -v` and `read` assignments are not read. They sit outside the
requirement's reading, in the same way a push run by an alias or a
script does.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@ptr727 ptr727 changed the title Promote Develop to Main: Attention Lists Under a Fine-Grained Token Promote Develop to Main: Fine-Grained Attention Read and Write-Guard Hook-Path Denials Nov 30, 2026
@ptr727
ptr727 requested a lite review from Copilot November 30, 2026 22:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Three critical active findings remain in brace-expansion handling and its self-test, including paths that can allow blanket commits or cause the live self-test to fail.

3 open issues
1 resolved since last review

Review effort: Lite

Answers a Copilot finding on the promotion PR #4594 against #4592 (issue
#4514).

## What changed

The write guard's lexer expands unquoted brace ranges as bash does, so a
blanket commit hidden in a range is still refused under requirement 11.
Two range forms bash accepts were left literal:

- **A stepped alphabetic range.** `_sequence` took `..step` only on
numeric ranges. Bash runs `git commit -{A..z..32} x` as `git commit -A
-a x`, and the guard allowed it.
- **A signed integer.** Bash takes a leading `+` on a range's endpoints
and step, so `git commit -{A..z..+32} x` runs the same way. Both
patterns now share one signed-integer fragment, `_BRACE_INT`.

Copilot's own example, `git commit -{a..z..2} x`, was already denied on
`develop`, since its literal word carries an `a`. The regression row is
`deny:git commit -{A..z..+32} x`, whose literal has none. With that row
in place, the self-test fails on `develop` and on this branch's first
commit, and passes on its head.

## Verification

- `_sequence` matches GNU bash 5.2 for each of these:
  - `{a..e..2}`, `{e..a..2}`, `{a..e..-2}`, `{a..e..0}`, `{A..z..+32}`
- `{+1..3}`, `{+01..3}` (unpadded, as bash does), `{1..5..+2}`,
`{-01..1}` (padded)
- `gh-write-guard.py --selftest` passes, as do
`tests/test_guard_size.py`, `tests/test_cli_usage.py` and
`tests/test_pr_review_policy.py`. Ruff and mypy are clean.
- The file stays at its 2500-line ceiling.

## Local review

Recorded `local-strict-review` passes ran at the `frontier` tier. The
pass over `4f73652b` raised two findings, both fixed in `15632ee5`: the
regression row was denied even without the fix, and a leading `+` still
slipped past. The pass over `15632ee5` raised one more, fixed in
`eab7c6d1`: no self-test row reached the signed half of the numeric
pattern. The new row `deny:4514:git status {+1..65}` fails once that
half is reverted. The pass over `eab7c6d1` found nothing, and it is
attested on the head.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved handling of signed numeric and stepped alphabetic brace
expansions. Existing expansion limits and numeric ordering behavior are
preserved.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The change combines a security-sensitive shell lexer and hook-bypass guard with a permission-dependent GitHub API fallback, so synthetic tests do not establish live token, CLI, runtime, and cross-platform behavior.

No open issues 🎉

3 resolved since last review

Review effort: Lite

@ptr727

ptr727 commented Nov 30, 2026

Copy link
Copy Markdown
Owner Author

Declined: the headline names no defect, and the live behavior it asks about was checked where it can be.

  • Guard lexer on each platform: on this head the CI "Windows unit test job" and the validate job both pass. The validate job runs gh-write-guard.py --selftest. Each brace-range row was compared with GNU bash 5.2 output, and each regression row was shown to fail once its half of the fix is reverted.
  • gh CLI and runtime: the attention read ran live under the maintainer auth over the registry, exiting 0. The REST jobs read the lean path uses (actions/runs/{id}/attempts/{n}/jobs --paginate --slurp) was called live, and it returned the list-of-pages shape run_jobs reads.
  • Fine-grained token: this is the one thing not checked live, since no such token is held here. Read the Attention Lists Under a Fine-Grained Token #4590 states that limit, and the consumer's next weekly run once this reaches main confirms it. Require Consumer-Run Hub Scripts to Name Their Minimum Token and Test a Permission Error #4595 is filed to require one test through the real request layer for every consumer-run script.

Answers the local review of the promotion PR #4594, which raised two
findings, both introduced by #4592.

## What changed

- **The decision-flow diagram shows every denial `classify()` makes.**
`host-setup/agent-safety/README.md` calls the diagram `classify()`'s
actual decision flow, but it had no node for two of its denials:
- the brace-cap denial, for a git or gh command whose expansion passes
64 distinct words or 1024 in all, which runs before requirement 4;
  - requirement 11's blanket stage, between requirements 6 and 7.
  
A reader tracing `git status {1..65}`, or `git add -A` in a linked
worktree, would have reached ALLOW.
- **One splitter for the packed self-test tables.**
`_PUSH_UNREAD_PACKED` now splits through `_rows`, as its sibling tables
do, and a no-op `"".join` on the plain string `_PUSH_PACKED` is gone.
Both case tables are identical to `develop`'s.

## Verification

- `gh-write-guard.py --selftest` passes, as do
`tests/test_guard_size.py`, `tests/test_cli_usage.py` and
`tests/test_pr_review_policy.py`. Ruff and mypy are clean, and the guard
stays at its 2500-line ceiling.
- The node order was read against `classify()`: brace cap, then
requirements 4, 6, 11 and 7, then the GitHub-write checks 1, 2, 3 and 5.

## Local review

Recorded `local-strict-review` passes ran at the `frontier` tier. The
pass over `ec6b838a` found requirement 11 also missing, which `8c24e62a`
added. The pass over that commit found the node named only `git add` and
`commit -a`, and `09b9bef8` and `6763d72d` widened it. The pass over
`6763d72d` found nothing. `236325da` then answers CodeRabbit by naming
`git stage` and the dry-run exemption in the node. Its pass found
nothing, and it is attested on the head.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
ptr727 and others added 2 commits November 30, 2026 18:46
## Summary

`cleanup` used to keep every worktree that git's own `worktree remove`
refuses for holding a submodule. So a drive in a repository with an
initialized submodule ended at `next=maintainer`.

`cleanup` now removes such a worktree once it proves nothing in it is
lost. The proof covers every submodule repository under the worktree's
`modules`, nested ones included. It refuses outright whatever it cannot
show cheaply, the maintainer's choice of a strict design.

- `scripts/pr_cleanup_reach.py` proves a repository's commits and state:
- It refuses a stash, a paused operation (a `sequencer` included), a
linked worktree of its own, a shallow repository, and any tag no remote
holds.
- It reads the commits the repository holds before fetching: its refs,
its `HEAD`, and its `HEAD` reflog.
- It fetches each remote's branches by an explicit refspec, without
recursing.
- None of those commits may sit outside a remote-tracking ref or a tag.
- `scripts/pr_cleanup_modules.py` checks each populated tree, and
`scripts/pr_cleanup_clear.py` clears it. It must be clean, untracked
files included, with no embedded repository and no untracked gitlink
files at any depth. It then deletes the submodule links and `modules`,
naming the git-ignored entries it loses, and runs the plain `worktree
remove`.
- A refusal names the submodule by its tree path, or by its git
directory where it has none. It names the commit with the ref or the
reflog that reaches it.
- A prunable worktree whose git directory still holds `modules` refuses.
The sweep keeps such an entry and removes the other prunable entries one
at a time while it does.
- The proof runs before the remote branch delete. After the delete it
runs again without fetching.
- `pr_cleanup.py` stays under its size ceiling. The shared reads moved
into `pr_cleanup_tree.py`.
- `scripts/README.md` and the `repo-worktree` skill describe the rule.
The skill hands the task only its own pushable work and sends every
other refusal to the maintainer.

Closes #4583

## Testing

- `tests/test_pr_cleanup_modules.py` holds 38 cases on throwaway
repositories, covering both outcomes. One case follows the skill's
recovery steps literally through to a removal.
- The full unit suite passes on the head: 5430 tests, 13 skipped.

## Local review

Twenty-two local passes ran. The twenty-second, over the head, found
nothing, so no local finding is open.

## Earlier local findings and their outcomes

The third pass's eight findings, listed on the first push:

- Fixed in 6e9367e:
  - a fetch under `fetch.pruneTags`;
  - a commit only the reflog reaches;
  - a shallow submodule, which is now named shallow;
  - a submodule's own linked worktrees;
  - the missing `sequencer`;
  - the refusal naming the module rather than the tree path;
  - the sweep's recovery route.
- `unlink_read_only` consolidation, declined. `local_review.py`'s
handler swallows a failure and lets `rmtree` go on deleting the rest of
a throwaway directory, inside a `finally` that must not replace the
read's result. This one must stop the removal at the first failure.
Wrapping a raising handler in a suppress would stop `rmtree` at the
first error, so the two contracts do not share one body.
`docker_lint.py`'s copy has to stay standalone.

The tenth pass's findings are answered in a95ac1e, the maintainer's
strict redesign: the proof refuses outright what it cannot show cheaply.
That covers a shallow submodule, a moved tag, and a reflog-only commit,
and the skill routes each to the maintainer. The prune race is closed,
and the dead tag strip is gone. The eleventh pass's findings are fixed
in 1b0461e: Windows path separators, the sweep's prune for a
`.git`-less entry, the recovery test, the README pronoun, and the reflog
docstring. The twelfth pass's findings are fixed in 797a3fe. The
thirteenth pass's findings are fixed in 19ea787. That covers a prunable
entry resolving to an enclosing repository, the held sweep, the unneeded
`pruneTags` overrides and their tests, the README tag sentence, and the
skill's push target. The fourteenth pass's findings are fixed in
43cc019. A surviving worktree directory refuses before the remote
delete, `clear` deletes `modules` before the links, and a branch commit
goes to the maintainer. The over-hardened sweep keep is gone. The
fifteenth pass's findings are fixed in e16bfb6, and its reflog question
is answered: the maintainer keeps the strict reflog rule, accepting that
a squash-merged submodule commit refuses for git's reflog window. The
sixteenth pass's findings are fixed in 72c812c. The seventeenth pass's
findings are fixed in de0acf0, and the eighteenth pass's in a4a121e.
The nineteenth pass's findings are fixed in 76b0262, which also splits
the clearing into `pr_cleanup_clear.py` so every file stays under its
ceiling. The twentieth pass's findings are fixed in 487e94f, and the
twenty-first pass's in b912bf2.

The eighth pass's findings are fixed in e2718cc: a prunable worktree's
submodule repositories, a moved shallow pin, and the shared gitlink and
paused-operation reads. Its `unlink_read_only` evidence,
`docker_lint.py`'s copy, is now named in that handler's docstring, and
the decline stands. The ninth pass's findings are fixed in f32fc25: an
unpushed tag on a pushed commit, the sweep held by one orphaned entry,
and the README's sweep pronoun.

The sixth pass's findings are fixed in 4f417f6: a treeless submodule's
git directory, any ref that reaches a commit, and a remote under another
owner. Its `unlink_read_only` consolidation stays declined, as above.
The seventh pass's findings are fixed in 0cdd09b: files in a gitlink
path no repository tracks, a shallow submodule's history download, the
README contradiction, and the shared status read.

The fourth and fifth passes' findings are fixed in e03dd7a and
843fea1. Those cover git before 2.42, `log.showSignature`, a tag
refspec, the refusal naming what reaches the commit, the sweep route, a
nested submodule's label, a recursive fetch, a staged gitlink, and a
merged upstream branch.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Answers the second local review of the promotion PR #4594, at head
9a5af3f.

## What changed

- **The guard's docs name its fail-closed cases without a closed
count.** `host-setup/agent-safety/README.md`, the guard's docstring and
the Claude README each said every unread shape is allowed except under
requirement 4. The brace cap, a git or gh brace word past 64 distinct
words or 1024 in all, also denies, and requirement 11 fails closed on an
unread directory or pathspec. The docs now say a shape the reading does
not reach is allowed except where a requirement says it fails closed,
and the brace cap denies as well. "Other commands are read as before"
now says what it means: a large brace word of any other command is kept
as one literal word. The Claude README also lists requirement 11 as a
fifth class.
- **One set of state-changing builtins.** The guard's shell-state update
named `declare`, `typeset`, `readonly` and `local`, while its
guessed-env skip named only `export`. So a guessed reading could change
the shell state its docstring says a guess never changes. Both now use
`_DECLARERS`. A self-test row pins it, failing on `develop` and passing
here.
- **The attention read tolerates a refused `workflowRun`, as the review
gate does.** A per-field error on a check suite's `workflowRun` used to
fail the whole attention read, exiting 1. `pr_review.py` already
tolerates it and sets `WORKFLOW_KEYS_UNAVAILABLE`, which `check_nodes`
honors. The predicate moves to `pr_review_checks.workflow_run_error`,
and both scripts use it. `backlog_metrics.py` tolerates it on a full
read, groups those checks by suite, and adds a note to `unread`.

## Verification

- `tests/test_backlog_metrics.py`, `tests/test_pr_review.py`, the guard
self-test and `tests/test_guard_size.py`, `tests/test_cli_usage.py` and
`tests/test_pr_review_policy.py` pass. Ruff and mypy are clean, and the
guard stays at its 2500-line ceiling.
- The new tolerance test fails against `develop` with `GraphQLError` and
passes here.

## Local review

Recorded `local-strict-review` passes ran at the `frontier` tier. The
pass over `43147578` raised four findings, fixed in `000c54f2`:

- the docs' count of fail-closed exceptions was still closed and wrong;
- the README and note claimed a token cause for any error type;
- tests for the flag's scope were missing;
- the `declare` skip had no self-test row.

The pass over `000c54f2` raised three more, fixed in `bd3fce34` and
`299b3325`:

- one pull request's `workflowRun` error marked its whole page, where
the gate marks only that pull request;
- the note did not name the pull request;
- the `unread` definition still tied every entry to the token.

The flag now follows the error's path to its pull request, and the note
names it as `#N`. The pass over `bd3fce34` then found the Claude
README's class count wrong, and a fallback no query path reaches, both
fixed in `299b3325`.

The pass over `299b3325` raised two doc findings, both fixed in
`61a168fa`. The requirement 5 sentence sat inside the cross-owner rule's
qualifier, and the fail-closed examples read as complete while leaving
out requirement 6. The docs now list no fail-closed requirements at all,
since every such list missed one. The pass over `61a168fa` found
nothing. CI then failed: moving the predicate into `pr_review_checks.py`
took that file to its 450-line ceiling. `2cd32922` moves it into
`gh_graphql.py` instead, the request layer whose `tolerate` it serves.
The full suite, 5409 tests, passes locally. That pass found two
docstrings saying "refused" where any error type is tolerated, fixed in
`cae488a1`.

The pass over `cae488a1` found that every `workflowRun` test sent a
FORBIDDEN error. `9f52bebd` sends an INTERNAL one, so gating the
tolerance on FORBIDDEN fails the suite, and the tests no longer say
"refused". The pass over `9f52bebd` found nothing. CodeRabbit then noted
a test named for suite grouping that asserts only the marker, renamed in
`2448569a`. That pass found the docs claiming every check on the pull
request regroups, where only the Actions suite whose workflow run went
unread does, fixed in `3397f63d`. The pass over `3397f63d` found
nothing, and it is attested on the head.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@ptr727

ptr727 commented Dec 1, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head e60890ad04776c8c2724bfe1917143b110aff261, the content this pull request carries at that commit against main, and it recorded 0 findings.

@ptr727
ptr727 merged commit f75c348 into main Dec 1, 2026
14 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

2 participants