Repository navigation
Count Untracked Files in the Dirty Stamp, State the Session Tree Bound - #4311
Conversation
The agent-safety installer's dirty-stamp status read passes --untracked-files=all, so a host with status.showUntrackedFiles=no no longer stamps a clean source over a payload file no commit holds. A test builds a throwaway git tree with that setting and an untracked payload file and reads the real status. Requirement 9 of the host-safety spec states the whole-tree ceiling over a chain of nested sessions, and the stop of a group named for another session only where it is in this session's tree and its recorded agent has ended. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The GIT_ scrub moves into one fixture both source-ref test classes use, so the archive cases' git commands no longer follow a hook's GIT_DIR. Requirement 9 names a heavy command, not a build in the parent, as what a shared ceiling would let end a nested agent. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The shared fixture clears git's location variables through spec/git_env.py, points global and system config at an empty file, and holds the one identity-pinned git helper the source-ref tests use. The dirty read passes each payload path relative to the kit rather than as an absolute pathspec. Requirement 9 says what a command does where the tree's ceiling cannot be put on. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 44 minutes. View limit details
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. |
There was a problem hiding this comment.
🔵 Needs a closer look
Approval should wait because Requirement 9 hinges on unverified live nested claude -p behavior—including session-ID inheritance and SessionEnd ordering—that cannot be established from the repository snapshot and requires the maintainer’s runtime probe.
No open issues 🎉
What changed in this PR
This pull request improves Claude agent-safety source tracking and documents session-tree containment behavior.
Changes:
- Includes all untracked files and uses kit-relative paths when computing dirty source stamps.
- Adds isolated temporary Git fixtures and regression coverage for untracked payload detection, with external
DEPLOYED_DATAcoverage still needed. - Expands requirement 9 with nested-session tree ceilings and bounded orphan cleanup behavior.
- Includes documentation tense and test-fixture docstring corrections to address.
| File | Description |
|---|---|
| host-setup/agent-safety/README.md | Documents nested-session tree ceilings and bounded cleanup of orphaned groups. |
| host-setup/agent-safety/claude/test_install.py | Adds isolated Git fixtures and regression coverage for hidden untracked payloads. |
| host-setup/agent-safety/claude/install.py | Makes dirty-source detection include all untracked payload files and use kit-relative pathspecs. |
Review effort: Lite
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4311 +/- ##
===========================================
- Coverage 81.60% 79.05% -2.56%
===========================================
Files 26 43 +17
Lines 9070 15733 +6663
===========================================
+ Hits 7402 12438 +5036
- Misses 1668 3295 +1627
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
|
/review |
Action not completed
|
|
Answering the headline of the Copilot round on
Awaiting maintainer. The requirement text states what an implementation must do, so it holds whichever way the probe comes out. The probe decides whether the Claude kit meets it. #2598's approved option asks for that nested run first, and a nested agent session is a live run outside this change's workspace. So the body hands the maintainer the exact command and the observations that tell the two cases apart, under "For the Maintainer to Run". This pull request touches |
…d, and Hub Pin Drift (#4315) ## Summary Promotes `develop` to `main`. It carries these changes: - [#4303](#4303) orders the STANDUP.md seed push, carry commits, and secret hand-over. - [#4304](#4304) forbids state-changing probes and routes observed secrets to revocation. - [#4305](#4305) routes SIGINT and SIGTERM through one handler, bounds the child wait, and states two stop paths. - [#4306](#4306) holds `pr_review.py merge` for a hosted review not registered yet. - [#4309](#4309) reads the branch before the tree so an empty root commit resolves its secrets. - [#4310](#4310) watches the merge bot's auto-merge and re-arms a disable GitHub makes. - [#4311](#4311) counts untracked files in the dirty stamp and states the session tree bound. - [#4314](#4314) reports each caller's hub pin behind the newest release as drift past a 30-day bound. Related issues #4308, #4312, and #4313 stay open. Fixes #1418 Fixes #4137 Fixes #4063 Fixes #4147 Fixes #2598 Fixes #4128 Fixes #4240 Fixes #4229 Fixes #3806 Fixes #4146 Fixes #4100 Fixes #4218 Fixes #4223 Fixes #4228 Fixes #4224 🤖 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 * **New Features** * Repository audits now report outdated reusable-workflow pins as advisories or drift, with advisory findings kept separate from blocking issues. * Merge automation can retry enabling auto-merge after the base branch settles; unsupported target branches and refused merges are reported as failures. * Pull-request checks now account for a brief hosted-review registration window before reporting checks as pending. * **Bug Fixes** * Empty repositories and empty root commits are handled correctly when resolving repository secrets. * Long-running tools improve cleanup and signal handling when interrupted. * **Documentation** * Updated guidance for repository setup, review handling, workflow automation, and safe verification practices. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
Two agent-safety kit changes, each approved on its issue. The merge waits on the maintainer's read of this diff.
git status --porcelainread behind the stamp'sdirtyfield inhost-setup/agent-safety/claude/install.pypasses--untracked-files=all. It is the same flagscripts/skills_install.pypasses on both of its cleanliness reads. Before this change, a host withstatus.showUntrackedFiles=nostampeddirty=Falseover a payload file no commit holds, so--reportnever printed "installed from a dirty checkout". A new test,TestSourceRefUntrackedPayload, builds a throwaway git tree under a temp directory. It commits every payload file but one, setsstatus.showUntrackedFiles=noin that tree's own config, and adds the last payload file untracked. It then reads the real status, withAGENT_SAFETY_DIRTY_OVERRIDEunset. It asserts that a plaingit status --porcelainprints nothing there, and thatsource_ref()reportsdirtyas true. The test fails against the old read and passes against the new one. It shares a fixture,KitTreeCase, with the existing archive cases. That fixture clears git's location variables throughspec/git_env.py, so a git hook running the suite cannot point a case's git commands at another repository. It also points global and system git config at an empty file, so a host's hooks path, template, or fsmonitor never reaches a temp-tree commit. It holds the one identity-pinned git helper all three git-building cases use. That closes the same gaps in two existing archive cases that rungit initandgit commit. Everything a case writes stays inside its temp directory, which it removes.git -C, rather than as an absolute path.scripts/skills_install.pypasses repo-relative paths for the same reason: undergit -C, an absolute pathspec can match nothing and read clean.TestSourceRefstill detects a dirtied payload file in a real checkout, and reads a clean one as clean.host-setup/agent-safety/README.mdrequirement 9 now states two things the Claude kit already does. First, a nested agent session's commands run in groups of their own, and every group in a chain of nested sessions sits under one total ceiling for the whole tree. Where the tree's ceiling cannot be put on, a command still runs under its own ceilings and says the tree has none. Second, the session-end stop also stops a group named for another session, but only where that group is in this session's tree and the agent it records has ended. That stop is bounded by the tree and the recorded agent, and judges nothing about the group's own processes. The Codex and opencode tree bound stays with Add safety hooks for opencode and codex #781, which stays deferred. Requirement 9 is agent-agnostic, so an implementation of it there includes the tree bound.host-setup/agent-safety/claude/README.mdalready describes the tree slice and the orphan stop, and says nothing about the dirty read's untracked mode, so it is unchanged.Closes on promotion: #4147, #2598
For the Maintainer to Run: Does a Nested Session Inherit
CLAUDE_CODE_SESSION_ID?#2598's approved option asks for a nested
claude -prun to check whether a nested session inherits the parent'sCLAUDE_CODE_SESSION_ID. A nested agent session is a live run outside a worker's own workspace, so this pull request did not run it. The requirement 9 text above states what the kit must do and holds either way. If the session id is inherited, the Claude kit is what falls short of the requirement, and that is a kit defect to file.Run this as one Bash tool call inside a Claude Code session on a Linux host where the kit's containment prefix is registered. Run it in a session with nothing else in flight. In the inherited case, the nested session's sweep stops the parent session's own command scopes, this command's scope included.
Expected observations, own id (requirement 9 holds as implemented):
tool=and the hook'senv=print the same id, and it differs fromparent=.session_id.root=prints the parent's id, where the parent is itself a root session.claude-tool-<nested id>-...scope insideclaude-tree-<parent id>.slice.cat.Expected observations, inherited id (a kit defect against requirement 9):
tool=orenv=prints theparent=id. Note whether the payload'ssession_idis the parent's id too, since the sweep reads both.claude-tool-<parent id>-...scope, so the nested session's commands are grouped under the parent's name.cat. Readsessionend.txtunder the printeddir=from a fresh tool call.Local Review Findings Still Open
Three local passes ran. The two rounds of edits fixed every
introducedfinding from the first two passes. The third pass raised the findings below after that budget was spent. Each one's class and the outcome this pull request's review loop gave it follow.host-setup/agent-safety/claude/install.pysource_ref(), the dirty read (introduced, design): it repeats the--untracked-files=alland relative-pathspec shape ofscripts/skills_install.pysource_ref()rather than sharing one primitive. Outcome: declined. A shared helper across the two installers is a refactor ofscripts/skills_install.py, which is outside this change's approved design and its file claim. This diff brings the two copies into agreement rather than further apart.host-setup/agent-safety/claude/install.pysource_ref(),ref["dirty"] = bool(status)(introducedby proximity, correctness): agit statusthat exits non-zero reads as clean. Outcome: declined underGOVERNANCE.md"Trust Boundaries and Hardening Effort". The read runs in the maintainer's own checkout, right afterrev-parse HEADsucceeds there. A status failure then needs a corrupt or unreadable index, and this change removed the outside-the-repository pathspec route to one.host-setup/agent-safety/README.mdrequirement 9, "where stopping its parent's group ended the nested agent before its own stop ran" (style): a past-tense remark. Outcome: declined. The tense orders two events inside one case rather than describing a change from a prior state, which is what the present-tense rule governs.Dropped Findings
host-setup/agent-safety/claude/test_install.pyTestSelftestIgnoresAmbientGitDir: consolidation ontospec/git_env.py, on text this change did not touch.Pre-Existing Findings, Not Filed
host-setup/agent-safety/claude/tool-containment.pydecide(): where neitherAGENT_CONTAINMENT_ROOTnorCLAUDE_CODE_SESSION_IDyields a token, a command runs with no tree ceiling and no notice (correctness, declined). Claude Code setsCLAUDE_CODE_SESSION_IDin a tool call's environment, so the deployment does not produce that case.Verification
python3 -m unittest test_installinhost-setup/agent-safety/claude/: 238 tests, OK.TestSourceRefUntrackedPayloadrun against the oldinstall.py: 1 failure, the assertion thatdirtyis true.host-setup/agent-safety/claude/, mypy over the repository, and the prose gate againstdevelopare clean. The pre-commit hook ran each on the commit.🤖 Generated with Claude Code