fix(investigate): resolve the scope lock to an absolute path and release it in Phase 5 (#2845) - #2846
Open
aegixx wants to merge 1 commit into
Open
fix(investigate): resolve the scope lock to an absolute path and release it in Phase 5 (#2845)#2846aegixx wants to merge 1 commit into
aegixx wants to merge 1 commit into
Conversation
…ase it in Phase 5 The Scope Lock wrote `<detected-directory>/` verbatim (its own example is the relative `src/auth/`) into the machine-global freeze-dir.txt, and no later phase removed it. check-freeze.sh resolves a relative boundary against the working directory of whatever tool call comes next, so one debug session's lock re-anchored to `<other-repo>/src/` in every later session on the machine and stayed there until someone ran /unfreeze. - Scope Lock resolves the directory with `cd ... && pwd` before writing, the way /freeze and /guard already do, and prints SCOPE_LOCK_SKIPPED instead of freezing "/" when the directory does not resolve. - Phase 5 releases the boundary this run wrote, on every completion status, by compare-and-delete so a /freeze the user set beforehand is left alone. - /freeze and /guard prose no longer claim the boundary ends with the session. - test/investigate-freeze-path.test.ts pins the template and generated files, drives the real hook from two working directories to show the relative boundary flipping verdicts, and exercises the rendered release block. Fixes garrytan#2845
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
aegixx
marked this pull request as ready for review
September 10, 2026 23:58
ajay-chauhan-shuru
approved these changes
Sep 11, 2026
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.
Why (in your own words)
/investigate's Scope Lock writes the debug boundary intofreeze-dir.txtas a relative path (src/, its own example issrc/auth/) and no phase ever removes it. That file is one machine-global state file, andcheck-freeze.shresolves a relative boundary against the working directory of whatever tool call comes next. So a lock set while debugging one repo re-anchors to<other-repo>/src/in every later Claude Code session on the machine, blocking edits nobody froze and permitting edits to the wrong tree, until someone happens to run/unfreeze. On my machine asrc/lock from 2026-09-07 blocked a scratchpad write in an unrelated session on 2026-09-10.This PR makes the Scope Lock resolve an absolute path the same way
/freezeand/guardalready do (skipping loudly when the directory does not resolve, rather than freezing/), adds a Phase 5 step that releases the lock this run wrote by compare-and-delete (so a/freezethe user set beforehand is left alone), and corrects the/freezeand/guardprose that told users the boundary ends with the session.Fixes #2845.
Live evidence
The defect, against the real hook. Temp state root, two directories standing in for two worktrees, state file holding
src/, exactly what the skill wrote. SameWrite, two working directories:Regression test, failing first. Templates edited, generated files not yet regenerated:
After
bun run gen:skill-docs:The new tests pin the template and the generated SKILL.md (absolute resolution,
SCOPE_LOCK_SKIPPED, release block after the report, compare-and-delete guard), drive the realcheck-freeze.shfrom two working directories to show the relative boundary flipping verdicts and the absolute one holding, and run the rendered release block against a state file it wrote, one it did not write, and no file at all.Full free suite.
bun run test:Scope
investigate/SKILL.md.tmpl(Scope Lock resolves absolute, skips loudly on a non-directory; Phase 5 release block; one Important Rules bullet),freeze/SKILL.md.tmplandguard/SKILL.md.tmpl(prose: the boundary is a state file that survives the session), the three regeneratedSKILL.md,test/investigate-freeze-path.test.ts.gen:skill-docs --dry-runclean./investigaterun underclaude -p(the paid E2E lane).check-freeze.shitself is unchanged.Liveness proof (required)
Checklist
GSTACK PRtyped live into a real surface (not edited onto the image)