Skip to content

uphold holds its own agent sessions to a [stop] gate: the reconcile and the Python suite - #426

Merged
HackingGate merged 2 commits into
mainfrom
stop-gate-here
Oct 24, 2026
Merged

HackingGate merged 2 commits into
mainfrom
stop-gate-here

Conversation

@HackingGate

@HackingGate HackingGate commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Uses the [stop] gate from #424 (released in 1.36.0) on uphold itself.

What changed

  • policy/principles.toml: [stop] run declares uphold check and the Python suite (uv run --no-project python -m unittest discover -s tests).
  • .claude/settings.json (new, tracked): runs uphold hook claude-code on SessionStart (async) and Stop (timeout 600s).
  • cargo test left 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

  • Run by hand through the 1.36.0 hook on this tree (SessionStart, then Stop), the gate is green, prints nothing, and takes about 10 seconds.
  • All pre-commit hooks pass.

Note

  • Requires uphold ≥ 1.36.0 on PATH. 1.35.2 rejects a policy that contains [stop], and its git shim then refuses git in this checkout.
  • .claude/ is ignored by the author's global gitignore, so settings.json was added with git add -f. The repo's own .gitignore does not ignore it.

https://claude.ai/code/session_017EkhA3KMqw95DzAEYPkDn7

Summary by CodeRabbit

  • Chores
    • Added automated checks that run when a work session ends, including project validation and Python tests.
    • Configured session-start and session-stop hooks for the development workflow.

…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
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d9caa6b6-f0e0-4f43-8c35-d395781a5b14
Commits

Reviewing files that changed from the base of the PR and between 3c6ca02 and 6e36fa7.

Files selected for processing: 1
  • tests/test_toolchain.py

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3e2badeb-5d5a-41f4-8f6a-3f108677b9b3
Commits

Reviewing files that changed from the base of the PR and between 03610a6 and 3c6ca02.

Files selected for processing: 2
  • .claude/settings.json
  • policy/principles.toml

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The change configures uphold hook claude-code for Claude Code’s SessionStart and Stop events. The stop policy runs uphold check and Python unittest discovery.

Changes: Claude Code hooks

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: Low

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Feature

Possibly related issues

Possibly related PRs

  • HackingGate/uphold#424: This PR uses the SessionStart and Stop hook behavior and [stop].run contract 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: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the main change: adding a [stop] gate that runs the reconcile check and Python test suite for uphold agent sessions.
Docstring Coverage Passed 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…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] Adds session hooks and a stop-gate check configuration.

Fix the background test's writes to toolchain.toml before merging.

Findings

  1. P1 Background checks overwrite edits ▶

Summary

Adds a gate for this repository's Claude Code sessions.

  • Claude Code checks uphold’s own code before an agent turn ends.

The background Python run can overwrite edits to toolchain.toml; isolate the test's file writes before merging.

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

Comment thread .claude/settings.json
{
"hooks": {
"SessionStart": [
{"hooks": [{"type": "command", "command": "uphold hook claude-code", "async": true}]}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 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.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

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-commenter

codecov-commenter commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.89%. Comparing base (03610a6) to head (6e36fa7).

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.
📢 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.

…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
@HackingGate
HackingGate merged commit 4f25199 into main Oct 24, 2026
12 checks passed
@HackingGate
HackingGate deleted the stop-gate-here branch October 24, 2026 17:02
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