DavertMik ยท GitHub

DavertMik @claude

Every pause() call registered two permanent listeners on the global event
dispatcher (step.after, test.finished) and never removed them. Repeated
pauses โ€” now the normal case because the MCP server drives pause()
programmatically via setPauseHandler/pauseNow โ€” accumulated listeners, fired
finish() multiple times, and ran an unconditional recorder.session.restore('pause')
on every test finish even when no pause session was open, unbalancing the
recorder's session stack (the hang class blocking 4.0).
- Convert the two anonymous listeners into named handlers (onStepAfter,
  onTestFinished) and register them through an idempotent helper that removes
  any prior registration first, so repeated pause()/pauseNow() keep exactly
  one of each. onTestFinished removes both listeners when the test finishes.
- Track an open-pause flag and only restore the 'pause' session when one is
  actually open (set on session.start in pauseSession, cleared at all three
  restore sites).
- pauseNow now performs the same idempotent registration as pause().
setPauseHandler/pauseNow signatures and resolve semantics are unchanged
(bin/mcp-server.js untouched). 4 regression tests cover idempotent
registration, listener removal on finish, the no-double-restore guard, and the
MCP pauseNow lifecycle; reverting the fix fails the listener tests.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Read the original on github.com โ†—