Skip to content

feat(agents): Add configurable agent profiles - #5754

Open
tmchow wants to merge 11 commits into
stablyai:mainfrom
tmchow:tmchow/tubeworm
Open

tmchow wants to merge 11 commits into
stablyai:mainfrom
tmchow:tmchow/tubeworm

Conversation

@tmchow

@tmchow tmchow commented Jun 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Agent setup is no longer limited to one fixed entry per provider. Users can duplicate a built-in agent, give the duplicate its own name, command override, args, and environment, then launch that profile from the same agent pickers used for normal agent starts.

The profile args/env/command templates can now reference {repoPath} and {worktreePath}, so a profile can point at workspace-local plugins or repo-specific resources without hardcoding one machine path.

What Changed

Area Result
Agent settings Built-in agents can be duplicated into named profiles, renamed, configured, disabled, deleted, and set as the default.
Launch surfaces Profiles appear under their base agent in new-tab quick launch, composer flows, floating terminals, automations, terminal quick commands, and Source Control launch actions.
Runtime startup Profile ids resolve through their base agent for detection, trust preflight, startup commands, icons, labels, args, env, and web/runtime launches.
Source Control recipes Launch recipes expose {repoPath} and {worktreePath} variables, with variable chips sorted consistently.

The text-generation-only Source Control recipes remain constrained to agents that support single-response generation; profile support is applied to launch-style actions where profile args and command overrides map directly to an interactive agent start.

Demo

CleanShot 2026-06-18 at 21 07 20@2x CleanShot 2026-06-18 at 19 13 49@2x

Validation

  • pnpm run typecheck
  • pnpm run lint
  • npm test -- --run src/renderer/src/components/tab-bar/QuickLaunchButton.test.ts src/renderer/src/components/automations/AutomationEditorDialog.test.ts src/renderer/src/components/terminal-quick-commands/terminal-quick-command-agent-options.test.ts src/renderer/src/components/settings/CommitMessageAiPane.test.tsx src/renderer/src/lib/source-control-agent-action-plan.test.ts src/renderer/src/components/right-sidebar/SourceControlAgentActionDialog.test.tsx src/shared/terminal-quick-commands.test.ts src/renderer/src/lib/run-quick-command-in-new-tab.test.ts src/renderer/src/lib/launch-agent-in-new-tab.test.ts src/renderer/src/lib/launch-agent-background-session.test.ts src/renderer/src/components/tab-bar/tab-agent-launch-options.test.ts
  • git diff --check

Compound Engineering
GPT-5


Open in Stage

ELI5

You can now create custom agent profiles: copy a built-in agent, rename it, and override its command, args, and environment. Profiles can use placeholders like {repoPath} so they work across machines without hardcoding paths.

@coderabbitai

coderabbitai Bot commented Jun 19, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This pull request introduces a TUI agent profile system and repoPath/worktreePath template variables for source-control AI actions.

The agent type model is split into BuiltInTuiAgent and a new TuiAgentProfileId template literal, with TuiAgent becoming their union. New shared modules (tui-agent-profile-id.ts, tui-agent-profiles.ts) provide profile ID validation, normalization, and interpolation utilities. Profile-aware launch-defaults resolution and a new startup-command builder (tui-agent-startup-command.ts) thread agentProfiles and variables through buildAgentStartupPlan, resolveTuiAgentLaunchArgs, and resolveTuiAgentLaunchEnv. Trust preflight lookups across runtime, worktree creation, folder-workspace submission, session-fork, and background-session launch all switch from direct TUI_AGENT_CONFIG[agent] indexing to resolveTuiAgentBaseAgent-first lookups.

