fix(spec-stop-guard): ignore active plan outside current project#156
fix(spec-stop-guard): ignore active plan outside current project#156presempathy-awb wants to merge 1 commit into
Conversation
When PILOT_SESSION_ID is unset, the session-scoped active_plan.json collapses to the shared "default" file. A /spec plan registered by another repo's session (e.g. a COMPLETE plan in repo A) then leaks into an unrelated repo B's session and blocks its stops — the guard fires on a plan that has nothing to do with the current project. Scope the guard to plans that actually live inside the current project root (CLAUDE_PROJECT_ROOT, else git root, else cwd). Fails open (returns True -> legacy behaviour) when the root can't be determined, so legitimate same-project guarding is never weakened. Adds two tests: a foreign-project plan must not block; an absolute plan path inside the current project still blocks.
|
@presempathy-awb is attempting to deploy a commit to the Max Ritter Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (2)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
No issues found across 2 files
Tip: cubic could auto-approve low-risk PRs like this, if it thinks it's safe to merge. Learn more
Re-trigger cubic
|
@presempathy-awb Thanks for your contribution, this has been applied in version 9.2.0. I hope you enjoy using Pilot Shell :) |
Problem
When
PILOT_SESSION_IDis unset, the session-scopedactive_plan.jsoncollapses to the shareddefaultfile. A/specplan registered by another repo's session then leaks into an unrelated repo's session through that shared file, andspec_stop_guard.pyblocks stops on a plan that has nothing to do with the current project.Observed: a
COMPLETEplan in repo A blocked every stop in an unrelated repo B's session ("you cannot stop…"), with no clean way to clear it short of hand-editing the shared state.Fix
Scope the guard to plans that actually live inside the current project root:
_current_project_root()resolvesCLAUDE_PROJECT_ROOT→ git root → cwd._plan_in_current_project()returnsFalsewhen the registered plan path is outside that root, sofind_active_plan()returns(None, None)and the guard stays out of the way.True(legacy behaviour), so legitimate same-project guarding is never weakened.Tests
Two new tests in
TestSessionScopedPlanDetection:test_ignores_plan_outside_current_project— reproduces the bleed: a foreign-project plan must not block.test_blocks_absolute_plan_inside_current_project— guards against over-suppression: an absolute plan path inside the current project still blocks.42 passedlocally (pytest pilot/hooks/tests/test_spec_stop_guard.py).Notes
Additive and non-breaking — no change to behaviour when a single session/project is involved. Surfaced while running
/specin one repo with a staleCOMPLETEplan registered from another.Summary by cubic
Prevented cross-session bleed in
spec_stop_guardso a plan from another repo no longer blocks stops whenPILOT_SESSION_IDis unset. The guard now only applies to plans inside the current project.CLAUDE_PROJECT_ROOT→ git root → cwd.Written for commit 94874e7. Summary will update on new commits.