Skip to content

feat(settings): make automatic terminal creation optional - #9960

Open
yiuf63 wants to merge 3 commits into
stablyai:mainfrom
yiuf63:feat/workspace-terminal-auto-create-setting
Open

yiuf63 wants to merge 3 commits into
stablyai:mainfrom
yiuf63:feat/workspace-terminal-auto-create-setting

Conversation

@yiuf63

@yiuf63 yiuf63 commented Jul 22, 2026 •

Copy link
Copy Markdown

Summary

  • Add a setting to keep empty workspace selection from automatically creating the first terminal.
  • Preserve explicit terminal creation for startup/setup/default-tab/issue-command flows.
  • Show localized empty-state actions when automatic creation is disabled, so users can explicitly open a terminal, Markdown note, or browser.

Testing

  • pnpm run typecheck
  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal/initial-terminal.test.ts src/renderer/src/components/settings/GeneralWorkspaceSettingsSection.test.tsx src/renderer/src/lib/worktree-activation.test.ts src/renderer/src/lib/worktree-activation-created-agent.test.ts src/renderer/src/lib/worktree-activation-empty-remote.test.ts src/renderer/src/lib/worktree-activation-folder-workspace.test.ts
  • pnpm run verify:localization-catalog
  • pnpm run verify:localization-coverage
  • pnpm run check:max-lines-ratchet

ELI5

You can turn off automatic first-terminal creation when selecting an empty workspace. Empty workspaces show actions to open a terminal, note, or browser yourself instead of always spawning a shell.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f5d38eb8-adf9-4931-ae23-13c698aa7003

📥 Commits

Reviewing files that changed from the base of the PR and between e985d7e2cf94b420c7ff718f45e977a953f744e8 and 8910c5c.

📒 Files selected for processing (1)
  • src/renderer/src/components/Terminal.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/components/Terminal.tsx

📝 Walkthrough

Walkthrough

Adds an optional workspace setting, enabled by default, to control automatic terminal creation during workspace activation. The setting is propagated through folder, worktree, created-agent, and web-runtime wake flows. When disabled, empty workspace and tab-group views render actions for creating terminals, markdown notes, or browser tabs, with shortcut hints where available. Settings search, unit tests, activation tests, and localized UI strings are updated.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers Summary and Testing, but it omits required Screenshots, AI Review Report, Security Audit, and Notes sections. Add the missing template sections, including screenshots/no visual change, AI review report, security audit, and notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately states the main change: making automatic terminal creation optional.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

Comment @coderabbitai help to get the list of available commands.

@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.

🧹 Nitpick comments (2)
src/renderer/src/components/settings/GeneralWorkspaceSettingsSection.tsx (1)

58-87: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

New locale keys use semantic names instead of the file's hash-key convention. Both new settings entries key their translations as ...autoCreateTerminalOnWorkspaceActivation / ...Description rather than the 10-char hashes every sibling entry in these two files uses.

  • src/renderer/src/components/settings/GeneralWorkspaceSettingsSection.tsx#L58-L87: consider a hash-based key (e.g. via the bootstrap-locale-catalog flow) to match the surrounding translate('auto.components.settings.GeneralWorkspaceSettingsSection.<hash>', ...) entries in this file.
  • src/renderer/src/components/settings/general-search.ts#L38-L66: same — surrounding entries in this catalog all use hash keys (e.g. 4c95d08fa2, 141f71c69f).

Based on learnings, "use hash-based locale keys with translate('auto.components.<Dir>.<ComponentFile>.<10-char-hash>', ...)" is the established convention for settings components, while a separate learning notes semantic keys are acceptable "when they match the established neighboring namespaces" — which isn't the case in these two files (neighbors are hash-keyed). Non-blocking; flagging for consistency only.

Source: Learnings

src/renderer/src/components/tab-group/TabGroupPanel.tsx (1)

28-38: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

TabGroupEmptyState re-runs the whole workspace model hook instead of reusing the parent's commands.