repoPath and worktreePath are added to CommitMessageGenerationTarget, wired through IPC handlers, orca-runtime-git.ts, and agent-hook targets, and exposed as template variables in SOURCE_CONTROL_ACTION_VARIABLES. The AgentsPane settings UI gains full profile CRUD (duplicate, delete, per-profile label/command/args/env editing) with a variable-hint component. Profile-aware rendering propagates to automations, the tab bar quick launch, terminal quick commands, floating terminal controls, the workspace composer, and all source-control agent action dialogs. Persistence normalizes agentProfiles on load and update via normalizeTuiAgentProfiles. New locale strings for profile management are added in en, es, ja, ko, and zh.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.21% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The PR description covers summary, changes, demo, and testing, but it omits the required AI Review Report, Security Audit, Notes, and a Screenshots section heading. Add the missing template sections with concise AI review and security audit notes, include a Screenshots section (or state no visual change), and add any platform-specific notes.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(agents): Add configurable agent profiles' directly and concisely summarizes the main feature addition—enabling users to create custom agent profiles.
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.

Actionable comments posted: 11

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/renderer/src/components/settings/source-control-action-recipe-options.ts (1)

136-153: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Profile warning label drops profile context.

At Line 148, getAgentLabel(selectedAgent) is called without agentProfiles, so saved profile agents can show raw IDs in the unsupported-agent warning instead of the profile label.

