Skip to content

fix: Allow starting a new session in a project after creating one#8766

Merged
morgmart merged 1 commit into
mainfrom
cant-create-new-session-after-creating-one
Apr 23, 2026
Merged

fix: Allow starting a new session in a project after creating one#8766
morgmart merged 1 commit into
mainfrom
cant-create-new-session-after-creating-one

Conversation

@matt2e
Copy link
Copy Markdown
Collaborator

@matt2e matt2e commented Apr 23, 2026

Repro steps

  • Click on the plus button next to a project to get the new session UI
  • Send a message to start a session
  • Click on the plus button again... nothing happens

Summary

  • Fix bug where creating a new session after already having one open would reuse the existing session instead of creating a fresh one
  • isReusableDraft now checks that localMessages is empty before considering a session reusable, preventing sessions with in-progress content from being recycled
  • findExistingDraft no longer falls back to returning the active session as a candidate, ensuring a new session is always created when appropriate

Test plan

  • Added test: does not reuse active empty draft without content
  • Added test: does not reuse session with local messages even if messageCount is 0
  • Existing tests pass

🤖 Generated with Claude Code

…reuse

isReusableDraft was ignoring the localMessages parameter and only
checking messageCount, which is never updated client-side after session
creation. This caused the "+" button to no-op when clicking it a second
time on the same project, because the active session with messages was
incorrectly identified as a reusable draft.

Also stop returning empty active sessions without draft content from
findExistingDraft, since reusing them just triggers the setActiveSession
no-op on the already-active session.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@matt2e matt2e changed the title fix: check localMessages in isReusableDraft to prevent stale session reuse fix: Allow starting a new session in a project after creating one Apr 23, 2026
@morgmart morgmart added this pull request to the merge queue Apr 23, 2026
Merged via the queue into main with commit 18127f1 Apr 23, 2026
22 of 23 checks passed
@morgmart morgmart deleted the cant-create-new-session-after-creating-one branch April 23, 2026 12:22
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