Skip to content

fix(resume): isolate resume store keys by cwd hash to prevent cross-session contamination - #103

Open
wiliancolomboo-tech wants to merge 1 commit into
getpipher:mainfrom
wiliancolomboo-tech:fix/cross-session-resume-isolation
Open

wiliancolomboo-tech wants to merge 1 commit into
getpipher:mainfrom
wiliancolomboo-tech:fix/cross-session-resume-isolation

Conversation

@wiliancolomboo-tech

Copy link
Copy Markdown

Resolves #102

Summary

When multiple parent sessions or parallel worktrees run in different working directories, subagents sharing the same sessionKey (such as the default general-purpose) collided in the global resume cache (~/.pi/agent/cache/fleet-resume/<backendId>.json). This caused child subagents in one directory to resume and poll transcripts from a completely different repository/session.

Solution

  • Scoped session resumption keys with a 12-char SHA-256 hash of the working directory (${cwdHash}:${sessionKey}) when a cwd (or default cwd) is provided.
  • Maintained backward compatibility if no cwd is passed.
  • Added comprehensive unit tests in test/resume-store.test.mts validating cwd isolation.

🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 5 noreply@anthropic.com

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.

Cross-session result contamination: concurrent dispatches deliver foreign partial results to the wrong parent session

1 participant