Skip to content

plugin: mark a folded session on its current document, not the fold's first read - #331

Open
Saksham Uboweja (SakshamUboweja) wants to merge 2 commits into
microsoft:mainfrom
SakshamUboweja:pipeline/fix-E041
Open

Saksham Uboweja (SakshamUboweja) wants to merge 2 commits into
microsoft:mainfrom
SakshamUboweja:pipeline/fix-E041

Conversation

@SakshamUboweja

Copy link
Copy Markdown
Collaborator

When a session is resumed while its previous run is still being folded, the fold could overwrite what the resumed session had just saved.

  • Before: the fold read the session file at the start and wrote that old copy back at the end. If claude -p --resume ran in between, the loop guard's open turn and source=resume were lost.
  • After: the fold marks the session as folded on the file as it is at the end, so nothing written in between is lost.
  • Unchanged: sessions that are not resumed mid-fold behave exactly as before.

Test: tests/test_live_hooks.py::test_a_session_resumed_while_its_fold_runs_keeps_what_its_hooks_wrote fails on main and passes with this change. Full suite passes.

… first read

fold_locked read sessions/<id>.json when it started and wrote that copy back
with folded=true when it ended, seconds later when the proposer ran. A
session resumed with the same id in between (claude -p --resume right
after the first run) lost what its hooks wrote meanwhile: the loop guard's
open turn and its calls, and source=resume. The flag is now set on the
document as it is at the end of the fold.
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.

2 participants