Skip to content

handle all session conflict scenarios inside claude and giving instructions#69

Merged
khaong merged 4 commits intomainfrom
soph/align-all-multi-session-issues
Jan 23, 2026
Merged

handle all session conflict scenarios inside claude and giving instructions#69
khaong merged 4 commits intomainfrom
soph/align-all-multi-session-issues

Conversation

@Soph
Copy link
Collaborator

@Soph Soph commented Jan 20, 2026

We had this implemented for when you run two parallel claude code sessions (without closing the first one first) but there are two more scenarios where this is needed:

  • manual-commit is active: when you have a first session which causes changes, close it and start another one without committing the changes we properly warn you now inside the claude code session and give instructions
  • worktree is active: if you have two worktree folders and both start changes from the same sha commits would go on the same shared branch (this is actually not unlikely...)

Should fix: https://linear.app/entirehq/issue/ENT-102/error-when-exiting-plan-mode

@Soph Soph requested a review from a team as a code owner January 20, 2026 10:08
Copilot AI review requested due to automatic review settings January 20, 2026 10:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request improves session conflict handling in Claude Code by displaying user-friendly blocking messages instead of returning errors. The changes ensure that when session conflicts occur (from parallel sessions, uncommitted changes, or cross-worktree scenarios), users receive clear instructions within the Claude interface rather than encountering error states.

Changes:

  • Modified conflict handlers to output blocking JSON responses with actionable guidance
  • Updated test infrastructure to verify blocking behavior via parsed hook responses
  • Refined conflict detection tests to validate new response format

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
cmd/entire/cli/integration_test/session_conflict_test.go Updated test to verify blocking JSON response for session conflicts; removed formatting whitespace
cmd/entire/cli/integration_test/hooks.go Added HookResponse struct and SimulateUserPromptSubmitWithResponse method to support testing blocking hook behavior
cmd/entire/cli/hooks_claudecode_handlers.go Changed shadow branch and session ID conflict handlers to output blocking JSON responses instead of returning errors, with cleaner message formatting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@khaong
Copy link
Contributor

khaong commented Jan 22, 2026

we may want to consider our shadow branch naming to include either branch or cwd hints, and/or using our other session state/metadata to reference it to avoid the worktree problem?

@Soph
Copy link
Collaborator Author

Soph commented Jan 22, 2026

yeah agree, but this is just fixing that it's at least not throwing an error in the face of the user. Let's handle in another PR?

@khaong khaong merged commit 89b210f into main Jan 23, 2026
3 checks passed
@khaong khaong deleted the soph/align-all-multi-session-issues branch January 23, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants