Skip to content

fix(agents): open a shell, not an unrequested chat, in empty workspaces when the default agent is Auto - #36927

Merged
AmoabaKelvin merged 2 commits into
mainfrom
auto-default-unrequested-chat-36594
Nov 1, 2026
Merged

AmoabaKelvin merged 2 commits into
mainfrom
auto-default-unrequested-chat-36594

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​11 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​11
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​28 $\color{#cf222e}{\Huge{\mathbf{−}}}$​22 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​6

ELI5

If you never picked a default agent (Settings still says Auto), opening an empty workspace started a Claude chat on its own. Claude just happens to be first in Orca's agent list. Now an empty workspace opens a plain shell until you save a default agent. A saved agent, or a saved Blank Terminal, works the same as before.

What Changed

  • Before: with chat mode on and the default agent on Auto (defaultTuiAgent: null), opening a workspace with no tabs ran openDefaultAgentChatInEmptyWorkspace. It handed null to pickTuiAgent, which falls back to the first detected agent in TUI_AGENT_AUTO_PICK_ORDER, so you got Claude.
  • After: defaultChatHost (renamed from defaultChatDetectionTarget) only returns a host when a real agent is saved as the default. Auto and Blank Terminal return nothing, and all three exports share that answer:
    • openDefaultAgentChatInEmptyWorkspace returns null, and the seeding step opens its usual shell.
    • emptyWorkspaceDefaultChatAwaitsDetection and loadEmptyWorkspaceDefaultChatDetection stop holding the workspace for up to 5 s while agent detection runs, since nothing can open anyway.
  • The default and disabled agents now come from the workspace owner's launch preferences (readAgentLaunchPreferencesForWorktree), not the desktop's own settings. The tab-bar shortcuts and launchAgentInNewTab already read them this way. On a paired runtime host, "is a default saved?" now means the host's default. Local and SSH workspaces still read the desktop settings, exactly as before.

What doesn't change:

Why

This empty-workspace path is the only place Orca starts an agent without a click. #23693 made it opt-in so it couldn't start an unrequested agent, but Auto slipped through: an unset default was read as a request for the first agent in the catalog. The onboarding folder path (onboardingFolderDefaultAgent) already treats an unset default as "no agent", and this brings the empty-workspace path into line with it.

Alternatives I ruled out:

Linked Issue

Fixes #36594

Visual Proof

Default agent left on Auto, chat mode on, Claude and Codex both installed. A new workspace is created and opened from the sidebar. Hidden dev build on macOS.

Before (main): a Claude Chat tab opens without being asked for.
orca-36594-before.png

After: the workspace opens a plain shell.
orca-36594-after.png

Testing

  • Reproduced on main in a hidden dev build: Auto plus chat mode opened a Claude Chat tab in a new empty workspace. On this branch the same steps open a shell. Saving Codex as the default and opening another new workspace still opens a Codex Chat tab.

  • Two regression assertions in empty-workspace-default-agent-chat.test.ts: Auto launches nothing (any launch fails, not only Claude), and Auto doesn't wait on an unloaded SSH host's agent list. Both failed on main and pass with the fix.

  • pnpm test on empty-workspace-default-agent-chat.test.ts and worktree-activation-default-agent-chat.test.ts (21/21), check:code-quality:changed, check:react-doctor:changed, oxlint, oxfmt.

  • macOS only. Linux, Windows and a real SSH or paired host weren't run by hand. The SSH wait is covered by the unit test.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Mobile: checked, and it never launches an agent without a tap. Both create-workspace pickers on the phone (tasks drawer and New Workspace) show the preselected agent, and the user taps Create. They give the same answer as the desktop New Workspace composer, so mobile code is unchanged.
  • Remote: nothing on the wire changes and no setting is migrated, so mixed client and host versions are unaffected. Paired runtime hosts now use the host's own saved default for this decision. If the host's preferences aren't cached yet, it falls back to the desktop's.
  • Folder workspaces and SSH go through the same gate as before.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d0f41d86-632f-4328-8d86-e67b582432ce
Commits

Reviewing files that changed from the base of the PR and between e2945a9 and b4b74bf.

Files selected for processing: 1
  • src/renderer/src/lib/empty-workspace-default-agent-chat.ts
Files skipped from review as they are similar to previous changes: 1
  • src/renderer/src/lib/empty-workspace-default-agent-chat.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

Walkthrough

Default-agent chat detection and launch now read per-worktree preferences instead of global settings. A chat host requires a saved, non-blank default agent, enabled chat launches, and a resolved detection target. Without a host, detection waiting returns false, detection loading stops, and opening the chat returns null. Tests cover the unset-default case for detection waiting and agent launch.

Severity of issue fixed: Medium

Merge Risk: Moderate · up to b4b74

A new paired-host workspace can open the wrong default tab when its launch preferences have not loaded. Resolve those preferences before seeding the workspace.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title names the main change: empty workspaces with an Auto default agent now open a shell instead of an unrequested chat. The raw summary confirms the code change matches this. The title is specif…
Description check Passed The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue (Fixes #36594), Visual Proof with before and after images, Testing, AI Disclosure, Review, Agent s…
Linked Issues check Passed The changes satisfy the coding requirements in #36594. defaultChatHost returns no host for Auto or Blank Terminal, so empty workspaces do not launch an agent without an explicit saved default. A sav…
Out of Scope Changes check Passed The changes stay within #36594. The production edits limit empty-workspace default-chat selection, worktree launch preferences, and related host detection. The test edits cover the changed Auto and un…
Full details: Title check

Explanation

The title names the main change: empty workspaces with an Auto default agent now open a shell instead of an unrequested chat. The raw summary confirms the code change matches this. The title is specific and accurate, though long at 102 characters.

Full details: Description check

Explanation

The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue (Fixes #36594), Visual Proof with before and after images, Testing, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections. The before and after is clear, the mechanism is explained, and alternatives are covered. Minor gaps: the AI Disclosure and Review sections are empty headings, and the final checklist item (lint, typecheck, test, build) is unchecked. The template asks for these, but they are non-critical.

Full details: Linked Issues check

Explanation

The changes satisfy the coding requirements in #36594. defaultChatHost returns no host for Auto or Blank Terminal, so empty workspaces do not launch an agent without an explicit saved default. A saved agent still uses the worktree owner preferences, detected agents, and disabled agents. The added tests cover no launch for Auto and no wait for unresolved SSH detection. The supplied evidence reports preserved explicit-agent, existing-tab, folder-workspace, and mobile user-initiated behavior.

Full details: Out of Scope Changes check

Explanation

The changes stay within #36594. The production edits limit empty-workspace default-chat selection, worktree launch preferences, and related host detection. The test edits cover the changed Auto and unresolved-host behavior. No unrelated product behavior or files are identified.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 2 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b7082d9a-c963-46ea-a3d7-5d96799d1e9b
Commits

Reviewing files that changed from the base of the PR and between 5eac01e and e2945a9.

Files selected for processing: 2
  • src/renderer/src/lib/empty-workspace-default-agent-chat.test.ts
  • src/renderer/src/lib/empty-workspace-default-agent-chat.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@AmoabaKelvin
AmoabaKelvin merged commit 2e16a24 into main Nov 1, 2026
42 checks passed
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.

[Bug]: Auto default can open an unrequested Claude chat in an empty workspace

1 participant