Skip to content

fix(chat): New chat always creates, on the current branch - #5231

Merged
guitavano merged 1 commit into
mainfrom
fix/new-chat-branch-heuristics
Jul 25, 2026
Merged

fix(chat): New chat always creates, on the current branch#5231
guitavano merged 1 commit into
mainfrom
fix/new-chat-branch-heuristics

Conversation

@tlgimenes

@tlgimenes tlgimenes commented Jul 24, 2026

Copy link
Copy Markdown
Contributor
Google.Chrome.mp4

New-chat behavior fixes (split out of #5215).

  • Always creates. The New chat button now creates a fresh thread every click — removed the empty-chat reuse short-circuit from both entry points (header NewChatCrumb + sidebar handleNewThread); it no longer navigates to / reuses an existing empty "New chat". Dropped the now-dead isThreadEmpty helper + its MCP client.
  • Inherits the current branch. The new thread lands on the branch/sandbox you're viewing instead of the hardcoded staging default — createNewTask threads the branch through (panel-actions + keyboard-shortcut paths). No backend change (the wire schema already accepts branch). "Open agent X" flows are untouched.

tsc + oxlint clean.

🤖 Generated with Claude Code


Summary by cubic

New Chat now always creates a new thread and inherits the branch you're viewing, so it opens in the same sandbox.

  • Bug Fixes
    • Removed empty-chat reuse in header and sidebar; every click creates a new thread.
    • Threaded branch into createNewTask (panel actions + keyboard path); server default applies when absent.
    • Deleted isThreadEmpty and its MCP client.
    • "Open agent X" flows unchanged; no backend changes.

Written for commit 5cfd180. Summary will update on new commits.

Review in cubic

Two fixes to the New chat button:
- It ALWAYS creates a fresh thread (removed the empty-chat reuse short-circuit
  from both entry points — header NewChatCrumb + sidebar handleNewThread); it no
  longer navigates to / reuses an existing empty "New chat". (Dropped the dead
  isThreadEmpty helper + its MCP client.)
- The new thread inherits the branch/sandbox being viewed instead of the
  hardcoded staging default: createNewTask threads the branch through
  (panel-actions + keyboard paths). No backend change — the wire schema already
  accepts `branch`. "Open agent X" flows are untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@guitavano
guitavano merged commit dcb006f into main Jul 25, 2026
14 checks passed
@guitavano
guitavano deleted the fix/new-chat-branch-heuristics branch July 25, 2026 12:13
decocms Bot pushed a commit that referenced this pull request Jul 25, 2026
PR: #5231 fix(chat): New chat always creates, on the current branch
Bump type: patch

- decocms (apps/api/package.json): 4.126.3 -> 4.126.4

Deploy-Scope: web
pedrofrxncx pushed a commit that referenced this pull request Jul 27, 2026
Resolved 3 conflicts toward main's post-branch work:
- use-layout-state.ts / shell-layout.tsx: keep #5231's caller-passed
  `branch` param over the branch's parallel readCachedTaskBranch path.
  main's callers already omit the branch on agent-switch, which is the
  same guarantee the branch's carryBranch gate provided.
- connection-tools.integration.test.ts: keep userModelPreferences stub,
  drop agentSandboxSessions (storage class removed by the revert).
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