Skip to content

feat(agents): add custom agents backed by an installed agent - #47662

Open
eltria wants to merge 2 commits into
stablyai:mainfrom
eltria:feat/custom-tui-agents
Open

eltria wants to merge 2 commits into
stablyai:mainfrom
eltria:feat/custom-tui-agents

Conversation

@eltria

@eltria eltria commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

ELI5

If you run the same CLI agent (like Claude Code or Codex) through different wrapper commands — for example, one wrapper per API gateway or profile — Orca only lets you configure one command per agent today. This change adds a Custom agents card in Settings → Agents so you can save multiple named entries backed by an installed agent and launch them from the + new-tab menu while keeping all of the base agent's status hooks, prompt delivery, and session resume behavior.

What Changed

Before: Settings → Agents stores a single command override per built-in agent (agentCmdOverrides), so switching between multiple wrappers or profiles for the same harness requires either editing Settings before each launch or dropping to a raw terminal (losing agent status hooks, tab labeling, and resume support).

After:

  • Settings → Agents gains a Custom agents section (between Installed and Available to install) on local hosts where users can add, edit, reorder, and delete named custom entries (name, base agent, command).
  • Entries are persisted under customTuiAgents in GlobalSettings and normalized on both load (normalizeLoadedGlobalSettings) and save (updateSettings) — trimming fields, capping length/count, deduplicating IDs, validating base agent IDs, and collapsing line breaks so a command stays a single shell line.
  • The + new-tab menu lists launchable custom agents (for local workspaces whose base agent is detected or pending detection) beneath the agent rows, and the omnibox search matches them by name or command.
  • Launching a custom agent opens a terminal tab named after the entry (quickCommandLabel), runs its command in place of the base agent's Settings command via a per-launch launchCommand override in launchAgentInNewTab / resolveAgentStartupPlanInputs, and records that command in launchConfig.agentCommand so hibernated or restored sessions resume through the same wrapper.

Scope note: Kept deliberately focused on the core settings model, Settings UI, and + new-tab menu/search/launch path (following #8337's note to start fresh and tight against current main). Additional entry points (default custom agent, composer, mobile, source control AI) are left for follow-up PRs once the core shape looks right.

Why

  • Directly addresses the "multiple named wrappers backed by one installed harness" workflow discussed in [Feature]: Allow multiple named entries (aliases) per agent harness #9136 (Claude gateways/wrappers, named Codex/Copilot/Pi CLI variants).
  • Why a per-launch command override backed by an installed TuiAgent instead of an unattached generic CLI type: Reusing the base agent preserves Orca's existing hooks, readiness detection, prompt injection, and resume logic without duplicating harness definitions or expanding the RPC/wire protocol.
  • Why local-only in this PR: customTuiAgents lives in local desktop settings; launchableCustomAgents skips non-local execution hosts (executionHostId !== LOCAL_EXECUTION_HOST_ID) so a local wrapper command is never sent across the wire or silently dropped by a remote host.

Linked Issue

Fixes #9136

Visual Proof

Headless component-fixture screenshots were captured via pnpm fixtures:shot for empty, populated, and add-dialog states of CustomTuiAgentsSection / CustomTuiAgentDialog (using Orca's SettingsGroup card layout and SettingsBadge / Button / Dialog primitives) and verified with zero console or render errors. Before/after screenshots can be attached via GitHub UI if requested (CLI upload extension is not installed locally).

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

Verified on macOS (arm64):

  • ORCA_CODE_QUALITY_BASE=upstream/main pnpm check:changed --base=upstream/main — all 42/42 checks passed (format, oxlint, changed-code quality, unit tests, all 4 typecheck projects, localization coverage/catalogs/extraction, dead design-system classes, import boundaries, React Compiler compat, and all ratchets).
  • src/shared/agent-launch/catalog/custom-tui-agents.test.ts covers persistence normalization (trimming, newline collapse, deduplication, invalid-entry dropping) and resolveAgentStartupPlanInputs + buildAgentStartupPlan verifying launchCommand replaces agentCmdOverrides for both launch and resume config.
  • Rendered CustomTuiAgentsSection (empty, populated, add dialog) via pnpm fixtures:shot in headless Chromium.

Performance

None, because custom-agent normalization only runs on settings load/save (bounded to 50 entries), and menu/search rows are computed only when the + new-tab menu is opened.

Risk

Level: Low

  • Purely additive optional customTuiAgents?: CustomTuiAgent[] field in GlobalSettings and optional launchCommand?: string on LaunchAgentInNewTabArgs / resolveAgentStartupPlanInputs; zero behavior change when no custom agents are configured.
  • Remote SSH / paired web hosts do not display local custom agents, avoiding broken cross-host launches or wire-protocol changes.
  • Back-out: a plain git revert restores prior behavior cleanly (any saved customTuiAgents key in settings JSON is harmlessly ignored if reverted).

AI Disclosure

Assisted by Antigravity (Gemini 4 Neon) and Claude Opus 5.5 for implementation, rebasing onto current main, and verification.

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

  • Security: normalizeCustomTuiAgents strips/collapses \r/\n to prevent multi-line shell injection, enforces length/count bounds (MAX_CUSTOM_TUI_AGENTS = 50), validates agent via isTuiAgent, and never forwards local commands to remote hosts.
  • Cross-platform: Uses existing withLaunchCommandOverride / resolveAgentStartupPlanInputs pipeline, which handles POSIX and Windows shells identically to agentCmdOverrides.
  • Remote SSH & Mobile: Local desktop settings only in this PR; remote workspaces skip local custom agents cleanly, and mobile/RPC wire schemas are unchanged.
  • Backwards compatibility: Additive optional field, no migration required.

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)
  • I stated the risk: what could break, for whom, and how to back it out
  • 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)

