Problem
Graff allows multiple independent root sessions to run in the exact same working directory without warning, ownership coordination, or status reconciliation.
A recent machine audit found three live root Graff processes with the same Lawplain cwd. Two large trajectories performed overlapping Phase 2/Phase 3 acceptance work against the same uncommitted working tree. One trajectory interpreted implementation completed by the other as unfinished inherited work and repeated audits, reviews, browser verification, and hardening. Both could also have edited the same files concurrently.
This is distinct from #114. Opt-in -w worktree isolation exists, but it does not protect a user who accidentally starts another ordinary root session in an already-owned checkout.
Risks
- duplicate implementation and verification work;
- conflicting edits to an uncommitted working tree;
- one session testing code changed asynchronously by another;
- stale goals/todos being mistaken for the current worktree's status;
- misleading completion reports and difficult attribution;
- unsafe cleanup because process ownership is unclear.
Proposed behavior
On root-session startup, register a machine-local lease keyed by the canonical effective worktree identity (canonical cwd plus Git common-dir/worktree metadata where available).
If another live root session already owns that worktree, show a prominent warning with:
- PID and process start identity;
- session/trace ID;
- age and last activity;
- active/paused goal summary;
- dirty-worktree status if cheaply available.
Offer explicit choices:
- resume/focus the existing session;
- start in an isolated
-w worktree;
- continue in the shared checkout only after confirmation;
- remove a validated stale lease/process.
The lease must tolerate crashes and PID reuse: validate process start time/identity, clear cleanly on exit, and treat unverifiable records as stale rather than blindly signaling a PID.
Acceptance cases
- second root launch in the same canonical worktree warns before agent execution;
- symlinked paths and subdirectories of the same Git worktree resolve to one identity;
- separate Git worktrees do not conflict;
- stale lease after a crash is detected safely;
- PID reuse cannot cause an unrelated process to be treated as an owner;
- explicit shared-mode continuation remains possible but visibly marked in both sessions.
Problem
Graff allows multiple independent root sessions to run in the exact same working directory without warning, ownership coordination, or status reconciliation.
A recent machine audit found three live root Graff processes with the same Lawplain cwd. Two large trajectories performed overlapping Phase 2/Phase 3 acceptance work against the same uncommitted working tree. One trajectory interpreted implementation completed by the other as unfinished inherited work and repeated audits, reviews, browser verification, and hardening. Both could also have edited the same files concurrently.
This is distinct from #114. Opt-in
-wworktree isolation exists, but it does not protect a user who accidentally starts another ordinary root session in an already-owned checkout.Risks
Proposed behavior
On root-session startup, register a machine-local lease keyed by the canonical effective worktree identity (canonical cwd plus Git common-dir/worktree metadata where available).
If another live root session already owns that worktree, show a prominent warning with:
Offer explicit choices:
-wworktree;The lease must tolerate crashes and PID reuse: validate process start time/identity, clear cleanly on exit, and treat unverifiable records as stale rather than blindly signaling a PID.
Acceptance cases