Repository navigation
uphold holds its own agent sessions to a [stop] gate: the reconcile and the Python suite - #426
Conversation
…nd the Python suite policy/principles.toml declares `[stop] run` with `uphold check` and the Python suite, and .claude/settings.json configures `uphold hook claude-code` for SessionStart (async) and Stop, so a Claude Code session here cannot end a turn with either newly red. `cargo test` is left out on purpose: the gate runs at every turn's end, and the Rust suite adds a minute or more there. It stays at pre-push and in CI. Run by hand through the hook on this tree, the gate is green and takes about ten seconds. Needs uphold 1.36.0 or later on PATH; 1.35.2 refuses a policy carrying `[stop]`. Claude-Session: https://claude.ai/code/session_017EkhA3KMqw95DzAEYPkDn7
|
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 19 minutes. View limit details
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Hook configuration and stop checks .claude/settings.json, policy/principles.toml |
Configures the hook for SessionStart and Stop. The start hook runs asynchronously, and the stop hook has a 600-second timeout. The stop policy runs uphold check and Python unittest discovery from tests. |
Priority:
Estimated code review effort: 1 (Trivial) | ~4 minutes
Change: Feature
Possibly related issues
- Design: an agent cannot end its turn with the gate red #421: The PR adds the
[stop]policy gate and configures the Claude Code hook for both session events described in the issue.
Possibly related PRs
- HackingGate/uphold#424: This PR uses the
SessionStartandStophook behavior and[stop].runcontract implemented in PR#424.
Merge Risk: 
Minimal · up to 3c6ca
-
The hook and stop-check configuration are suitable to merge with normal validation.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (2 skipped: 2 unsupported.)
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- 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.
Comment @coderabbitai help to get the list of available commands.
[Medium impact] Adds session hooks and a stop-gate check configuration. Fix the background test's writes to Findings
SummaryAdds a gate for this repository's Claude Code sessions.
The background Python run can overwrite edits to HackingGate explicitly acknowledged that older uphold versions cannot read the new policy and that uphold ≥ 1.36.0 is required. Reviews (1) · Last reviewed commit: "uphold holds its own agent sessions to a..." · Reviewed by Greptile |
| { | ||
| "hooks": { | ||
| "SessionStart": [ | ||
| {"hooks": [{"type": "command", "command": "uphold hook claude-code", "async": true}]} |
There was a problem hiding this comment.
Background checks overwrite edits
The new asynchronous SessionStart hook runs a test that rewrites the real toolchain.toml. If rustc is installed, test_a_version_the_host_cannot_satisfy_is_refused saves the file, changes its Rust requirement, runs deps.sh, then blindly restores the saved bytes. An agent editing that file during the check loses its changes when the test restores the old contents.
Run this test against a temporary copy before enabling the suite in the background.
There was a problem hiding this comment.
Fixed in 6e36fa7. The test now copies scripts/deps.sh into a temporary directory beside the edited manifest and runs it there. The tree's toolchain.toml is never written; its checksum is unchanged across a run. No other Python test writes into the tree: the release-script tests use a sandbox.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #426 +/- ##
=======================================
Coverage 94.89% 94.89%
=======================================
Files 54 54
Lines 27640 27640
=======================================
+ Hits 26228 26229 +1
+ Misses 1412 1411 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…n the tree's toolchain.toml test_a_version_the_host_cannot_satisfy_is_refused wrote the repository's own toolchain.toml and restored the saved bytes afterwards. The Python suite now runs as the [stop] gate, in the background while an agent works, so an edit made to that file during the run would have been reverted. It now copies scripts/deps.sh into a temporary directory beside the edited manifest; deps.sh reads only the toolchain.toml next to its own scripts/ directory, so the comparison under test is the same. Claude-Session: https://claude.ai/code/session_017EkhA3KMqw95DzAEYPkDn7
Uses the
[stop]gate from #424 (released in 1.36.0) on uphold itself.What changed
policy/principles.toml:[stop] rundeclaresuphold checkand the Python suite (uv run --no-project python -m unittest discover -s tests)..claude/settings.json(new, tracked): runsuphold hook claude-codeonSessionStart(async) andStop(timeout 600s).cargo testleft out: the gate runs at the end of every turn, and the Rust suite would add a minute or more each time. It stays at pre-push and in CI.Evidence
SessionStart, thenStop), the gate is green, prints nothing, and takes about 10 seconds.Note
[stop], and its git shim then refuses git in this checkout..claude/is ignored by the author's global gitignore, sosettings.jsonwas added withgit add -f. The repo's own.gitignoredoes not ignore it.https://claude.ai/code/session_017EkhA3KMqw95DzAEYPkDn7
Summary by CodeRabbit