Skip to content

fix: release stranded bootstrap locks and handle re-entrant reacquire (#1351)#1352

Merged
glittercowboy merged 1 commit intogsd-build:mainfrom
dpearson2699:fix/session-lock-bootstrap-reentry
Mar 19, 2026
Merged

fix: release stranded bootstrap locks and handle re-entrant reacquire (#1351)#1352
glittercowboy merged 1 commit intogsd-build:mainfrom
dpearson2699:fix/session-lock-bootstrap-reentry

Conversation

@dpearson2699
Copy link
Contributor

@dpearson2699 dpearson2699 commented Mar 19, 2026

Summary

  • Release session lock on bootstrap failure paths so it doesn't strand after guided-flow aborts
  • Handle re-entrant acquireSessionLock() by releasing the old proper-lockfile handle first, preventing stale onCompromised callbacks from poisoning the new lock
  • Reset _lockCompromised on retry acquire path for belt-and-suspenders safety
  • Wrap post-acquire bootstrap body in try/catch to release the lock on unexpected errors

Test plan

  • session-lock-regression.test.ts — all 10 tests pass (2 new: re-entrant acquire, re-entrant artifact refresh)
  • auto-lock-creation.test.ts — all 12 tests pass (1 new: bootstrap cleanup releases artifacts)
  • session-lock.test.ts — all 23 existing tests pass
  • Manual: fresh repo /gsd → abort discussion → /gsd auto → starts cleanly without "Session lock lost"

Closes #1351

Release session locks on bootstrap abort paths and reset same-process lock state before re-acquiring so stale proper-lockfile callbacks cannot poison a fresh auto-mode session. Adds regression coverage for bootstrap cleanup and re-entrant lock acquisition.
@trek-e
Copy link
Collaborator

trek-e commented Mar 19, 2026

Heads up — potential merge conflict: PR #1367 also modifies auto-start.ts and session-lock.ts with fixes for #1348 (recursive dialog loop + retry lock onCompromised handler). Please coordinate before merging to avoid conflicts.

@dpearson2699
Copy link
Contributor Author

@trek-e as of right now my pr has no merge conflicts with main. if you merge yours in first then I'll fix the merge conflicts

@glittercowboy glittercowboy merged commit b1c6556 into gsd-build:main Mar 19, 2026
4 checks passed
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.

Session lock strands on bootstrap abort and re-entrant reacquire

3 participants