💡 Proposed fix
 export function getSourceControlActionAgentWarningText(
   actionId: SourceControlActionId,
-  selectedAgent: TuiAgent | CustomAgentId | null | undefined
+  selectedAgent: TuiAgent | CustomAgentId | null | undefined,
+  agentProfiles?: readonly TuiAgentProfile[] | null
 ): string | null {
@@
-    const agentLabel = getAgentLabel(selectedAgent)
+    const agentLabel = getAgentLabel(selectedAgent, agentProfiles)

And thread agentProfiles from callers (SourceControlActionRecipeRow and RepositorySourceControlAiActionRows).

src/renderer/src/components/floating-terminal/FloatingTerminalWindowControls.tsx (1)

139-139: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Pass profiles into the launch button icon.

defaultAgent can now be a profile id; without profiles, AgentIcon cannot resolve profile.baseAgent and profile launch buttons fall back to a generic letter icon.

🎨 Proposed fix
-              <AgentIcon agent={defaultAgent} size={14} />
+              <AgentIcon agent={defaultAgent} profiles={agentProfiles} size={14} />
🧹 Nitpick comments (2)
src/shared/tui-agent-config.ts (1)

331-333: ⚡ Quick win

Document why isTuiAgent accepts unresolved profile-shaped IDs.

This behavior is subtle and cross-cutting; a short Why: comment here would prevent future callers from assuming existence validation happens in this guard.

As per coding guidelines, “When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does.”

Suggested patch
 export function isTuiAgent(value: unknown): value is TuiAgent {
+  // Why: this guard validates ID shape only; profile existence is resolved
+  // later against the current `agentProfiles` set at launch/planning time.
   return isBuiltInTuiAgent(value) || isTuiAgentProfileId(value)
 }

Source: Coding guidelines

src/shared/terminal-quick-commands.ts (1)

107-110: ⚡ Quick win

Add a short rationale for preserving profile IDs during normalization.

This branch is non-obvious because it intentionally keeps profile IDs even when built-in capability checks are stricter.

As per coding guidelines, “When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does.”

Suggested patch
-    const agent =
+    // Why: keep profile IDs round-trippable in settings normalization; support
+    // checks for profile-backed options are evaluated later with profile context.
+    const agent =
       supportsTerminalAgentQuickCommand(record.agent) || isTuiAgentProfileId(record.agent)
         ? record.agent
         : null

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2cda9610-33ad-4204-b600-c1f7dce416c4

📥 Commits

Reviewing files that changed from the base of the PR and between b8f2f95 and fd490df.

📒 Files selected for processing (82)
  • src/main/agent-hooks/first-work-branch-rename.ts
  • src/main/agent-hooks/first-work-generation-target.ts
  • src/main/ipc/filesystem.ts
  • src/main/persistence.ts
  • src/main/runtime/orca-runtime-git.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/text-generation/commit-message-text-generation.ts
  • src/renderer/src/components/NewWorkspaceComposerCard.tsx
  • src/renderer/src/components/agent/AgentCombobox.tsx
  • src/renderer/src/components/automations/AutomationDetail.tsx
  • src/renderer/src/components/automations/AutomationEditorDialog.test.ts
  • src/renderer/src/components/automations/AutomationEditorDialog.tsx
  • src/renderer/src/components/automations/AutomationsPage.tsx
  • src/renderer/src/components/floating-terminal/FloatingTerminalWindowControls.tsx
  • src/renderer/src/components/right-sidebar/SourceControl.commit-failure-recovery.test.ts
  • src/renderer/src/components/right-sidebar/SourceControlAgentActionDialog.tsx
  • src/renderer/src/components/right-sidebar/SourceControlAgentActionDialogForm.test.tsx
  • src/renderer/src/components/right-sidebar/SourceControlAgentActionDialogForm.tsx
  • src/renderer/src/components/right-sidebar/buildSourceControlAgentDeliveryPlan.ts
  • src/renderer/src/components/right-sidebar/source-control-agent-action-dialog-result.ts
  • src/renderer/src/components/right-sidebar/source-control-agent-action-dialog-support.ts
  • src/renderer/src/components/right-sidebar/source-control-ai-commit-failure-launch.ts
  • src/renderer/src/components/right-sidebar/source-control-ai-prompts.ts
  • src/renderer/src/components/right-sidebar/use-source-control-ai.ts
  • src/renderer/src/components/right-sidebar/useSourceControlAgentActionDialog.ts
  • src/renderer/src/components/right-sidebar/useSourceControlAgentActionStart.ts
  • src/renderer/src/components/settings/AgentsPane.test.tsx
  • src/renderer/src/components/settings/AgentsPane.tsx
  • src/renderer/src/components/settings/CommitMessageAiPane.test.tsx
  • src/renderer/src/components/settings/CommitMessageAiPane.tsx
  • src/renderer/src/components/settings/RepositorySourceControlAiActionRows.tsx
  • src/renderer/src/components/settings/RepositorySourceControlAiSection.tsx
  • src/renderer/src/components/settings/SourceControlActionRecipeRow.tsx
  • src/renderer/src/components/settings/SourceControlAiActionRecipeDefaults.tsx
  • src/renderer/src/components/settings/repository-source-control-ai-labels.ts
  • src/renderer/src/components/settings/source-control-action-recipe-options.ts
  • src/renderer/src/components/sidebar/folder-workspace-composer-submit.ts
  • src/renderer/src/components/source-control/SourceControlActionVariableChips.test.tsx
  • src/renderer/src/components/tab-bar/QuickLaunchButton.test.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
  • src/renderer/src/components/tab-bar/TabBar.tsx
  • src/renderer/src/components/tab-bar/tab-agent-launch-options.test.ts
  • src/renderer/src/components/tab-bar/tab-agent-launch-options.ts
  • src/renderer/src/components/terminal-pane/terminal-agent-session-fork.ts
  • src/renderer/src/components/terminal-quick-commands/TerminalQuickCommandContentSection.tsx
  • src/renderer/src/components/terminal-quick-commands/TerminalQuickCommandDialog.tsx
  • src/renderer/src/components/terminal-quick-commands/terminal-quick-command-agent-options.test.ts
  • src/renderer/src/components/terminal-quick-commands/terminal-quick-command-agent-options.ts
  • src/renderer/src/hooks/useComposerState.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/agent-catalog.tsx
  • src/renderer/src/lib/agent-paste-draft.ts
  • src/renderer/src/lib/fix-checks-agent-launch.ts
  • src/renderer/src/lib/launch-agent-background-session.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.ts
  • src/renderer/src/lib/launch-agent-tab-startup-plan.ts
  • src/renderer/src/lib/launch-agent-web-runtime-tab.ts
  • src/renderer/src/lib/launch-work-item-direct.ts
  • src/renderer/src/lib/source-control-agent-action-plan.test.ts
  • src/renderer/src/lib/source-control-agent-action-plan.ts
  • src/renderer/src/lib/source-control-launch-agent-selection.ts
  • src/renderer/src/lib/worktree-creation-flow.ts
  • src/renderer/src/store/slices/settings.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/agent-process-recognition.ts
  • src/shared/constants.ts
  • src/shared/source-control-ai-actions.test.ts
  • src/shared/source-control-ai-actions.ts
  • src/shared/terminal-quick-commands.ts
  • src/shared/tui-agent-config.ts
  • src/shared/tui-agent-launch-defaults.ts
  • src/shared/tui-agent-profile-id.ts
  • src/shared/tui-agent-profiles.test.ts
  • src/shared/tui-agent-profiles.ts
  • src/shared/tui-agent-startup-command.ts
  • src/shared/tui-agent-startup.test.ts
  • src/shared/tui-agent-startup.ts
  • src/shared/types.ts

Comment thread src/renderer/src/lib/agent-catalog.tsx Resolved
Comment thread src/shared/tui-agent-startup-command.ts Resolved

@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 (1)
src/renderer/src/lib/worktree-creation-flow.ts (1)

61-112: 💤 Low value

Minor: Direct mutation of return value could be replaced with spread.

Line 109 mutates the startupPlan object returned by buildAgentStartupPlan. While safe because the function returns a fresh object, using a spread would be more explicit:

-  if (startupPlan && template.draftPrompt) {
-    startupPlan.draftPrompt = template.draftPrompt
-  }
-  return startupPlan
+  if (!startupPlan) {
+    return null
+  }
+  return template.draftPrompt ? { ...startupPlan, draftPrompt: template.draftPrompt } : startupPlan

This is optional—the current code is functionally correct since buildAgentStartupPlan returns a new object literal.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e05e3075-b64b-498c-a9cd-ba964bcca667

📥 Commits

Reviewing files that changed from the base of the PR and between fd490df and 709a953.

📒 Files selected for processing (27)
  • src/renderer/src/components/NewWorkspaceComposerCard.tsx
  • src/renderer/src/components/floating-terminal/FloatingTerminalWindowControls.tsx
  • src/renderer/src/components/settings/AgentsPane.test.tsx
  • src/renderer/src/components/settings/CommitMessageAiPane.test.tsx
  • src/renderer/src/components/settings/RepositorySourceControlAiActionRows.tsx
  • src/renderer/src/components/settings/SourceControlActionRecipeRow.tsx
  • src/renderer/src/components/settings/source-control-action-recipe-options.ts
  • src/renderer/src/components/tab-bar/TabBar.tsx
  • src/renderer/src/components/tab-bar/tab-agent-launch-options.test.ts
  • src/renderer/src/hooks/useComposerState.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/agent-catalog.tsx
  • src/renderer/src/lib/launch-agent-background-session.ts
  • src/renderer/src/lib/launch-agent-tab-startup-plan.ts
  • src/renderer/src/lib/pending-worktree-creation.ts
  • src/renderer/src/lib/source-control-agent-action-plan.test.ts
  • src/renderer/src/lib/source-control-agent-action-plan.ts
  • src/renderer/src/lib/worktree-creation-flow.test.ts
  • src/renderer/src/lib/worktree-creation-flow.ts
  • src/shared/terminal-quick-commands.ts
  • src/shared/tui-agent-config.ts
  • src/shared/tui-agent-startup-command.ts
  • src/shared/tui-agent-startup.test.ts
✅ Files skipped from review due to trivial changes (1)
  • src/renderer/src/i18n/locales/ko.json
🚧 Files skipped from review as they are similar to previous changes (19)
  • src/shared/tui-agent-startup.test.ts
  • src/renderer/src/lib/source-control-agent-action-plan.test.ts
  • src/renderer/src/components/settings/AgentsPane.test.tsx
  • src/renderer/src/components/settings/source-control-action-recipe-options.ts
  • src/renderer/src/components/NewWorkspaceComposerCard.tsx
  • src/renderer/src/components/floating-terminal/FloatingTerminalWindowControls.tsx
  • src/renderer/src/components/tab-bar/TabBar.tsx
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/components/settings/RepositorySourceControlAiActionRows.tsx
  • src/renderer/src/i18n/locales/zh.json
  • src/shared/tui-agent-config.ts
  • src/renderer/src/components/settings/SourceControlActionRecipeRow.tsx
  • src/shared/terminal-quick-commands.ts
  • src/renderer/src/lib/launch-agent-tab-startup-plan.ts
  • src/renderer/src/lib/launch-agent-background-session.ts
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/agent-catalog.tsx
  • src/renderer/src/lib/source-control-agent-action-plan.ts

@tmchow tmchow changed the title Add configurable agent profiles feat(agents): Add configurable agent profiles Jun 19, 2026
@brennanb2025

brennanb2025 commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for pushing this forward. I noticed this overlaps pretty directly with #5728, which is also adding named launch profiles for built-in agents.

I’m curious what led you to model profiles as first-class TuiAgent ids (agent-profile:...) rather than keeping the built-in agent id plus a separate profileId / launch option, as in #5728:
image

The tradeoff I see is that making profiles agent-like lets them show up naturally across more surfaces and be set as defaults, but it also means every existing TuiAgent path has to remember to resolve profile ids back to a base agent and pass profile metadata through. In review I found a few places where a profile id is accepted but the startup builder does not receive agentProfiles, so launch planning can fail or drop profile args/env.

What benefits are you aiming for with the first-class profile-id model over the built-in-agent-plus-profile-id approach?

@tmchow

tmchow commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for pushing this forward. I noticed this overlaps pretty directly with #5728, which is also adding named launch profiles for built-in agents.

I’m curious what led you to model profiles as first-class TuiAgent ids (agent-profile:...) rather than keeping the built-in agent id plus a separate profileId / launch option, as in #5728:
The tradeoff I see is that making profiles agent-like lets them show up naturally across more surfaces and be set as defaults, but it also means every existing TuiAgent path has to remember to resolve profile ids back to a base agent and pass profile metadata through. In review I found a few places where a profile id is accepted but the startup builder does not receive agentProfiles, so launch planning can fail or drop profile args/env.

What benefits are you aiming for with the first-class profile-id model over the built-in-agent-plus-profile-id approach?

That makes sense. I modeled profiles as TuiAgent IDs mainly because I wanted duplicated agents to behave like first-class choices across every existing selector/default surface without adding parallel profile plumbing to each UI.

The benefit was UX/surface coverage: Claude (foo) can be selected anywhere an agent is selected, set as a default, and ordered directly under Claude.

But I agree the downside is real: it expands the meaning of TuiAgent from “agent implementation” to “implementation or launch profile,” which forces base-agent resolution and profile metadata threading through many paths. The follow up bugs around missing agentProfiles and stripped args/env are evidence of that cost.

I’m open to aligning with #5728’s model if we can preserve the UX goals from this PR:

  • profiles show up in the same launch/default surfaces users expect
  • profile choices can be ordered under their base agent
  • profile args/env support {repoPath} and {worktreePath}
  • `ource-control/automation/quick-command launch paths can use profiles consistently

So I think the right convergence may be: keep built-in TuiAgent as the implementation identity, represent profiles as separate launch choices/profile IDs, and introduce a higher-level “agent launch choice” type for UI/default surfaces instead of making profile IDs part of TuiAgent.

@AmethystLiang

Copy link
Copy Markdown
Contributor

will get this landed hopefully by the end of tmr!

tmchow added 3 commits July 1, 2026 13:22
…ubeworm

# Conflicts:
#	src/main/runtime/orca-runtime.ts
#	src/renderer/src/components/settings/AgentsPane.tsx
#	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-in-new-tab.ts
@nwparker nwparker added the enhancement New feature or request label Jul 27, 2026
@philipp-thirdmind

Copy link
Copy Markdown

any updates on this?

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.

5 participants