@eltria
eltria requested a review from brennanb2025 as a code owner November 23, 2026 12:48
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds custom TUI agent entries to global settings, including normalization and controls to add, edit, reorder, and delete entries. Custom agents appear in the launch menu and tab-bar picker when eligible. Their launch command overrides the selected base agent’s Settings command for that launch, which uses the terminal surface. English and Chinese translations are added.

Merge Risk: Minimal · up to ab6c8

This adds a Custom agents section in Settings, plus custom entries in the new-tab menu and picker that launch with their own command. The reviewed code shows the custom command and name carried through to the launch. No remaining merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(agents): add custom agents backed by an installed agent" matches the main change. The PR adds a Custom agents section in Settings, persists custom entries, and launches them from the n…
Description check Passed The description follows the repository template closely. It covers ELI5, What Changed (before and after), Why, a linked issue (Fixes #9136), Visual Proof, Testing, Performance, Risk with a level, AI D…
Linked Issues check Passed Directly linked issue #9136 asks for multiple named entries backed by one harness. Its key concrete requirement is that an entry can override the launch command. The whole-PR summary (merge base to he…
Out of Scope Changes check Passed Each changed file in the whole-PR summary supports the custom-agent feature. These include the settings model and normalization, the custom-agent catalog and its tests, the launch command override pat…
Full details: Title check

Explanation

The title "feat(agents): add custom agents backed by an installed agent" matches the main change. The PR adds a Custom agents section in Settings, persists custom entries, and launches them from the new-tab menu through a base installed agent. The title is specific and uses a conventional commit prefix. It is 60 characters, which is acceptable.

Full details: Description check

Explanation

The description follows the repository template closely. It covers ELI5, What Changed (before and after), Why, a linked issue (Fixes #9136), Visual Proof, Testing, Performance, Risk with a level, AI Disclosure, Notes, and Checklist. Visual Proof gives a description of headless fixture screenshots but does not attach images, and the PR relies on the GitHub UI to add them later. The template asks for BEFORE and AFTER visuals for UI changes, so this part is incomplete. The Review section and the Agent skill upstream boundary checkbox are filled in. The Risk level is set to Low. Performance has a one-line reason.

Resolution

Attach the actual BEFORE and AFTER screenshots or videos for the Settings Custom agents section and the + new-tab menu, as the template requires for UI changes. The fixture descriptions alone do not satisfy this requirement.

Full details: Linked Issues check

Explanation

Directly linked issue #9136 asks for multiple named entries backed by one harness. Its key concrete requirement is that an entry can override the launch command. The whole-PR summary (merge base to head ab6c875) shows this implemented. customTuiAgents is stored in GlobalSettings and normalized on load (normalizeLoadedGlobalSettings) and save (updateSettings) through normalizeCustomTuiAgents. CustomTuiAgentsSection in Settings → Agents supports add, edit, reorder, and delete. CustomAgentMenuItems and buildCustomAgentLaunchOptions expose entries in the + new-tab menu and omnibox search. A per-launch launchCommand flows through launchAgentInNewTab and withLaunchCommandOverride into resolveAgentStartupPlanInputs, replacing the base agent's agentCmdOverrides command. The same command is recorded in launchConfig.agentCommand for resume. custom-tui-agents.test.ts covers normalization and launch and resume command selection. Gaps relative to the issue's broader proposal remain: per-entry args and env, and independent enable, disable, or set-as-default per entry. The PR description defers these. The issue's stated alternative (a separate list with a baseAgent field) matches the implemented shape. These are residual gaps, not failing requirements. Evidence basis: the whole-PR summary and the previous assessment. The incremental commits were not inspected line by line.

Full details: Out of Scope Changes check

Explanation

Each changed file in the whole-PR summary supports the custom-agent feature. These include the settings model and normalization, the custom-agent catalog and its tests, the launch command override path, the + menu, picker, and search rows, the Settings UI components, en and zh locale strings, and type updates such as NewTabAgentMenuRow.custom and launchCommand. The AgentDetectionCatalog change (afterInstalled slot and keyed fragments) is a small supporting change that places the new section between the installed and available groups. No changed file is unrelated to the feature. Evidence basis: the whole-PR summary and the previous assessment. The incremental commits were not inspected line by line.

  • 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

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: 0e17c2f0-4168-4c21-90de-b86106482791
Commits

Reviewing files that changed from the base of the PR and between 3cee290 and ab6c875.

Files selected for processing: 6

  • src/main/persistence/applying-settings/settings-update.ts
  • src/main/persistence/loading-store/profile-loading/normalize-loaded-global-settings.ts
  • src/renderer/src/components/tab-bar/create-entry/TabBarAgentPickerEntry.tsx
  • src/renderer/src/components/tab-bar/create-entry/tab-agent-launch-options.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/zh.json
Files skipped from review as they are similar to previous changes: 2

  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/zh.json

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

@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: 1

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: 66d77ec3-d294-49b2-9c94-512df11b96e4
Commits

Reviewing files that changed from the base of the PR and between 4ca2cae and e3cf932.

Files selected for processing: 21

  • src/main/persistence/applying-settings/settings-update.ts
  • src/main/persistence/loading-store/profile-loading/normalize-loaded-global-settings.ts
  • src/renderer/src/components/agent/launch-menu/AgentMenuItems.tsx
  • src/renderer/src/components/agent/launch-menu/CustomAgentMenuItems.tsx
  • src/renderer/src/components/agent/launch-menu/custom-agent-menu-rows.ts
  • src/renderer/src/components/settings/agents/launch/AgentDetectionCatalog.tsx
  • src/renderer/src/components/settings/agents/launch/AgentLaunchSettingsCatalog.tsx
  • src/renderer/src/components/settings/agents/launch/CustomTuiAgentDialog.tsx
  • src/renderer/src/components/settings/agents/launch/CustomTuiAgentsSection.tsx
  • src/renderer/src/components/tab-bar/create-entry/TabBarAgentPickerEntry.tsx
  • src/renderer/src/components/tab-bar/create-entry/tab-agent-launch-options.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-in-new-tab-args.ts
  • src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-in-new-tab.ts
  • src/shared/agent-launch/catalog/custom-tui-agents.test.ts
  • src/shared/agent-launch/catalog/custom-tui-agents.ts
  • src/shared/agent-launch/picker/agent-launch-picker-rows.ts
  • src/shared/agent-launch/startup/agent-startup-plan-inputs.ts
  • src/shared/agent-launch/startup/tui-agent-launch-command-override.ts
  • src/shared/settings/global-settings-base.ts

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

@danchamorro

Copy link
Copy Markdown

+1. This covers the terminal side of what I asked for in #9136 (named Claude and Pi instances with their own command and environment). I'm looking forward to the Chat follow-up.

@eltria
eltria force-pushed the feat/custom-tui-agents branch from 3cee290 to ab6c875 Compare November 27, 2026 01:55

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Allow multiple named entries (aliases) per agent harness

2 participants