TabGroupEmptyState independently calls useTabGroupWorkspaceModel({ groupId, worktreeId }) just for .commands, duplicating the same selector/memo work TabGroupPanel already did with its own model on line 145. This hook subscribes (via useShallow) to state.openFiles, a global slice, so the empty state re-renders on any file open/close app-wide, not just its own worktree — memo() doesn't prevent this since it's an internal hook-triggered re-render, not a prop change.

Pass commands down as a prop instead of calling the hook again.

♻️ Proposed fix
 const TabGroupEmptyState = memo(function TabGroupEmptyState({
   worktreeId,
-  groupId
+  groupId,
+  commands
 }: {
   worktreeId: string
   groupId: string
+  commands: ReturnType<typeof useTabGroupWorkspaceModel>['commands']
 }): React.JSX.Element {
   const newTerminalShortcut = useShortcutKeyDetails('tab.newTerminal')
   const newBrowserShortcut = useShortcutKeyDetails('tab.newBrowser')
   const newMarkdownShortcut = useShortcutKeyDetails('tab.newMarkdown')
-  const commands = useTabGroupWorkspaceModel({ groupId, worktreeId }).commands

And at the call site:

-        {activeTab === null &&
-          terminalTabs.length === 0 &&
-          editorItems.length === 0 &&
-          browserItems.length === 0 &&
-          !autoCreateTerminalOnWorkspaceActivation && (
-            <TabGroupEmptyState worktreeId={worktreeId} groupId={groupId} />
-          )}
+        {activeTab === null &&
+          terminalTabs.length === 0 &&
+          editorItems.length === 0 &&
+          browserItems.length === 0 &&
+          !autoCreateTerminalOnWorkspaceActivation && (
+            <TabGroupEmptyState worktreeId={worktreeId} groupId={groupId} commands={commands} />
+          )}

Also applies to: 145-146


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5eb3c922-952b-4a7c-83a3-fc6374bd31c2

📥 Commits

Reviewing files that changed from the base of the PR and between 6ad6241 and e985d7e2cf94b420c7ff718f45e977a953f744e8.

📒 Files selected for processing (20)
  • src/renderer/src/components/Terminal.tsx
  • src/renderer/src/components/settings/GeneralPane.test.ts
  • src/renderer/src/components/settings/GeneralWorkspaceSettingsSection.test.tsx
  • src/renderer/src/components/settings/GeneralWorkspaceSettingsSection.tsx
  • src/renderer/src/components/settings/general-search.ts
  • src/renderer/src/components/tab-group/TabGroupPanel.tsx
  • src/renderer/src/components/terminal/initial-terminal.test.ts
  • src/renderer/src/components/terminal/initial-terminal.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/worktree-activation-created-agent.test.ts
  • src/renderer/src/lib/worktree-activation-empty-remote.test.ts
  • src/renderer/src/lib/worktree-activation-folder-workspace.test.ts
  • src/renderer/src/lib/worktree-activation.test.ts
  • src/renderer/src/lib/worktree-activation.ts
  • src/shared/constants.ts
  • src/shared/types.ts

@yiuf63
yiuf63 force-pushed the feat/workspace-terminal-auto-create-setting branch from e985d7e to 8910c5c Compare July 23, 2026 06:11
@AmethystLiang
AmethystLiang requested a review from OrcaWin July 24, 2026 16:52
@nwparker nwparker added the enhancement New feature or request label Jul 27, 2026
@AmethystLiang

Copy link
Copy Markdown
Contributor

Thank you so much, @yiuf63, for the work you put into this PR. We referred to your empty-tab-group action design while comparing the community implementations with the empty-pane launch UI that has now landed in #32182. Giving people explicit terminal, document, and browser actions is valuable, and your implementation helped make that overlap clear.

I have added a named acknowledgment and a link to this PR in #32182 so your contribution is visible. One important scope distinction: #32182 adds the empty-pane actions and host-aware agent launches; it does not add your preference to disable automatic terminal creation. That broader request is still tracked in #11108.

Thank you again for contributing the implementation and tests, and for helping improve this workflow.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants