Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe change introduces custom agent IDs and definitions, including normalization, validation, command resolution, prompt delivery, icons, and enablement state. Agent identifiers are widened across shared types, persistence, daemon, IPC, preload, runtime, terminal, worktree, automation, and renderer contracts. Workspace and terminal startup flows now forward custom-agent settings, persist custom-agent metadata, and distinguish TUI-specific behavior. The settings UI adds custom-agent creation, editing, enablement, removal, icon selection, and localization. Tests cover normalization, persistence, startup planning, workspace creation, activation, selection, and rendering. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (9)
src/renderer/src/lib/worktree-activation.ts (1)
76-87: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winAlign
queueTabStartupCommandwithAgentId
WorktreeStartupPayload.launchAgentandcreateTabalready useAgentId, butqueueTabStartupCommandstill narrows it toTuiAgent. That breaks thebuildCreatedAgentReopenStartup()path for custom agents and makes the payload contract inconsistent.src/renderer/src/lib/github-work-item-background-request.ts (1)
125-140: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick winAlign the background snapshot and return type with custom agents.
Line 140 reads
store.settings?.customAgents, butGitHubWorkItemBackgroundStoreSnapshot.settingsomitscustomAgentsfrom itsPick<GlobalSettings, ...>, producing a TypeScript error. The function also still returnsPromise<TuiAgent | null>even though custom selection can return a customAgentId.Add
customAgentsto the snapshot and change the return type/import toAgentId.Proposed contract fix
type GitHubWorkItemBackgroundStoreSnapshot = { settings: Partial<Pick<GlobalSettings, | 'activeRuntimeEnvironmentId' | 'defaultTuiAgent' | 'disabledTuiAgents' + | 'customAgents' | 'agentCmdOverrides' | 'agentDefaultArgs' | 'agentDefaultEnv' | 'terminalWindowsShell' >> } -export async function resolvePreferredQuickAgentForGitHubWorkItem(...): Promise<TuiAgent | null> { +export async function resolvePreferredQuickAgentForGitHubWorkItem(...): Promise<AgentId | null> {src/renderer/src/components/automations/AutomationsPage.tsx (1)
402-412: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winEnforce custom-agent enablement when selecting the default.
enabledAgentscorrectly excludes custom definitions withenabled: false, butdefaultAgentbypasses that list and checks onlyisTuiAgentEnabled, which does not account for the custom definition’s enabled flag. A disabled custom agent can therefore become the default for new automations and pass through the picker/save flow.Use
enabledAgents.includes(settings.defaultTuiAgent)here, and reuse the same predicate during save validation.Proposed fix
const defaultAgent = settings?.defaultTuiAgent && settings.defaultTuiAgent !== 'blank' && - isTuiAgentEnabled(settings.defaultTuiAgent, settings.disabledTuiAgents) + enabledAgents.includes(settings.defaultTuiAgent) ? settings.defaultTuiAgent : (enabledAgents[0] ?? AGENTS[0])src/main/runtime/orca-runtime.ts (1)
14220-14260: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winWiden the trust helpers to
AgentIdWorktreeStartupDraftPaste.agentandeffectiveCreatedWithAgentareAgentId, so thecreateManagedWorktree→ remote path still feeds a wider type intomarkLocalWorkspaceTrustedForAgent/markRemoteWorkspaceTrustedForAgent. WidenmarkRemoteWorkspaceTrustedForAgentandcreateManagedRemoteWorktree.createdWithAgenttoAgentId, and keep theisTuiAgentguard before touchingTUI_AGENT_CONFIG.src/renderer/src/lib/agent-launch-prompt-delivery.ts (1)
5-18: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winWiden the draft helpers to accept
AgentId
isNativeChatSupportedAgentalready accepts broader agent values, butagentDeliversDraftViaNativePrefillandpasteDraftWhenAgentReadystill narrow toTuiAgent.deliverLaunchPromptToAgentTabnow passesAgentIdthrough both, so custom-agent launches through this path will fail type-checking unless those signatures are widened or custom ids are handled separately.src/renderer/src/lib/launch-agent-web-host-tab.ts (1)
45-55: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winPass
launchAgentin the no-prompt branch
agentisAgentId, butcreateWebRuntimeSessionTerminalstill typesagent?: TuiAgent. Use the separatelaunchAgentfield here (or narrow to aTuiAgent) so custom-agent ids don’t go through the wrong contract.src/main/persistence.ts (1)
3054-3070: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winNormalize persisted agent settings on load —
load()still runsdisabledTuiAgentsthroughnormalizeDisabledTuiAgents(...), whileupdateSettings()writes them withnormalizeAgentIds(...). That strips persistedcustom:*ids on restart.customAgentsis also carried through from disk withoutnormalizeCustomAgents(...), so malformed entries can reachstore.settingsat startup. Normalize both fields inload()to match the update path.src/renderer/src/hooks/useComposerState.ts (1)
3395-3417: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
settings?.customAgentsread but not in useCallback deps forsubmitFolderTarget,submit, andsubmitQuick.All three callbacks read
settings?.customAgentsin their bodies (lines 3351, 3613, 4037, 4071) to build the launch plan/args for custom agents, but none of their dependency arrays listsettings?.customAgents. IfcustomAgentschanges without any other listed setting changing (e.g. the user edits a custom agent's command, or toggles itsenabledflag, then immediately launches), these memoized callbacks stay stale and will build the startup plan from the outdated custom-agent definitions.♻️ Proposed fix
settings?.agentCmdOverrides, settings?.agentDefaultArgs, settings?.agentDefaultEnv, settings?.autoRenameBranchFromWork, + settings?.customAgents, settings?.terminalWindowsShell,(apply the equivalent addition to the deps arrays of
submit,submitFolderTarget, andsubmitQuick)Also applies to: 3754-3810, 4217-4275
src/renderer/src/components/sidebar/folder-workspace-composer-submit.ts (1)
190-202: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
customAgentsnot forwarded tobuildFolderWorkspaceLinkedStartupPlan.The sibling branch two lines below (line 214, no linked work item) correctly passes
customAgentsintobuildAgentStartupPlan, but this branch — used whenever there's both aquickAgentand alinkedWorkItem— omits it entirely from the call tobuildFolderWorkspaceLinkedStartupPlan. Since that function's own signature (line 71-81) accepts and forwardscustomAgentsto its internalbuildAgentDraftLaunchPlan/buildAgentStartupPlancalls, launching a custom agent for a folder workspace that also has a linked work item will build the startup command withcustomAgents === undefined, breaking resolution of the custom agent's launch command for this common combined flow.🐛 Proposed fix
const startupPlan = quickAgent && linkedWorkItem ? buildFolderWorkspaceLinkedStartupPlan({ agent: quickAgent, linkedWorkItem, note, agentCmdOverrides, agentArgs, agentEnv, platform: launchPlatform, shell: launchShell, - isRemote: launchIsRemote + isRemote: launchIsRemote, + customAgents })
🧹 Nitpick comments (4)
src/shared/tui-agent-startup.ts (1)
83-90: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicated synthetic
TuiAgentConfigconstruction for custom agents.
buildAgentStartupPlanandbuildAgentDraftLaunchPlaneach inline a near-identical syntheticTuiAgentConfigfor custom agents. Extracting a shared helper (e.g.buildCustomAgentTuiConfig(agent, customAgent)) would remove the duplication and reduce the chance the two copies drift (as already happened with theexpectedProcessissue above).♻️ Suggested extraction
function buildCustomAgentTuiConfig( agent: AgentId, customAgent: CustomAgentDefinition | undefined, promptInjectionMode: AgentPromptInjectionMode = 'stdin-after-start' ): TuiAgentConfig { return { detectCmd: '', launchCmd: '', expectedProcess: agent, promptInjectionMode: customAgent?.promptMode === 'argv' ? 'argv' : promptInjectionMode } }Also applies to: 296-298
src/renderer/src/components/settings/AgentsPane.tsx (1)
849-855: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider extracting the custom-agent row/pill rendering.
The default-agent-pill loop for custom agents (849-855) and the custom-agent list row (996-1013) duplicate patterns already used for native agents elsewhere in this file. Extracting a small
CustomAgentPill/CustomAgentRowhelper would keepAgentsPane(already ~1040 lines) more manageable as more agent-related UI gets added here.Also applies to: 988-1029
src/main/ipc/worktree-remote.ts (1)
297-306: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low value
launchAgentforwarded withoutisAgentIdvalidation, unlike the siblingcreatedWithAgentmetadata writes.const terminal = await runtime.createTerminal(
id:${worktree.id}, { command: sequencedStartup.command, ...(setup ? { claudeAgentTeamsSourceCommand: startup.command } : {}), env: sequencedStartup.env, ...(sequencedStartup.launchConfig ? { launchConfig: sequencedStartup.launchConfig } : {}), ...(createdWithAgent ? { launchAgent: createdWithAgent } : {}), only checks truthiness, whereas the same file's metadata persistence paths guard withisAgentId(args.createdWithAgent)before use (lines ~1896, ~2526). SincecreatedWithAgentultimately originates from an IPC-suppliedCreateWorktreeArgs, this is an inconsistent trust boundary — a malformed value would still reachruntime.createTerminal'slaunchAgentoption even though it would be rejected everywhere else in the same function/file.Consider guarding this spot with
isAgentId(createdWithAgent)too, for consistency and defense-in-depth.src/shared/tui-agent-selection.ts (1)
76-79: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win
isTuiAgentEnabledsilently no-ops for custom agents.For any
AgentIdthat isn't aTuiAgent(i.e. every custom agent), this returnstrueunconditionally — it never checks the custom agent's ownenabledflag. Every current caller compensates by separately checkingisCustomAgentId(...) && customAgentForId(...)?.enabled === true, but the function name/signature (agent: AgentId) invites future callers to treat it as the complete "is this agent usable" gate, which would let disabled custom agents slip through (e.g.useComposerState.ts'ssubmitFolderTarget/submitQuickrely on it as the only guard before acceptingrequestedAgent, and only stay safe because upstream selection already filtered custom agents).Consider either keeping this
TuiAgent-only (reverting theAgentIdwidening and pushing the union handling to call sites that already do the compound check) or folding the custom-agentenabledcheck into this function so it's a complete guard forAgentId.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: ea019f73-52c0-41d4-a447-c1be8392052f
📒 Files selected for processing (50)
src/main/daemon/daemon-server.tssrc/main/daemon/session.tssrc/main/daemon/terminal-host-create-contract.tssrc/main/daemon/types.tssrc/main/ipc/pty.tssrc/main/ipc/repos.tssrc/main/ipc/worktree-remote.tssrc/main/persistence.tssrc/main/providers/types.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/automations.tssrc/main/runtime/rpc/methods/client-ui-schemas.tssrc/main/runtime/rpc/methods/folder-workspace.tssrc/main/runtime/rpc/methods/terminal.tssrc/renderer/src/components/NewWorkspaceComposerCard.tsxsrc/renderer/src/components/NewWorkspaceComposerModal.tsxsrc/renderer/src/components/agent/AgentCombobox.tsxsrc/renderer/src/components/automations/AutomationDetail.tsxsrc/renderer/src/components/automations/AutomationEditorDialog.tsxsrc/renderer/src/components/automations/AutomationsPage.tsxsrc/renderer/src/components/automations/automation-templates.tssrc/renderer/src/components/settings/AgentsPane.tsxsrc/renderer/src/components/settings/CustomAgentDialog.tsxsrc/renderer/src/components/sidebar/folder-workspace-composer-submit.tssrc/renderer/src/components/tab-bar/QuickLaunchButton.tsxsrc/renderer/src/components/terminal-pane/pty-connection-types.tssrc/renderer/src/components/terminal-pane/pty-transport-types.tssrc/renderer/src/components/terminal-pane/pty-transport.tssrc/renderer/src/components/ui/textarea.tsxsrc/renderer/src/hooks/useComposerState.tssrc/renderer/src/lib/agent-catalog.tsxsrc/renderer/src/lib/agent-launch-prompt-delivery.tssrc/renderer/src/lib/github-work-item-background-request.tssrc/renderer/src/lib/launch-agent-in-new-tab.tssrc/renderer/src/lib/launch-agent-web-host-tab.tssrc/renderer/src/lib/quick-workspace-agent-selection.test.tssrc/renderer/src/lib/quick-workspace-agent-selection.tssrc/renderer/src/lib/worktree-activation.tssrc/renderer/src/runtime/web-runtime-session.tssrc/shared/automations-types.tssrc/shared/commit-message-agent-spec.tssrc/shared/constants.tssrc/shared/custom-agent-startup.test.tssrc/shared/custom-agent.test.tssrc/shared/custom-agent.tssrc/shared/folder-workspaces.tssrc/shared/runtime-types.tssrc/shared/tui-agent-selection.tssrc/shared/tui-agent-startup.tssrc/shared/types.ts
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
src/renderer/src/lib/agent-native-draft-prefill.ts (1)
1-3: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMerge duplicate named imports from the same module. Both files import
TUI_AGENT_CONFIGandisTuiAgentvia two separate statements from../../../shared/tui-agent-config; combine each pair into a single import statement.
src/renderer/src/lib/agent-native-draft-prefill.ts#L1-L3: combineimport { TUI_AGENT_CONFIG, isTuiAgent } from '../../../shared/tui-agent-config'.src/renderer/src/lib/agent-paste-draft.ts#L1-L3: combineimport { TUI_AGENT_CONFIG, isTuiAgent } from '../../../shared/tui-agent-config'.src/main/runtime/orca-runtime.ts (1)
14750-14752: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCustom-agent
createdWithAgentis silently dropped for worktree metadata.These sites gate
createdWithAgentonisTuiAgent(...), so worktrees created with a custom agent never persistcreatedWithAgentinWorktreeMeta/remote-create args. If this is intentional (metadata field stays native-only for now), consider a brief comment noting why, since it's easy to mistake for an oversight during future maintenance.Also applies to: 14845-14847, 15331-15333, 15709-15711
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: b6bea097-5d35-4f6a-9554-525c23352d0f
📒 Files selected for processing (78)
src/main/codex-accounts/runtime-home-service.test.tssrc/main/codex-accounts/service.test.tssrc/main/daemon/types.tssrc/main/ipc/pty.tssrc/main/ipc/worktree-remote.tssrc/main/ipc/worktrees.tssrc/main/runtime/orca-runtime.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/NewWorkspaceComposerModal.tsxsrc/renderer/src/components/Terminal.tsxsrc/renderer/src/components/agent/AgentCombobox.tsxsrc/renderer/src/components/automations/AutomationEditorDialog.tsxsrc/renderer/src/components/automations/AutomationsPage.tsxsrc/renderer/src/components/feature-wall/FeatureWallSetupChecklist.tsxsrc/renderer/src/components/floating-terminal/FloatingTerminalWindowControls.tsxsrc/renderer/src/components/native-chat/use-native-chat-toggle-shortcut.tssrc/renderer/src/components/onboarding/onboarding-settings-hydration.tssrc/renderer/src/components/onboarding/use-onboarding-flow.tssrc/renderer/src/components/right-sidebar/SourceControl.tsxsrc/renderer/src/components/right-sidebar/SourceControlAgentActionDialogForm.tsxsrc/renderer/src/components/right-sidebar/source-control-agent-action-dialog-support.tssrc/renderer/src/components/right-sidebar/useSourceControlAgentActionDialog.tssrc/renderer/src/components/settings/CustomAgentDialog.tsxsrc/renderer/src/components/settings/RepositorySourceControlAiSection.tsxsrc/renderer/src/components/settings/SourceControlActionRecipeRow.tsxsrc/renderer/src/components/settings/shortcut-groups.tssrc/renderer/src/components/sidebar/folder-workspace-composer-submit.tssrc/renderer/src/components/tab-bar/QuickLaunchButton.tsxsrc/renderer/src/components/tab-bar/TabBar.tsxsrc/renderer/src/components/tab-bar/tab-agent-launch-options.tssrc/renderer/src/components/terminal-pane/TerminalPane.tsxsrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-transport.tssrc/renderer/src/components/terminal-pane/terminal-keyboard-protocol-pane-agent.tssrc/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.tssrc/renderer/src/components/terminal-quick-commands/terminal-quick-command-agent-options.tssrc/renderer/src/hooks/useAutomationDispatchEvents.tssrc/renderer/src/hooks/useComposerState.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/agent-background-session-contract.tssrc/renderer/src/lib/agent-background-session-timeout-toast.tssrc/renderer/src/lib/agent-catalog.tsxsrc/renderer/src/lib/agent-native-draft-prefill.tssrc/renderer/src/lib/agent-paste-draft.tssrc/renderer/src/lib/agent-tab-shortcuts.tssrc/renderer/src/lib/github-work-item-background-request.tssrc/renderer/src/lib/launch-agent-background-session.tssrc/renderer/src/lib/launch-work-item-direct-agent.tssrc/renderer/src/lib/launch-work-item-direct.tssrc/renderer/src/lib/native-chat-initial-view-mode.tssrc/renderer/src/lib/native-chat-launch-prompt.tssrc/renderer/src/lib/native-chat-supported-agent.tssrc/renderer/src/lib/onboarding-folder-agent-startup.tssrc/renderer/src/lib/pending-worktree-creation.tssrc/renderer/src/lib/source-control-agent-action-plan.tssrc/renderer/src/lib/source-control-launch-agent-selection.tssrc/renderer/src/lib/use-tab-agent.tssrc/renderer/src/lib/worktree-activation.tssrc/renderer/src/lib/worktree-creation-flow.tssrc/renderer/src/runtime/web-runtime-session.tssrc/renderer/src/runtime/web-session-tabs-sync.tssrc/renderer/src/store/slices/tabs.tssrc/renderer/src/store/slices/terminals.tssrc/renderer/src/store/slices/worktree-helpers.tssrc/shared/automations-types.tssrc/shared/custom-agent.tssrc/shared/folder-workspace-worktree.tssrc/shared/runtime-types.tssrc/shared/tui-agent-launch-defaults.tssrc/shared/tui-agent-resume-startup.tssrc/shared/tui-agent-selection.tssrc/shared/tui-agent-startup.tssrc/shared/types.ts
💤 Files with no reviewable changes (4)
- src/main/daemon/types.ts
- src/shared/runtime-types.ts
- src/renderer/src/components/automations/AutomationEditorDialog.tsx
- src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
🚧 Files skipped from review as they are similar to previous changes (13)
- src/renderer/src/runtime/web-runtime-session.ts
- src/renderer/src/components/NewWorkspaceComposerModal.tsx
- src/shared/automations-types.ts
- src/main/ipc/pty.ts
- src/renderer/src/components/terminal-pane/pty-transport.ts
- src/renderer/src/lib/worktree-activation.ts
- src/renderer/src/components/agent/AgentCombobox.tsx
- src/renderer/src/lib/agent-catalog.tsx
- src/shared/types.ts
- src/renderer/src/components/automations/AutomationsPage.tsx
- src/shared/custom-agent.ts
- src/renderer/src/components/settings/CustomAgentDialog.tsx
- src/renderer/src/components/sidebar/folder-workspace-composer-submit.ts
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 2
🧹 Nitpick comments (2)
src/renderer/src/lib/agent-native-draft-prefill.ts (1)
1-3: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMerge duplicate named imports from the same module. Both files import
TUI_AGENT_CONFIGandisTuiAgentvia two separate statements from../../../shared/tui-agent-config; combine each pair into a single import statement.
src/renderer/src/lib/agent-native-draft-prefill.ts#L1-L3: combineimport { TUI_AGENT_CONFIG, isTuiAgent } from '../../../shared/tui-agent-config'.src/renderer/src/lib/agent-paste-draft.ts#L1-L3: combineimport { TUI_AGENT_CONFIG, isTuiAgent } from '../../../shared/tui-agent-config'.src/main/runtime/orca-runtime.ts (1)
14750-14752: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCustom-agent
createdWithAgentis silently dropped for worktree metadata.These sites gate
createdWithAgentonisTuiAgent(...), so worktrees created with a custom agent never persistcreatedWithAgentinWorktreeMeta/remote-create args. If this is intentional (metadata field stays native-only for now), consider a brief comment noting why, since it's easy to mistake for an oversight during future maintenance.Also applies to: 14845-14847, 15331-15333, 15709-15711
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: b6bea097-5d35-4f6a-9554-525c23352d0f
📒 Files selected for processing (78)
src/main/codex-accounts/runtime-home-service.test.tssrc/main/codex-accounts/service.test.tssrc/main/daemon/types.tssrc/main/ipc/pty.tssrc/main/ipc/worktree-remote.tssrc/main/ipc/worktrees.tssrc/main/runtime/orca-runtime.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/NewWorkspaceComposerModal.tsxsrc/renderer/src/components/Terminal.tsxsrc/renderer/src/components/agent/AgentCombobox.tsxsrc/renderer/src/components/automations/AutomationEditorDialog.tsxsrc/renderer/src/components/automations/AutomationsPage.tsxsrc/renderer/src/components/feature-wall/FeatureWallSetupChecklist.tsxsrc/renderer/src/components/floating-terminal/FloatingTerminalWindowControls.tsxsrc/renderer/src/components/native-chat/use-native-chat-toggle-shortcut.tssrc/renderer/src/components/onboarding/onboarding-settings-hydration.tssrc/renderer/src/components/onboarding/use-onboarding-flow.tssrc/renderer/src/components/right-sidebar/SourceControl.tsxsrc/renderer/src/components/right-sidebar/SourceControlAgentActionDialogForm.tsxsrc/renderer/src/components/right-sidebar/source-control-agent-action-dialog-support.tssrc/renderer/src/components/right-sidebar/useSourceControlAgentActionDialog.tssrc/renderer/src/components/settings/CustomAgentDialog.tsxsrc/renderer/src/components/settings/RepositorySourceControlAiSection.tsxsrc/renderer/src/components/settings/SourceControlActionRecipeRow.tsxsrc/renderer/src/components/settings/shortcut-groups.tssrc/renderer/src/components/sidebar/folder-workspace-composer-submit.tssrc/renderer/src/components/tab-bar/QuickLaunchButton.tsxsrc/renderer/src/components/tab-bar/TabBar.tsxsrc/renderer/src/components/tab-bar/tab-agent-launch-options.tssrc/renderer/src/components/terminal-pane/TerminalPane.tsxsrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-transport.tssrc/renderer/src/components/terminal-pane/terminal-keyboard-protocol-pane-agent.tssrc/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.tssrc/renderer/src/components/terminal-quick-commands/terminal-quick-command-agent-options.tssrc/renderer/src/hooks/useAutomationDispatchEvents.tssrc/renderer/src/hooks/useComposerState.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/agent-background-session-contract.tssrc/renderer/src/lib/agent-background-session-timeout-toast.tssrc/renderer/src/lib/agent-catalog.tsxsrc/renderer/src/lib/agent-native-draft-prefill.tssrc/renderer/src/lib/agent-paste-draft.tssrc/renderer/src/lib/agent-tab-shortcuts.tssrc/renderer/src/lib/github-work-item-background-request.tssrc/renderer/src/lib/launch-agent-background-session.tssrc/renderer/src/lib/launch-work-item-direct-agent.tssrc/renderer/src/lib/launch-work-item-direct.tssrc/renderer/src/lib/native-chat-initial-view-mode.tssrc/renderer/src/lib/native-chat-launch-prompt.tssrc/renderer/src/lib/native-chat-supported-agent.tssrc/renderer/src/lib/onboarding-folder-agent-startup.tssrc/renderer/src/lib/pending-worktree-creation.tssrc/renderer/src/lib/source-control-agent-action-plan.tssrc/renderer/src/lib/source-control-launch-agent-selection.tssrc/renderer/src/lib/use-tab-agent.tssrc/renderer/src/lib/worktree-activation.tssrc/renderer/src/lib/worktree-creation-flow.tssrc/renderer/src/runtime/web-runtime-session.tssrc/renderer/src/runtime/web-session-tabs-sync.tssrc/renderer/src/store/slices/tabs.tssrc/renderer/src/store/slices/terminals.tssrc/renderer/src/store/slices/worktree-helpers.tssrc/shared/automations-types.tssrc/shared/custom-agent.tssrc/shared/folder-workspace-worktree.tssrc/shared/runtime-types.tssrc/shared/tui-agent-launch-defaults.tssrc/shared/tui-agent-resume-startup.tssrc/shared/tui-agent-selection.tssrc/shared/tui-agent-startup.tssrc/shared/types.ts
💤 Files with no reviewable changes (4)
- src/main/daemon/types.ts
- src/shared/runtime-types.ts
- src/renderer/src/components/automations/AutomationEditorDialog.tsx
- src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
🚧 Files skipped from review as they are similar to previous changes (13)
- src/renderer/src/runtime/web-runtime-session.ts
- src/renderer/src/components/NewWorkspaceComposerModal.tsx
- src/shared/automations-types.ts
- src/main/ipc/pty.ts
- src/renderer/src/components/terminal-pane/pty-transport.ts
- src/renderer/src/lib/worktree-activation.ts
- src/renderer/src/components/agent/AgentCombobox.tsx
- src/renderer/src/lib/agent-catalog.tsx
- src/shared/types.ts
- src/renderer/src/components/automations/AutomationsPage.tsx
- src/shared/custom-agent.ts
- src/renderer/src/components/settings/CustomAgentDialog.tsx
- src/renderer/src/components/sidebar/folder-workspace-composer-submit.ts
🛑 Comments failed to post (2)
src/main/ipc/worktree-remote.ts (1)
1895-1898: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Preserve all custom
AgentIdvalues when persisting worktree metadata.Both paths use the native-only
isTuiAgentguard, so custom-agent launch identity and pending rename state are silently dropped.
src/main/ipc/worktree-remote.ts#L1895-L1898: preserve and validate customAgentIdvalues for remote worktrees.src/main/ipc/worktree-remote.ts#L2525-L2528: apply the same full-AgentIdhandling to local worktrees.📍 Affects 1 file
src/main/ipc/worktree-remote.ts#L1895-L1898(this comment)src/main/ipc/worktree-remote.ts#L2525-L2528src/renderer/src/hooks/useComposerState.ts (1)
3850-3852: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Preserve custom agent IDs in quick-create.
Both branches discard custom agents: the folder branch passes
null, and the repository branch makesagentnull wheneverrequestedAgentis not a TUI agent. Selecting a custom agent therefore creates a workspace without launching it.Proposed fix
- await submitFolderTarget(isTuiAgent(requestedAgent) ? requestedAgent : null) + await submitFolderTarget(requestedAgent) - const agent = - requestedAgent && - isTuiAgent(requestedAgent) && - isTuiAgentEnabled(requestedAgent, disabledTuiAgents) + const agent = + requestedAgent && + isTuiAgentEnabled(requestedAgent, disabledTuiAgents)Also applies to: 3882-3887
Several code paths still treated a custom agent id as "not a recognized agent" instead of handling it explicitly, since the TuiAgent -> AgentId migration was incomplete in a few spots: - launch-agent-in-new-tab.ts: crash on an orphaned/disabled custom agent (and the same bug one level deeper in resolveBaseCommand) - QuickLaunchButton.tsx: custom agents hidden while TUI detection is loading - useComposerState.ts: quick-launch silently dropped custom agent selection, and missing customAgents in submit callbacks' useCallback deps - session-tabs-schemas.ts: CreateTerminalTab RPC schema rejected custom agent ids from paired web/mobile sessions - tui-agent-startup.ts: expectedProcess for custom agents was the literal custom:* id instead of the real binary name, breaking readiness detection - types.ts / orca-runtime.ts / worktree-remote.ts / worktrees.ts / folder-workspace-worktree.ts: createdWithAgent gated by isTuiAgent instead of isAgentId in five separate places, so custom-agent worktrees/folder workspaces never persisted (or re-projected) their creation agent - AutomationsPage.tsx: default agent bypassed the custom agent enabled check - persistence.ts: load() stripped disabled custom agent ids and skipped normalizeCustomAgents, both restored by any settings write afterwards - folder-workspace-composer-submit.ts: customAgents not forwarded when a quick agent also has a linked work item Each fix has a regression test; test-full.log failures on this branch are pre-existing and unrelated (confirmed via git stash). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XwsxezmtFxvKSc3yRGYf85
|
@coderabbitai I went through both review passes and fixed everything that was actually a real issue (one nitpick on the literal i18n keys in Pushed in c1d6395:
Each fix has a regression test. Please take another pass. |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
git log --oneline -5
echo "---"
git show --stat c1d639558 | head -50Length of output: 3524 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== persistence.ts load section ==="
rg -n "normalizeAgentIds|normalizeCustomAgents|disabledTuiAgents|customAgents" src/main/persistence.ts
echo "=== worktrees.ts ==="
rg -n "isAgentId|isTuiAgent" src/main/ipc/worktrees.ts
echo "=== worktree-remote.ts ==="
rg -n "isAgentId|isTuiAgent" src/main/ipc/worktree-remote.ts
echo "=== folder-workspace-worktree.ts ==="
rg -n "isAgentId|isTuiAgent" src/shared/folder-workspace-worktree.ts
echo "=== orca-runtime.ts createdWithAgent ==="
rg -n "isAgentId|isTuiAgent" src/main/runtime/orca-runtime.ts
echo "=== tui-agent-startup.ts expectedProcess ==="
rg -n "expectedProcess" src/shared/tui-agent-startup.ts
echo "=== QuickLaunchButton.tsx loading state ==="
rg -n "detect|loading|customAgents" src/renderer/src/components/tab-bar/QuickLaunchButton.tsx | head -30
echo "=== useComposerState.ts customAgents deps ==="
rg -n "customAgents" src/renderer/src/hooks/useComposerState.ts
echo "=== launch-agent-in-new-tab.ts ==="
rg -n "customAgentForId|resolveBaseCommand|isCustomAgentId" src/renderer/src/lib/launch-agent-in-new-tab.ts src/shared/tui-agent-startup.ts
echo "=== session-tabs-schemas.ts ==="
rg -n "isAgentId|isTuiAgent" src/main/runtime/rpc/methods/session-tabs-schemas.ts
echo "=== AutomationsPage.tsx default agent ==="
rg -n "enabled|customAgentForId" src/renderer/src/components/automations/automation-default-agent.ts
echo "=== folder-workspace-composer-submit.ts work item ==="
rg -n "customAgents" src/renderer/src/components/sidebar/folder-workspace-composer-submit.tsLength of output: 10446 All the fixes check out — I verified each one directly in c1d6395:
Everything lines up with the PR summary, and each area has an accompanying regression test file ( On the i18n literal-key nitpick in I'm satisfied with these fixes. 🐰✨ ✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a5283887-82f6-4f5d-9e38-b84526152c4e
📒 Files selected for processing (29)
src/main/ipc/worktree-remote.tssrc/main/ipc/worktrees.test.tssrc/main/ipc/worktrees.tssrc/main/persistence.test.tssrc/main/persistence.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/session-tabs-schemas.test.tssrc/main/runtime/rpc/methods/session-tabs-schemas.tssrc/renderer/src/components/automations/AutomationsPage.tsxsrc/renderer/src/components/automations/automation-default-agent.test.tssrc/renderer/src/components/automations/automation-default-agent.tssrc/renderer/src/components/sidebar/folder-workspace-composer-submit.test.tssrc/renderer/src/components/sidebar/folder-workspace-composer-submit.tssrc/renderer/src/components/tab-bar/QuickLaunchButton.test.tssrc/renderer/src/components/tab-bar/QuickLaunchButton.tsxsrc/renderer/src/hooks/useComposerState-host-context-boundaries.test.tssrc/renderer/src/hooks/useComposerState.tssrc/renderer/src/lib/agent-native-draft-prefill.tssrc/renderer/src/lib/agent-paste-draft.tssrc/renderer/src/lib/launch-agent-in-new-tab.test.tssrc/renderer/src/lib/launch-agent-in-new-tab.tssrc/renderer/src/lib/worktree-activation-created-agent.test.tssrc/renderer/src/lib/worktree-activation.tssrc/shared/folder-workspace-worktree.test.tssrc/shared/folder-workspace-worktree.tssrc/shared/tui-agent-startup-custom-agent.test.tssrc/shared/tui-agent-startup.tssrc/shared/types.ts
🚧 Files skipped from review as they are similar to previous changes (11)
- src/renderer/src/lib/agent-native-draft-prefill.ts
- src/shared/folder-workspace-worktree.ts
- src/shared/types.ts
- src/renderer/src/lib/agent-paste-draft.ts
- src/renderer/src/lib/launch-agent-in-new-tab.ts
- src/renderer/src/components/automations/AutomationsPage.tsx
- src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
- src/renderer/src/lib/worktree-activation.ts
- src/shared/tui-agent-startup.ts
- src/renderer/src/hooks/useComposerState.ts
- src/main/runtime/orca-runtime.ts
| it('does not reopen a worktree whose creation-time custom agent was since deleted or disabled', () => { | ||
| const worktree = { ...makeWorktree(), createdWithAgent: 'custom:ghost' as const } | ||
| const revealWorktreeInSidebar = vi.fn() | ||
|
|
||
| useAppStore.setState({ | ||
| repos: [ | ||
| { | ||
| id: 'repo-1', | ||
| path: '/workspace/repo', | ||
| displayName: 'repo', | ||
| badgeColor: '#000000', | ||
| addedAt: 0 | ||
| } | ||
| ], | ||
| worktreesByRepo: { 'repo-1': [worktree] }, | ||
| activeRepoId: 'repo-1', | ||
| activeView: 'terminal', | ||
| tabsByWorktree: {}, | ||
| unifiedTabsByWorktree: {}, | ||
| groupsByWorktree: {}, | ||
| layoutByWorktree: {}, | ||
| activeGroupIdByWorktree: {}, | ||
| openFiles: [], | ||
| browserTabsByWorktree: {}, | ||
| activeFileIdByWorktree: {}, | ||
| activeBrowserTabIdByWorktree: {}, | ||
| activeTabTypeByWorktree: {}, | ||
| activeTabIdByWorktree: {}, | ||
| tabBarOrderByWorktree: {}, | ||
| pendingStartupByTabId: {}, | ||
| settings: { | ||
| agentCmdOverrides: {}, | ||
| setupScriptLaunchMode: 'new-tab', | ||
| customAgents: [] | ||
| } as unknown as ReturnType<typeof useAppStore.getState>['settings'], | ||
| markWorktreeVisited: vi.fn(), | ||
| recordWorktreeVisit: vi.fn(), | ||
| refreshGitHubForWorktreeIfStale: vi.fn(), | ||
| revealWorktreeInSidebar | ||
| }) | ||
|
|
||
| const result = activateAndRevealWorktree(worktree.id) | ||
| const state = useAppStore.getState() | ||
| const reopenedTab = state.tabsByWorktree[worktree.id]?.[0] | ||
|
|
||
| expect(result).toEqual({ primaryTabId: reopenedTab?.id }) | ||
| expect(reopenedTab).toBeDefined() | ||
| expect(state.pendingStartupByTabId[reopenedTab!.id]).toBeUndefined() | ||
| expect(revealWorktreeInSidebar).toHaveBeenCalledWith(worktree.id) | ||
| }) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Add a test case for the "disabled" scenario mentioned in the test title.
The test title says "deleted or disabled" but only covers the deleted case (customAgents: []). A disabled agent (present in customAgents with enabled: false) should also prevent startup, but this path is untested. Adding a case with enabled: false would catch regressions if the enablement check changes.
🧪 Suggested additional test case
it('does not enqueue startup for a worktree whose creation-time custom agent was disabled', () => {
const worktree = { ...makeWorktree(), createdWithAgent: 'custom:ghost' as const }
const revealWorktreeInSidebar = vi.fn()
useAppStore.setState({
// ... same setup as the deleted test ...
settings: {
agentCmdOverrides: {},
setupScriptLaunchMode: 'new-tab',
customAgents: [
{
id: 'custom:ghost',
name: 'Ghost',
command: '/usr/local/bin/ghost',
promptMode: 'pty',
icon: { kind: 'terminal' },
enabled: false
}
]
} as unknown as ReturnType<typeof useAppStore.getState>['settings'],
// ... same remaining setup ...
})
const result = activateAndRevealWorktree(worktree.id)
const state = useAppStore.getState()
const reopenedTab = state.tabsByWorktree[worktree.id]?.[0]
expect(result).toEqual({ primaryTabId: reopenedTab?.id })
expect(reopenedTab).toBeDefined()
expect(state.pendingStartupByTabId[reopenedTab!.id]).toBeUndefined()
expect(revealWorktreeInSidebar).toHaveBeenCalledWith(worktree.id)
})📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| it('does not reopen a worktree whose creation-time custom agent was since deleted or disabled', () => { | |
| const worktree = { ...makeWorktree(), createdWithAgent: 'custom:ghost' as const } | |
| const revealWorktreeInSidebar = vi.fn() | |
| useAppStore.setState({ | |
| repos: [ | |
| { | |
| id: 'repo-1', | |
| path: '/workspace/repo', | |
| displayName: 'repo', | |
| badgeColor: '#000000', | |
| addedAt: 0 | |
| } | |
| ], | |
| worktreesByRepo: { 'repo-1': [worktree] }, | |
| activeRepoId: 'repo-1', | |
| activeView: 'terminal', | |
| tabsByWorktree: {}, | |
| unifiedTabsByWorktree: {}, | |
| groupsByWorktree: {}, | |
| layoutByWorktree: {}, | |
| activeGroupIdByWorktree: {}, | |
| openFiles: [], | |
| browserTabsByWorktree: {}, | |
| activeFileIdByWorktree: {}, | |
| activeBrowserTabIdByWorktree: {}, | |
| activeTabTypeByWorktree: {}, | |
| activeTabIdByWorktree: {}, | |
| tabBarOrderByWorktree: {}, | |
| pendingStartupByTabId: {}, | |
| settings: { | |
| agentCmdOverrides: {}, | |
| setupScriptLaunchMode: 'new-tab', | |
| customAgents: [] | |
| } as unknown as ReturnType<typeof useAppStore.getState>['settings'], | |
| markWorktreeVisited: vi.fn(), | |
| recordWorktreeVisit: vi.fn(), | |
| refreshGitHubForWorktreeIfStale: vi.fn(), | |
| revealWorktreeInSidebar | |
| }) | |
| const result = activateAndRevealWorktree(worktree.id) | |
| const state = useAppStore.getState() | |
| const reopenedTab = state.tabsByWorktree[worktree.id]?.[0] | |
| expect(result).toEqual({ primaryTabId: reopenedTab?.id }) | |
| expect(reopenedTab).toBeDefined() | |
| expect(state.pendingStartupByTabId[reopenedTab!.id]).toBeUndefined() | |
| expect(revealWorktreeInSidebar).toHaveBeenCalledWith(worktree.id) | |
| }) | |
| it('does not reopen a worktree whose creation-time custom agent was since deleted or disabled', () => { | |
| const worktree = { ...makeWorktree(), createdWithAgent: 'custom:ghost' as const } | |
| const revealWorktreeInSidebar = vi.fn() | |
| useAppStore.setState({ | |
| repos: [ | |
| { | |
| id: 'repo-1', | |
| path: '/workspace/repo', | |
| displayName: 'repo', | |
| badgeColor: '`#000000`', | |
| addedAt: 0 | |
| } | |
| ], | |
| worktreesByRepo: { 'repo-1': [worktree] }, | |
| activeRepoId: 'repo-1', | |
| activeView: 'terminal', | |
| tabsByWorktree: {}, | |
| unifiedTabsByWorktree: {}, | |
| groupsByWorktree: {}, | |
| layoutByWorktree: {}, | |
| activeGroupIdByWorktree: {}, | |
| openFiles: [], | |
| browserTabsByWorktree: {}, | |
| activeFileIdByWorktree: {}, | |
| activeBrowserTabIdByWorktree: {}, | |
| activeTabTypeByWorktree: {}, | |
| activeTabIdByWorktree: {}, | |
| tabBarOrderByWorktree: {}, | |
| pendingStartupByTabId: {}, | |
| settings: { | |
| agentCmdOverrides: {}, | |
| setupScriptLaunchMode: 'new-tab', | |
| customAgents: [] | |
| } as unknown as ReturnType<typeof useAppStore.getState>['settings'], | |
| markWorktreeVisited: vi.fn(), | |
| recordWorktreeVisit: vi.fn(), | |
| refreshGitHubForWorktreeIfStale: vi.fn(), | |
| revealWorktreeInSidebar | |
| }) | |
| const result = activateAndRevealWorktree(worktree.id) | |
| const state = useAppStore.getState() | |
| const reopenedTab = state.tabsByWorktree[worktree.id]?.[0] | |
| expect(result).toEqual({ primaryTabId: reopenedTab?.id }) | |
| expect(reopenedTab).toBeDefined() | |
| expect(state.pendingStartupByTabId[reopenedTab!.id]).toBeUndefined() | |
| expect(revealWorktreeInSidebar).toHaveBeenCalledWith(worktree.id) | |
| }) | |
| it('does not reopen a worktree whose creation-time custom agent was disabled', () => { | |
| const worktree = { ...makeWorktree(), createdWithAgent: 'custom:ghost' as const } | |
| const revealWorktreeInSidebar = vi.fn() | |
| useAppStore.setState({ | |
| repos: [ | |
| { | |
| id: 'repo-1', | |
| path: '/workspace/repo', | |
| displayName: 'repo', | |
| badgeColor: '`#000000`', | |
| addedAt: 0 | |
| } | |
| ], | |
| worktreesByRepo: { 'repo-1': [worktree] }, | |
| activeRepoId: 'repo-1', | |
| activeView: 'terminal', | |
| tabsByWorktree: {}, | |
| unifiedTabsByWorktree: {}, | |
| groupsByWorktree: {}, | |
| layoutByWorktree: {}, | |
| activeGroupIdByWorktree: {}, | |
| openFiles: [], | |
| browserTabsByWorktree: {}, | |
| activeFileIdByWorktree: {}, | |
| activeBrowserTabIdByWorktree: {}, | |
| activeTabTypeByWorktree: {}, | |
| activeTabIdByWorktree: {}, | |
| tabBarOrderByWorktree: {}, | |
| pendingStartupByTabId: {}, | |
| settings: { | |
| agentCmdOverrides: {}, | |
| setupScriptLaunchMode: 'new-tab', | |
| customAgents: [ | |
| { | |
| id: 'custom:ghost', | |
| name: 'Ghost', | |
| command: '/usr/local/bin/ghost', | |
| promptMode: 'pty', | |
| icon: { kind: 'terminal' }, | |
| enabled: false | |
| } | |
| ] | |
| } as unknown as ReturnType<typeof useAppStore.getState>['settings'], | |
| markWorktreeVisited: vi.fn(), | |
| recordWorktreeVisit: vi.fn(), | |
| refreshGitHubForWorktreeIfStale: vi.fn(), | |
| revealWorktreeInSidebar | |
| }) | |
| const result = activateAndRevealWorktree(worktree.id) | |
| const state = useAppStore.getState() | |
| const reopenedTab = state.tabsByWorktree[worktree.id]?.[0] | |
| expect(result).toEqual({ primaryTabId: reopenedTab?.id }) | |
| expect(reopenedTab).toBeDefined() | |
| expect(state.pendingStartupByTabId[reopenedTab!.id]).toBeUndefined() | |
| expect(revealWorktreeInSidebar).toHaveBeenCalledWith(worktree.id) | |
| }) |
# Conflicts: # src/main/daemon/session.ts # src/main/ipc/pty.ts # src/main/runtime/orca-runtime.ts # src/preload/api-types.ts # src/preload/index.ts # src/renderer/src/components/native-chat/use-native-chat-toggle-shortcut.ts # src/renderer/src/components/tab-bar/TabBar.tsx # src/renderer/src/components/terminal-pane/TerminalPane.tsx # src/renderer/src/components/terminal-pane/pty-transport-types.ts # src/renderer/src/components/terminal-pane/pty-transport.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/launch-agent-background-session.ts # src/renderer/src/lib/launch-agent-web-host-tab.ts # src/renderer/src/runtime/web-runtime-session.ts # src/shared/runtime-types.ts
Two call sites still typed launchAgent as TuiAgent after merging origin/main into feat/custom-agents, which broke tsc: RuntimePtyController's spawn options and scheduleAgentBackgroundDraft's agent param. Both only gate on presence/dispatch and already flow through isTuiAgent-aware consumers, so widening is safe.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 084785cc-1df7-43a1-a191-6a18d15b01fc
📒 Files selected for processing (3)
2026-07-13-195002-this-session-is-being-continued-from-a-previous-c.txtsrc/main/daemon/daemon-server.tssrc/main/daemon/session.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/daemon/daemon-server.ts
- src/main/daemon/session.ts
Code review of the merge-conflict resolution surfaced spots where launchAgent was still narrowed to TuiAgent (or guarded inconsistently) after widening the type to AgentId, so custom agents silently lost functionality: - pty-transport.ts: the outbound PTY spawn path filtered launchAgent with isTuiAgent instead of isAgentId, so custom agents never reached the daemon's Session.launchAgent, weakening process-group kill. - launch-agent-background-session.ts: buildAgentStartupPlan was never given customAgents, so a custom agent launched via background/ automation flows always failed to resolve its command. - pty-connection.ts: indexing TUI_AGENT_CONFIG with an AgentId-typed value silently returned undefined for custom agents, disabling the startup-draft-paste readiness fallback. - orca-runtime.ts: effectiveCreatedWithAgent was isAgentId-guarded in some spreads but only truthiness-checked in others; made consistent. - pty-subprocess.ts: PtySubprocessOptions.launchAgent was still typed TuiAgent though a real AgentId can reach it; widened for accuracy.
2026-07-13-195002-this-session-is-being-continued-from-a-previous-c.txt was an untracked local Claude Code session transcript sitting in the repo root; it got swept in by `git add -A` while staging the origin/main merge resolution and should never have been committed.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/lib/launch-agent-background-session.ts (1)
84-86: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winBase the follow-up prompt check on the resolved startup plan for custom agents.
agentConfigisnullfor custom agents, butbuildAgentStartupPlan()still maps some of them tostdin-after-startand returns afollowupPrompt. Those prompts never reachscheduleAgentBackgroundDraft()here, so custom interactive agents can launch without their prompt.
🧹 Nitpick comments (1)
src/main/runtime/orca-runtime.ts (1)
16448-16448: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse
isAgentIdfor consistency.While
args.createdWithAgentis safe here because it is strictly passed from the caller where it was already validated, usingisAgentIdwould keep the remote payload construction perfectly aligned with its local counterpartcreateManagedWorktree(e.g., line 16145).♻️ Proposed refactor
- ...(args.createdWithAgent ? { launchAgent: args.createdWithAgent } : {}), + ...(isAgentId(args.createdWithAgent) ? { launchAgent: args.createdWithAgent } : {}),
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0752f830-3ef7-4f38-82b7-842fc1d5c4d8
📒 Files selected for processing (5)
src/main/daemon/pty-subprocess.tssrc/main/runtime/orca-runtime.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/components/terminal-pane/pty-transport.tssrc/renderer/src/lib/launch-agent-background-session.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/renderer/src/components/terminal-pane/pty-transport.ts
- src/renderer/src/components/terminal-pane/pty-connection.ts
The new Custom agents section in AgentsPane.tsx used plain descriptive translate() keys (customAgents, disabled, enable, ...) while every other string in the file follows the 10-char sha1 hash convention. Regenerated via localize-renderer-strings.mjs so the keys match the rest of the file, then synced the non-English locale catalogs. The other flagged item (QuickLaunchButton hiding custom agents while TUI detection is still loading) was already fixed in c1d6395 - verified via git history and current behavior, no change needed.
# Conflicts: # src/renderer/src/lib/native-chat-supported-agent.ts
|
@brennanb2025 / @AmethystLiang hey is this going to be processed soon in a patch version or in a minor release (1.X.0) ? |


Summary
Custom terminal agents can now be configured with a name, command, prompt-delivery mode, optional template, and icon. They appear in Settings and the workspace agent picker, can be enabled or disabled, and can be selected as the default agent. Custom-agent launch state is propagated through local, SSH, remote-runtime, and automation paths.
Screenshots
The change includes Settings and workspace agent-picker UI updates. No screenshots or recording were captured in this environment.
Testing
pnpm lint(run with[email protected]; passed with warnings)pnpm typecheck(run with[email protected]; passed)pnpm test(run with[email protected]; existing failures remain in PTY shell, relay, startup, review UI, daemon, and sidebar suites)pnpm build(run with[email protected]; completed through desktop, native, Electron, relay, CLI, and web build steps; the CLI symlink step reported the expected permission warning for/usr/local/bin/orca-dev)AI Review Report
The AI coding-agent review checked custom-agent validation and normalization, enable/disable and default persistence, prompt delivery through PTY/argv/template modes, command/environment/argument handling, stale IDs, IPC/runtime propagation, SSH and remote startup, shell-aware command construction, UI behavior, cleanup, and supported native-agent compatibility.
The review explicitly checked macOS, Linux, and Windows compatibility, including shortcuts, labels, paths, shell behavior, and Electron-specific platform differences touched by this PR. It also checked local, SSH, and remote-runtime execution and provider-neutral behavior. The main risk found was an incomplete AgentId/TuiAgent migration; the affected launch contracts and native-only consumers were corrected and
pnpm typechecknow passes.Security Audit
The review covered custom command and prompt-template validation, icon data URLs and size/type checks, command execution boundaries, shell quoting, SSH/remote paths, IPC/runtime settings normalization, filesystem paths, auth, secrets, dependencies, and cleanup. Custom commands remain intentionally user-controlled executable input and continue through the existing shell-aware startup and trust/preflight paths. No secrets, auth, or dependency changes were introduced.
Notes
@Zoeillle[email protected]because pnpm is not installed globally.Zoeille:feat/custom-agents→stablyai/orca:main.ELI5
You can define your own terminal agents with a name, command, how prompts are sent, optional template, and icon. They show up in Settings and the agent picker, can be enabled or set as default, and work over local, SSH, remote, and automation paths.