Repository navigation
Conversation
Old PRs carry a deepdiff/ tree that can still import dependencies the current dev has dropped (e.g. cachebox), so their tests fail at import in the sandbox, which installs from the current uv.lock. - sandbox-pr.sh: --deps-from checkout|merge-base. With merge-base, uv.lock and pyproject.toml come from the merge-base of the PR with BASE. That commit is in BASE's history, so the lockfile is still the maintainer's, never the PR's. - run-sandboxed.sh: --deps-dir DIR to take uv.lock/pyproject.toml from DIR; a hint to try an older --python when the install fails (old lockfiles may lack wheels for the default 3.15). - Makefile: DEPS=merge-base shorthand. README: document both.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #683 +/- ##
=======================================
Coverage 95.22% 95.22%
=======================================
Files 19 19
Lines 5070 5070
=======================================
Hits 4828 4828
Misses 242 242 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
For PRs whose contributors won't rebase: merge BASE into the PR, resolve conflicts with a locked-down Claude agent, let the maintainer review, then sandbox-test the merge with the current dependencies. - merge-pr.py merge: fetches, merges in memory with `git merge-tree` (nothing is checked out), copies only the conflicted files (renamed to conflicts/NN.txt) plus each side's diff to a scratch dir, and runs `claude -p --restricted --tools Read,Edit,Write,Glob,Grep --strict-mcp-config` there. merge-pr.py verifies the session's tools, MCP servers and permission mode, and that the guard hook saw every tool call, before using the result. The review shows each conflict's PR side, base side and resolution, and flags leftover markers, edits outside conflict blocks and UNCERTAIN/SUSPICIOUS notes. The accepted merge is written with commit-tree to refs/pr-sandbox/<N>-merge (PR head first parent), then tested via sandbox-pr.sh --ref. - merge-pr.py push: fast-forward push of the merge to the PR branch after confirmation, or a new PR when maintainers can't push there. - merge-guard.py: PreToolUse hook confining the agent's reads to the scratch dir and its writes to conflicts/* and notes.md. - sandbox-pr.sh --ref: test a merge commit (validated against the PR head and BASE); the report records what was tested (source.txt), so `make pr-review` adds the conflict resolution to its prompt. - Makefile, README: pr-merge (AGENT=0, REDO=1, COMMIT=<sha>), pr-push.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Old PRs (e.g. #618) can't be tested in the sandbox: their
deepdiff/still importscachebox, which #681 dropped, and they conflict withdev. Their contributors won't rebase after this long.make pr-merge PR=<N>: merge dev into the PR and test thatSix numbered steps, each saying what it does and what it needs from you:
refs/pr-sandbox/(no checkout).git merge-tree. None of the PR's files ever land in a working tree. It's a merge rather than a rebase, so the contributor's commits stay as they are and the result can be pushed to their branch as a fast-forward.conflicts/NN.txtso they can't be loaded asCLAUDE.md/.claudeconfig, plus each side's diff. It runs asclaude -p --restricted --tools Read,Edit,Write,Glob,Grep --strict-mcp-config: no shell, web or MCP connectors, and user/project settings are ignored. Themerge-guard.pyhook confines reads to the scratch dir and writes toconflicts/*andnotes.md. Before using the result,merge-pr.pychecks the session's reported tools, MCP servers and mode, and that the guard saw every tool call. Otherwise it stops.UNCERTAIN:/SUSPICIOUS:notes. Choices: accept, edit ($EDITOR, vim modelines off), diff, or quit. Nothing is committed before you accept.commit-treetorefs/pr-sandbox/<N>-merge(PR head is the first parent). It's reused on later runs until either side moves.sandbox-pr.sh --ref(new): the usual triage and confirmation, then the tests with the currentuv.lock.Then:
make pr-reviewalso reads the conflict resolution (git show --cc) when the report is for a merge.report/source.txtrecords what was tested.make pr-pushpushes the merge to the PR branch after asking. If maintainers can't push there, it offers to open a new PR instead.Options:
AGENT=0(resolve in the editor),REDO=1,COMMIT=<sha>(for conflicts it can't handle, such as rename/delete or binary; it prints worktree instructions for those). Auv.lockconflict takes dev's lockfile, with a warning.DEPS=merge-base(first commit)make pr-sandbox PR=<N> DEPS=merge-basetests a stale PR as written, usinguv.lock/pyproject.tomlfrom its merge-base withdev. That commit is still in our own history, never the PR's. Old lockfiles may needOPTS="--python 3.14".Testing
None of these ran the PR's code:
dontAsk. It had no shell, the guard blocked a read of/etc/hostname, and every call was logged.--no-test): the agent resolved all 4 conflicts in 71s ($0.42), and its resolutions match the manual ones. The commit's parents are the PR head and dev, no markers are left in the tree,model.pyparses, and the diff against dev is exactly the PR's 8 files.sandbox-pr.sh --ref: accepts the merge and shows the triage, then stops at the confirmation prompt (no TTY).Not tested:
make pr-merge PR=618with the sandbox runpr-pushpr-review's merge promptai_agentdirectly)