-
Notifications
You must be signed in to change notification settings - Fork 125
alternative way to handle multi session conflict flow #138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alternative way to handle multi session conflict flow #138
Conversation
There was a problem hiding this 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 refactors the session conflict warning system by moving the detection from the user-prompt-submit hook to the session-start hook, resulting in a better user experience.
Changes:
- Moved session conflict detection to session-start hook, showing the warning once at session start instead of repeatedly on every prompt
- Removed the
ConcurrentWarningShownfield from session state, as the warning is now shown once and doesn't need to be tracked - Redesigned the warning message to be more user-friendly with clear actionable guidance
- Renamed
SessionMetadataDirFromEntireIDtoSessionMetadataDirFromSessionIDto reflect the direct use of session IDs
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/entire/cli/strategy/manual_commit_types.go | Removed ConcurrentWarningShown field from SessionState struct |
| cmd/entire/cli/strategy/manual_commit_test.go | Updated test to remove references to removed field |
| cmd/entire/cli/strategy/manual_commit_session.go | Simplified session initialization by removing concurrent warning flag preservation |
| cmd/entire/cli/strategy/manual_commit_logs.go | Updated function call to use renamed SessionMetadataDirFromSessionID |
| cmd/entire/cli/strategy/manual_commit_hooks.go | Removed shadow branch conflict check from InitializeSession |
| cmd/entire/cli/strategy/manual_commit_git.go | Updated function call to use renamed SessionMetadataDirFromSessionID |
| cmd/entire/cli/strategy/manual_commit_condensation.go | Updated function call to use renamed SessionMetadataDirFromSessionID |
| cmd/entire/cli/strategy/manual_commit.go | Removed ConcurrentWarningShown field from state conversion functions |
| cmd/entire/cli/state.go | Updated function call to use renamed SessionMetadataDirFromSessionID |
| cmd/entire/cli/session/state.go | Removed ConcurrentWarningShown field from State struct |
| cmd/entire/cli/paths/paths.go | Renamed function from SessionMetadataDirFromEntireID to SessionMetadataDirFromSessionID |
| cmd/entire/cli/integration_test/setup_gemini_hooks_test.go | Removed test for old session-start behavior |
| cmd/entire/cli/integration_test/session_conflict_test.go | Added new test for session conflict warning message format at session-start |
| cmd/entire/cli/integration_test/rewind_test.go | Removed test for old concurrent session behavior |
| cmd/entire/cli/integration_test/hooks.go | Added SimulateSessionStartWithOutput helper for testing session-start hooks |
| cmd/entire/cli/integration_test/gemini_concurrent_session_test.go | Deleted entire file - old Gemini concurrent session tests |
| cmd/entire/cli/integration_test/concurrent_session_warning_test.go | Deleted entire file - old Claude concurrent session tests |
| cmd/entire/cli/hooks_handlers_test.go | Deleted entire file - old currentSessionIDWithFallback tests |
| cmd/entire/cli/hooks_geminicli_handlers.go | Removed checkConcurrentSessionsGemini function and simplified handlers |
| cmd/entire/cli/hooks_claudecode_handlers.go | Removed checkConcurrentSessions, currentSessionIDWithFallback, and handleSessionInitErrors functions |
| cmd/entire/cli/hooks.go | Added handleSessionStartCommon and checkConcurrentSessions functions |
9a27c19 to
7f302c3
Compare
f092e6d to
1378ff1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Entire-Checkpoint: ec38b74f08e3
Entire-Checkpoint: 1755e38d324c
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Entire-Checkpoint: 2938d5d1ba71
Entire-Checkpoint: 2938d5d1ba71
57c8368 to
020af9f
Compare
khaong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Summary
Improves the session conflict warning experience when a second Claude Code session starts while another session has uncommitted checkpoints.
Key changes:
New Warning Format
When a user starts a new session while an existing session has uncommitted checkpoints, they now see:
Why This Matters
Previously, the conflict warning appeared at every prompt submission, which was disruptive. Moving it to session start means:
Note
Medium Risk
Behavioral change to when/how multi-session conflicts are detected and how hooks respond (new
systemMessageJSON, Gemini no longer blocks), which could affect session workflows and any tooling/tests relying on the previous prompt-blocking semantics.Overview
Moves multi-session conflict detection from per-prompt hooks to the
session-starthook via a new sharedhandleSessionStartCommon/checkConcurrentSessions, and updates the warning to a more actionable message (including resume/reset commands) with agent-specific JSON output (Claude:systemMessage; Gemini: injectssystemMessagewithout blocking).Simplifies session ID handling by removing the persisted/legacy fallback logic and standardizing metadata paths on
paths.SessionMetadataDirFromSessionID; removesConcurrentWarningShownfrom session state and deletes the prior prompt-blocking/Gemini blocking-response flow plus related integration/unit tests, replacing them with a session-start warning-format test helper.Written by Cursor Bugbot for commit 4593180. This will update automatically on new commits. Configure here.