Skip to content

feat: add custom agent launch profiles - #17668

Draft
Dhi13man wants to merge 13 commits into
stablyai:mainfrom
Dhi13man:Dhi13man/custom-agents
Draft

Dhi13man wants to merge 13 commits into
stablyai:mainfrom
Dhi13man:Dhi13man/custom-agents

Conversation

@Dhi13man

@Dhi13man Dhi13man commented Aug 31, 2026 •

Copy link
Copy Markdown

ELI5

Orca can save Codex Luna (codex --model luna) without changing normal
Codex, then use that profile for new terminals and automations. It can also save
an unsupported CLI as a custom terminal agent.

What changed

  • Create custom agents from a command and literal arguments, or duplicate an
    installed agent and edit the copy.
  • Show Custom agents directly below Installed with the same enabled, default,
    and expandable row controls.
  • Select enabled custom agents when opening a terminal; the chosen profile
    launches with its own command and arguments.
  • Select provider-backed custom agents in automations while preserving the
    built-in provider identity separately from the custom profile.
  • Retain duplicated provider identity while the executable is unchanged;
    editing the executable removes that identity.
  • Reuse Orca's local, WSL, and Unix SSH launch paths; paired Orca hosts and
    Windows SSH fail closed where custom arguments cannot be carried safely.

Why

Built-in launch arguments are global. Named profiles keep variants such as
Codex Luna independent while leaving the built-in Codex launch unchanged.

Related issue

Related to #18249. This PR covers local launch profiles; plugin-contributed
agent definitions remain outside its scope.

Visual proof

Before — Agent settings

Stability AI main has no Custom agents section.

Agent settings before this change, with Installed followed by Available to install

After — Agent settings

Codex Luna appears directly below Installed and reuses its row controls.

Agent settings after this change, with Codex Luna below Installed and using the same enabled, default, delete, and expand controls

After — New terminal in a worktree

Codex Luna is selectable from the existing New tab menu.

Worktree New tab menu with Codex Luna available alongside installed agents

After — New automation

Codex Luna is selectable in the existing automation agent picker.

Create automation dialog with Codex Luna selected in the agent picker

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained below

Full local verification before sync for exact head 0952d1cbf, rebased onto
Stability AI main at 67e22345d:

  • pnpm tc
  • pnpm build
  • All 20 changed test files: 47 suites and 240 tests passed.
  • Exact-head Windows and launch subset: 4 files and 29 tests passed.
  • pnpm run check:code-quality:changed -- stability/main: no code-quality,
    type-aware, or React Doctor findings across 69 changed source files.
  • Pre-commit oxlint, React Doctor, and format hooks.
  • git diff --check stability/main...HEAD.
  • Electron Playwright over CDP: 3/3 rendered journeys passed, covering the
    settings row, worktree terminal selection, and automation selection plus
    persisted agentId/customAgentProfileId identity.

Post-sync verification for exact head ffa21396e, rebased onto Stability AI
main at 9aa0f7e77:

  • 18 directly affected test files: 225 tests passed.
  • pnpm run check:code-quality:changed -- stability/main: no code-quality,
    type-aware, or React Doctor findings across 69 changed source files.
  • git diff --check stability/main...HEAD.

The full cross-platform repository matrix remains delegated to CI.

AI disclosure

OpenAI Codex assisted implementation, testing, review, and PR preparation.

Review

  • Security: bounded literal inputs reject control characters; profiles store no
    credentials. Windows carries launch data outside the process command line and
    uses no execution-policy bypass or encoded PowerShell command.
  • Compatibility: folder workspaces, local macOS/Linux/Windows, WSL, and Unix
    SSH use existing execution routing. Paired runtimes and Windows SSH fail
    closed where the existing contract cannot carry custom launch behavior.
  • Remote wire: customAgentProfileId is optional; old definitions remain valid,
    and client-local custom profiles are not sent to paired hosts.
  • Performance: profiles are bounded and add no polling or background work.

Agent skill upstream boundary

  • Not applicable, or this change follows
    docs/reference/agent-skill-sharing-upstream-boundary.md and copies or
    mechanically translates no upstream skill-installer source, tests, fixtures,
    registry entries, path tables, comments, or documentation.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • 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)

@Dhi13man
Dhi13man requested a review from brennanb2025 as a code owner August 31, 2026 09:14

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

ℹ️ One scope issue worth cleaning up — no functional concerns found.

Reviewed changes

Reviewed the complete diff (117 files) for the custom-agent-profiles feature end to end: the shared profile model and normalization, host-authoritative startup planning in the runtime, the RPC schemas and mixed-version capability gate, the renderer settings/combobox/tab-bar/composer surfaces, and the sleep/resume + paired-tab snapshot persistence.

  • Profile model — derived/generic CustomAgentProfile types with bounded string/argv normalization (control-char rejection, 32-profile cap, 16 KB argv budget) and per-shell literal quoting in src/shared/custom-agent-profile.ts.
  • Windows cmd launch — a bounded PowerShell bootstrap that ships argv through an encoded one-shot env var (ORCA_CUSTOM_AGENT_WINDOWS_ARGV_V1) and a self-cleaning temp .cmd runner; covered by real-process corpus tests (metacharacters, Unicode, empty args, spaces, max payload, cleanup).
  • Host-authoritative startup — buildCustomAgentStartupPlan builds the exact command on the execution host, inheriting base-agent env for derived profiles while pinning the literal executable + argv; Windows SSH and stale paired hosts fail closed.
  • Wire contract — additive customAgentProfile* RPC fields plus the terminal.custom-agent-launch.v1 capability, gated so mixed-version clients/hosts degrade safely.
  • Surfaces — Agent settings CRUD with serialized deletes and write-failure retention, the agent combobox and tab-bar menus, quick/folder composer threading of AgentLaunchSelection, and snapshot persistence through the session schema, sleeping-agent records, and paired-tab sync.

ℹ️ Unrelated Wear OS planning document bundled into the PR

docs/wear-os-command-center-plan.md (826 lines) is a Wear OS "command center" planning document that has nothing to do with custom agent profiles. It came in via the merge of the fork's main (d799be7913 docs(wear): plan Expo command center (#1)) rather than being authored here, and it will land in the repository with this PR.

Technical details
# Unrelated file bundled into the diff

## Affected sites
- docs/wear-os-command-center-plan.md — 826-line Wear OS planning doc, unrelated to this feature.

## Required outcome
- Drop the file from this PR (or split it into its own change) so the custom-agent-profiles diff only contains feature code.

## Suggested approach (optional)
- Rebase the branch on the upstream `main` base (the doc was merged into the fork's `main` separately) rather than deleting it in a follow-up commit.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@Dhi13man
Dhi13man force-pushed the Dhi13man/custom-agents branch from a6e23d9 to a713eb7 Compare August 31, 2026 10:56
@Dhi13man Dhi13man changed the title feat: add custom agent profiles feat: add custom agent launch profiles Aug 31, 2026
@greptile-apps

greptile-apps Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR adds persisted custom agent launch profiles and exposes them in the existing-workspace New tab menu.

  • Adds normalized create, edit, delete, and built-in duplication workflows under Agent settings.
  • Preserves allowlisted built-in bootstrap identity for duplicated profiles while keeping generic profiles unclaimed.
  • Transports literal argv across POSIX, WSL, and native Windows shells and rejects unsupported paired-runtime and Windows-SSH launches.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/shared/custom-agent-profile.ts Defines bounded profile normalization, allowlisted duplicated-provider identity, and shell-safe literal argv construction.
src/renderer/src/lib/launch-custom-agent-in-new-tab.ts Routes custom launches by execution host and platform, rejects unsupported targets, and seeds optional bootstrap identity.
src/renderer/src/components/settings/CustomAgentProfilesSection.tsx Implements profile creation, editing, deletion, normalization, and persistence.
src/renderer/src/components/tab-bar/QuickLaunchButton.tsx Adds custom profiles to direct New tab launches while preserving the intentional prompt-bearing picker boundary.
src/main/persistence/loading-store/normalize-loaded-global-settings.ts Normalizes persisted custom profiles during settings restoration.
src/main/persistence/applying-settings/settings-update.ts Enforces profile normalization at the main-process settings write boundary.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A[Saved custom profile] --> B[Normalize profile]
    B --> C[Select worktree]
    C --> D{Execution host}
    D -->|Paired runtime| E[Reject unsupported launch]
    D -->|Windows SSH| E
    D -->|Local, WSL, or Unix SSH| F[Resolve platform and shell]
    F --> G[Encode literal argv]
    G --> H[Create terminal tab]
    H --> I[Queue startup command]
    B --> J{Allowlisted duplicated identity?}
    J -->|Yes| K[Seed launchAgent]
    J -->|No| L[Leave provider unclaimed]
    K --> H
    L --> H
Loading

Reviews (4): Last reviewed commit: "fix(agents): bind identity to executable" | Re-trigger Greptile

@Dhi13man

Dhi13man commented Aug 31, 2026 •

Copy link
Copy Markdown
Author

Thanks for the review. These are deliberate scope boundaries, not accidental omissions:

  • A custom profile in this PR is a named terminal launch profile with an exact executable and literal argv. Duplicating a built-in retains its allowlisted provider identity on the tab and startup request; generic command profiles make no provider claim. Custom profiles do not opt into sleep/resume behavior or structured-chat support.
  • Paired-runtime support requires additive wire contracts and mixed-version capability negotiation. This PR explicitly rejects that route rather than expanding a local launch-profile feature into remote protocol work.
  • The prompt-bearing use of this shared picker is the review-notes send flow. Generic harnesses have no provider prompt-delivery contract, so listing them there would offer behavior Orca cannot honor.

The concrete use cases covered here are independent codex --model luna sessions alongside normal Codex launches, and unsupported CLIs such as dhimanex, from the existing-workspace New tab menu on local, WSL, and Unix SSH terminals. The PR body calls out the unsupported surfaces. Sleep/resume metadata and paired-runtime transport can be evaluated as separate follow-ups without coupling them to this minimal change.

@coderabbitai

coderabbitai Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds validated custom agent profiles with persisted settings, shell-specific launch commands, and profile management UI. Automations can select, store, validate, dispatch, and display custom profiles. Quick launch, keyboard shortcuts, terminal tabs, and background sessions support custom profile execution. Windows-specific argument transport receives dedicated tests and CI coverage.

Merge Risk: 🟡 Moderate · up to 92cd4

This PR adds persisted custom launch profiles to terminals and automations, but current behavior can override a template-selected agent, reuse sessions with outdated profile arguments, or exceed Windows launch limits; concurrent settings edits may also lose profile changes. These are bounded but concrete merge-readiness risks that should be fixed or explicitly accepted before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 55 functions across 51 files. (20 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly and concisely describes the main change: adding custom agent launch profiles.
Description check ✅ Passed The description is complete and directly aligned with the pull request. It includes the change summary, rationale, linked issue, visual proof, testing, AI disclosure, scope boundaries, security and co…
Full details: Docstring Coverage

Explanation

Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 55 functions across 51 files. (20 skipped: 2 unsupported, 18 over the file limit.)

  • Fix all pre-merge checks with AI

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: 5

🧹 Nitpick comments (1)
src/renderer/src/components/tab-bar/QuickLaunchButton.tsx (1)

253-255: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a named interpolation placeholder.

Replace {{value0}} with a semantic placeholder such as {{profileName}}. Update the options object and locale value together.

Based on learnings, new user-facing TypeScript and TSX strings must use intent-named localization IDs with named interpolation placeholders.

Source: Learnings


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 783e08ff-2a61-4f56-8d92-bc45382de687

📥 Commits

Reviewing files that changed from the base of the PR and between 75e5c99 and a713eb7fe9c061c5dc23e66db446266a9ad31e39.

📒 Files selected for processing (24)
  • src/main/persistence-settings-update.test.ts
  • src/main/persistence/applying-settings/settings-update.ts
  • src/main/persistence/loading-store/normalize-loaded-global-settings.ts
  • src/renderer/src/components/agent/AgentSettingsDialog.tsx
  • src/renderer/src/components/settings/AgentCatalogRow.tsx
  • src/renderer/src/components/settings/AgentsPane.test.tsx
  • src/renderer/src/components/settings/AgentsPane.tsx
  • src/renderer/src/components/settings/CustomAgentProfileEditor.tsx
  • src/renderer/src/components/settings/CustomAgentProfilesSection.test.tsx
  • src/renderer/src/components/settings/CustomAgentProfilesSection.tsx
  • src/renderer/src/components/settings/custom-agent-profile-draft.test.ts
  • src/renderer/src/components/settings/custom-agent-profile-draft.ts
  • src/renderer/src/components/settings/settings-capability-section-renderers.tsx
  • src/renderer/src/components/tab-bar/QuickLaunchButton.test.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/launch-custom-agent-in-new-tab.test.ts
  • src/renderer/src/lib/launch-custom-agent-in-new-tab.ts
  • src/renderer/src/store/slices/settings.ts
  • src/shared/custom-agent-profile.test.ts
  • src/shared/custom-agent-profile.ts
  • src/shared/custom-agent-profile.win32.test.ts
  • src/shared/default-global-settings.ts
  • src/shared/global-settings-types.ts

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

Comment thread src/shared/custom-agent-profile.ts Resolved
Comment thread src/shared/custom-agent-profile.ts Resolved

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

✅ No new issues found.

Reviewed changes

Reviewed the 24-file rewrite of the custom-agent feature against the prior pullfrog review (which covered the superseded 117-file implementation):

  • Profile model — a single CustomAgentProfile (id/name/executable/ordered literal args) with bounded string normalization, control-character rejection, a 32-profile cap, a 256-arg / 16 KiB argv budget, and reserved built-in name rejection in src/shared/custom-agent-profile.ts.
  • Launch path — launchCustomAgentInNewTab builds a shell-quoted command and queues it through the existing terminal route, resolving platform/shell from SSH state, WSL paths, and the project runtime; paired Orca runtimes and Windows SSH fail closed with a toast.
  • Windows argv transport — a bounded PowerShell bootstrap ships argv via a one-shot base64 env var into a Get-Command-resolved temp .cmd runner, with %/! neutralized and exit-code propagation.
  • Settings surfaces — Agent-settings CRUD with serialized deletes, write-failure retention, and duplicate-as-custom for built-in agents, plus the tab-bar quick-launch menu entry.
  • Prior concern resolved — the unrelated Wear OS planning document flagged in the previous review is no longer in the diff.

The Windows quoting corpus test (custom-agent-profile.win32.test.ts) is describe.skip on non-Windows, so it does not run on Linux CI; it is the only part of this feature that requires a Windows host to exercise.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@Dhi13man
Dhi13man force-pushed the Dhi13man/custom-agents branch from a713eb7 to 89c6f8c Compare August 31, 2026 11:42
@Dhi13man

Dhi13man commented Aug 31, 2026 •

Copy link
Copy Markdown
Author

Reviewed the remaining CodeRabbit interpolation nit: retained {{value0}} deliberately because the adjacent built-in launch title uses the exact same Launch {{value0}} in a new terminal contract, and the English catalog contains 1,034 positional value0 placeholders. Changing only the custom row would make sibling strings inconsistent. Localization catalog, extraction, and coverage gates all pass.

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

✅ No new issues found.

Reviewed changes

Reviewed the delta since the prior pullfrog review (a713eb7):

  • Remote-server duplication guard — AgentsPane now disables duplicate-as-custom while an active server environment is selected, matching the fact that custom profiles can't launch on paired Orca runtimes.
  • Stale persistence-error cleanup — cancelling the editor and re-attempting a failed delete now clear the previous write error.
  • Launch watchdog for custom agents — the terminal-launch watchdog was extracted into watchTerminalLaunch and applied to custom-profile launches so they surface the same "terminal did not start" toast.
  • Windows argv safety — profile normalization gained a Windows env-var length guard, and the decoded argv is now wrapped in @() so a single-element argv (a profile with no arguments) no longer unwraps to a scalar in the PowerShell bootstrap.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

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

Important

A profile duplicated from a built-in agent keeps its baseAgent tag even after its executable is edited, so a repointed binary still launches with the original agent's launchAgent — firing Codex-specific launch prep for a process that isn't Codex.

Reviewed changes

Reviewed the single new commit 19bb69f ("fix(agents): retain duplicated identity") since the prior pullfrog review at 89c6f8c:

  • Added baseAgent to the profile contract — CustomAgentProfile gains an optional baseAgent: TuiAgent, retained by normalizeCustomAgentProfile only when isTuiAgent passes.
  • Stamped launchAgent at launch — launchCustomAgentInNewTab now forwards profile.baseAgent as launchAgent on both createTab and queueTabStartupCommand.
  • Propagated the tag from duplication — duplicateBuiltInAgentAsCustom records baseAgent: agent.id, and the persistence/launch tests were updated to assert the new field.

The duplication happy path (duplicate Codex → tweak a model flag) is correct and restores the provider identity the tab previously dropped. The issue below is the desync when a duplicated profile is later edited.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Comment thread src/shared/custom-agent-profile.ts Resolved

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

✅ No new issues found.

Reviewed changes

Reviewed the single new commit 8a1ed1a ("fix(agents): bind identity to executable") since the prior pullfrog review at 19bb69f:

  • Bound duplicated identity to the executable — CustomAgentProfile gains a persisted baseAgentExecutable, captured at duplication as commandTokens[0]; normalizeCustomAgentProfile now retains baseAgent only when isTuiAgent(baseAgent) and baseAgentExecutable === executable.
  • Severed identity on executable edit — an argument-only edit keeps the provider tag, but repointing executable drops both identity fields through the editor save path, persistence load/update, and the launch path (all normalize the collection before launchAgent is stamped).
  • Coverage for the desync — new tests prove argument-only variants retain Codex identity, and that the editor-save, normalization, and launch paths all drop launchAgent for a repointed profile.

The prior IMPORTANT finding (a duplicated-then-edited profile launching with a stale baseAgent) is fully addressed; the comparison also re-derives identity from a normalized executable, so stale/imported state cannot reach Codex-specific launch prep.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@Dhi13man

Dhi13man commented Sep 1, 2026 •

Copy link
Copy Markdown
Author

Local testing is complete on 0ab4b9b7e: the 69,600-test Linux-native suite, 48-test Windows review-regression lane, typecheck, lint, production/Electron builds, and all three Electron journeys pass.

@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

🧹 Nitpick comments (1)
src/renderer/src/components/settings/AgentsPane.test.tsx (1)

179-180: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert that each section heading is present before comparing order.

indexOf returns -1 for a missing string. If the "Installed" section disappears, -1 < index still passes. If "Custom agents" disappears, -1 < indexOf('Available to install') also passes. Both ordering assertions can then succeed while the layout under test is broken.

Assert the indices are non-negative first.

💚 Proposed fix
     expect(markup).toContain('Duplicate Claude as custom agent')
-    expect(markup.indexOf('Installed')).toBeLessThan(markup.indexOf('Custom agents'))
-    expect(markup.indexOf('Custom agents')).toBeLessThan(markup.indexOf('Available to install'))
+    const installedIndex = markup.indexOf('Installed')
+    const customIndex = markup.indexOf('Custom agents')
+    const availableIndex = markup.indexOf('Available to install')
+    expect(installedIndex).toBeGreaterThanOrEqual(0)
+    expect(customIndex).toBeGreaterThanOrEqual(0)
+    expect(availableIndex).toBeGreaterThanOrEqual(0)
+    expect(installedIndex).toBeLessThan(customIndex)
+    expect(customIndex).toBeLessThan(availableIndex)

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: b80fb0e4-d142-42d5-a76a-d84353529888

📥 Commits

Reviewing files that changed from the base of the PR and between 8a1ed1a64dfc46ff0365b6d6ff4c351208ff68c2 and b20d4c144ae223544f7f2dcf76fa935ed047e96f.

📒 Files selected for processing (19)
  • src/renderer/src/components/Terminal.tsx
  • src/renderer/src/components/settings/AgentCatalogRow.tsx
  • src/renderer/src/components/settings/AgentDefaultSetting.tsx
  • src/renderer/src/components/settings/AgentDetectionCatalog.tsx
  • src/renderer/src/components/settings/AgentSettingsRow.tsx
  • src/renderer/src/components/settings/AgentsPane.test.tsx
  • src/renderer/src/components/settings/AgentsPane.tsx
  • src/renderer/src/components/settings/CustomAgentProfileEditor.tsx
  • src/renderer/src/components/settings/CustomAgentProfilesSection.test.tsx
  • src/renderer/src/components/settings/CustomAgentProfilesSection.tsx
  • src/renderer/src/components/settings/custom-agent-profile-draft.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.test.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/launch-custom-agent-in-new-tab.test.ts
  • src/renderer/src/lib/launch-custom-agent-in-new-tab.ts
  • src/shared/custom-agent-profile.test.ts
  • src/shared/custom-agent-profile.ts
  • src/shared/custom-agent-profile.win32.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/components/settings/CustomAgentProfileEditor.tsx

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

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

✅ No new issues found.

Reviewed changes

Reviewed the delta since the prior pullfrog review at 8a1ed1a — the single new commit b20d4c1 ("feat(agents): align custom profiles with agent settings"):

  • Enabled/default profile state — CustomAgentProfile gains enabled/isDefault, with normalizeCustomAgentProfile dropping the default flag from disabled profiles and normalizeCustomAgentProfiles enforcing a single default via setDefaultCustomAgentProfile/getDefaultCustomAgentProfile/isCustomAgentProfileEnabled.
  • Default-custom launch routing — the tab.newAgent shortcut and the quick-launch menu now prefer the default custom profile (ordered first, disabled profiles hidden, shortcut badge on the default), while built-in agents suppress their shortcut badge while a custom default is active.
  • Shared row primitives — AgentSettingsRow/AgentRowAction/AgentAvailabilityControl extracted into AgentSettingsRow.tsx, with AgentCatalogRow and CustomAgentProfilesSection rebuilt on top of them (inline enable/disable and set-default controls).
  • Non-nullable launch build — buildCustomAgentLaunch now returns CustomAgentLaunch (input is pre-normalized), and launchCustomAgentInNewTab rejects disabled profiles with a toast.

The prior IMPORTANT finding (stale baseAgent after an executable edit) was already resolved at 8a1ed1a and remains correctly handled: normalization still binds provider identity to the normalized executable.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@Dhi13man
Dhi13man force-pushed the Dhi13man/custom-agents branch from b20d4c1 to d719bdb Compare September 1, 2026 20:11

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

✅ No new issues found.

Reviewed changes

Reviewed the delta since the prior pullfrog review at b20d4c1:

  • Shortcut resolution extracted — the inline tab.newAgent custom-profile logic was moved out of Terminal.tsx into a dedicated resolveTerminalAgentTabShortcut in terminal-agent-tab-shortcut.ts (returning { actionId, agent, customAgentProfileId }), and handleNewCustomAgentTab moved into use-terminal-create-actions.ts; terminal-workspace-keydown.ts now dispatches on customAgentProfileId before agent.
  • Disabled default fixed — QuickLaunchButton now derives defaultCustomAgent from enabledCustomProfiles rather than all normalized profiles, so a disabled profile carrying a stale isDefault flag no longer suppresses the built-in agent's shortcut badge or takes the default-first slot; a regression test covers this.
  • Settings wiring — AgentSettingsDialog now passes updateSettingsOrThrow through to AgentsPane so profile persistence failures surface through the existing throw path.

The extraction is faithful: the old inline handler computed resolveDefaultAgentForNewTab twice and the new module computes it once with no behavioral change. Disabled-default handling is now consistent across the shortcut path (getDefaultCustomAgentProfile, which normalizes and strips isDefault from disabled profiles) and the quick-launch menu. Focused tests (custom-agent-profile, terminal-agent-tab-shortcut, QuickLaunchButton) all pass.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@Dhi13man

Dhi13man commented Sep 2, 2026

Copy link
Copy Markdown
Author

Hey @brennanb2025. This is mostly a problem I solved for myself with Orca. Should be ready for your eyes. Let me know if you would like any changes or if we should proceed another way.

@Dhi13man
Dhi13man force-pushed the Dhi13man/custom-agents branch 2 times, most recently from c02a1f8 to acac23f Compare September 2, 2026 11:50
@Dhi13man

Dhi13man commented Sep 2, 2026

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

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

ℹ️ No critical issues — one minor coverage gap worth considering.

Reviewed changes

Reviewed the automations delta since the prior pullfrog review at d719bdb (the branch was rebased, so this run's delta is c02a1f8..acac23f):

  • Automation model + wire — added customAgentProfileId to Automation, the create/update input types, the RPC create/update schemas (update uses OptionalNullablePlainString so null clears the field), the runtime controller forwarding, and createAutomation/updateAutomation persistence.
  • Custom startup planning — new custom-agent-automation-startup.ts replays the base provider's prompt-injection mode over the profile's literal executable + args, preserving the Windows argv transport env and Codex shell-ready delivery; launch-agent-background-session.ts now routes through buildAutomationAgentStartupPlan.
  • Fail-closed dispatch — handleAutomationDispatchRequest resolves the profile via findEnabledCustomAgentProfile and errors when missing/disabled; saveOrcaAutomation blocks custom profiles for runtime-host destinations; the serve-mode headless dispatcher throws.
  • Editor + list surfaces — AgentCombobox/AgentComboboxItem list custom profiles with provider icons; list rows, search, and use-automation-agent-label resolve the profile name.
  • Test infra — registered custom-agent-profile.win32.test.ts in CI (pr.yml + pr-code-change-scope.mjs) and switched its temp-dir cleanup to the retrying removeTreeSync.

ℹ️ Session reuse is not profile-aware

An automation with reuseSession: true that carries a custom profile will reuse a prior run's live session keyed only on agentId (the base provider). If the automation's customAgentProfileId is edited between runs, the next dispatch submits the prompt to a session launched with the previous profile's executable/args instead of relaunching with the new ones.

Technical details
# Session reuse ignores customAgentProfileId

## Affected sites
- src/renderer/src/hooks/automation-dispatch-handler.ts:104 — `findReusableAutomationSession({ automationId, agentId, ... })` does not pass `customAgentProfileId`.
- src/renderer/src/lib/automation-session-reuse.ts:69 — `isReusableAgentStatus(entry, agentId)` matches on the base provider only, so a `codex-luna` and a `codex-default` session are indistinguishable.

## Required outcome
- A reuse candidate must not be returned when its launch profile differs from the dispatching automation's current `customAgentProfileId` (including the transition from a profile back to the plain base agent).

## Open questions for the human (optional)
- Is this a deferred follow-up, or should reuse be disabled for custom-profile automations until the match key includes the profile?

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

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/components/automations/use-automation-editor-actions.ts (1)

97-97: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Clear the custom profile when the template selects an agent.

If template.agentId is defined, also set customAgentProfileId to null. Otherwise, a default custom profile remains selected and overrides the template-selected built-in agent.

Proposed fix
           dayOfWeek: template.dayOfWeek ?? baseDraft.dayOfWeek,
           agentId: template.agentId ?? baseDraft.agentId,
+          customAgentProfileId:
+            template.agentId === undefined ? baseDraft.customAgentProfileId : null,
           missedRunGraceMinutes: template.missedRunGraceMinutes ?? baseDraft.missedRunGraceMinutes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: a1a86566-c099-40ca-900e-6bdb84404892

📥 Commits

Reviewing files that changed from the base of the PR and between e5a1e79 and 92cd4606133ee0c6a1dcd2a5f7a4903646947929.

📒 Files selected for processing (70)
  • .github/workflows/pr.yml
  • config/scripts/pr-code-change-scope.mjs
  • src/main/automations/service.test.ts
  • src/main/persistence-settings-update.test.ts
  • src/main/persistence/applying-settings/settings-update.ts
  • src/main/persistence/loading-store/normalize-loaded-global-settings.ts
  • src/main/persistence/scheduling-automations/automation-definition-operations.ts
  • src/main/runtime/rpc/methods/automation-schemas.ts
  • src/main/runtime/rpc/methods/automations.test.ts
  • src/main/runtime/runtime-automation-controller.ts
  • src/main/startup/main-process-automations.ts
  • src/renderer/src/components/agent/AgentCombobox.test.tsx
  • src/renderer/src/components/agent/AgentCombobox.tsx
  • src/renderer/src/components/agent/AgentComboboxItem.tsx
  • src/renderer/src/components/agent/AgentSettingsDialog.tsx
  • src/renderer/src/components/automations/AutomationDetail.tsx
  • src/renderer/src/components/automations/AutomationEditorDialog.tsx
  • src/renderer/src/components/automations/AutomationEditorSettingsSidebar.tsx
  • src/renderer/src/components/automations/AutomationListLocalRows.tsx
  • src/renderer/src/components/automations/AutomationSchedulePicker.render.test.tsx
  • src/renderer/src/components/automations/AutomationSchedulePicker.test.ts
  • src/renderer/src/components/automations/AutomationsPage.create-destination.test.tsx
  • src/renderer/src/components/automations/automation-draft-model.ts
  • src/renderer/src/components/automations/automation-edit-draft.ts
  • src/renderer/src/components/automations/automation-list-search-rows.test.ts
  • src/renderer/src/components/automations/automation-list-search-rows.ts
  • src/renderer/src/components/automations/automation-orca-save.ts
  • src/renderer/src/components/automations/automation-save-action.ts
  • src/renderer/src/components/automations/use-automation-agent-label.ts
  • src/renderer/src/components/automations/use-automation-editor-actions.ts
  • src/renderer/src/components/automations/use-automation-list-search.ts
  • src/renderer/src/components/automations/use-automations-page-local-state.ts
  • src/renderer/src/components/automations/use-automations-page-store-state.ts
  • src/renderer/src/components/settings/AgentCatalogRow.tsx
  • src/renderer/src/components/settings/AgentDefaultSetting.tsx
  • src/renderer/src/components/settings/AgentDetectionCatalog.tsx
  • src/renderer/src/components/settings/AgentSettingsRow.tsx
  • src/renderer/src/components/settings/AgentsPane.test.tsx
  • src/renderer/src/components/settings/AgentsPane.tsx
  • src/renderer/src/components/settings/CustomAgentProfileEditor.tsx
  • src/renderer/src/components/settings/CustomAgentProfilesSection.test.tsx
  • src/renderer/src/components/settings/CustomAgentProfilesSection.tsx
  • src/renderer/src/components/settings/custom-agent-profile-draft.test.ts
  • src/renderer/src/components/settings/custom-agent-profile-draft.ts
  • src/renderer/src/components/settings/settings-capability-section-renderers.tsx
  • src/renderer/src/components/tab-bar/QuickLaunchButton.test.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
  • src/renderer/src/components/terminal-agent-tab-shortcut.test.ts
  • src/renderer/src/components/terminal-agent-tab-shortcut.ts
  • src/renderer/src/components/terminal-workspace-keydown.ts
  • src/renderer/src/components/use-terminal-create-actions.ts
  • src/renderer/src/components/use-terminal-keyboard-shortcuts.ts
  • src/renderer/src/hooks/automation-dispatch-handler.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/agent-background-session-contract.ts
  • src/renderer/src/lib/agent-picker-search.ts
  • src/renderer/src/lib/launch-agent-background-session.test.ts
  • src/renderer/src/lib/launch-agent-background-session.ts
  • src/renderer/src/lib/launch-custom-agent-in-new-tab.test.ts
  • src/renderer/src/lib/launch-custom-agent-in-new-tab.ts
  • src/renderer/src/store/slices/settings.ts
  • src/shared/automations-types.ts
  • src/shared/custom-agent-automation-startup.test.ts
  • src/shared/custom-agent-automation-startup.ts
  • src/shared/custom-agent-profile.test.ts
  • src/shared/custom-agent-profile.ts
  • src/shared/custom-agent-profile.win32.test.ts
  • src/shared/default-global-settings.ts
  • src/shared/global-settings-types.ts
  • src/shared/pane-agent-identity-inventory.test.ts
🚧 Files skipped from review as they are similar to previous changes (23)
  • src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
  • src/renderer/src/components/settings/CustomAgentProfilesSection.test.tsx
  • src/renderer/src/components/agent/AgentSettingsDialog.tsx
  • src/renderer/src/store/slices/settings.ts
  • src/main/persistence/loading-store/normalize-loaded-global-settings.ts
  • src/shared/global-settings-types.ts
  • src/shared/default-global-settings.ts
  • src/renderer/src/components/settings/AgentsPane.test.tsx
  • src/main/persistence/applying-settings/settings-update.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.test.ts
  • src/renderer/src/components/settings/AgentDefaultSetting.tsx
  • src/renderer/src/components/settings/custom-agent-profile-draft.test.ts
  • src/renderer/src/components/settings/CustomAgentProfileEditor.tsx
  • src/renderer/src/components/settings/AgentSettingsRow.tsx
  • src/renderer/src/components/settings/settings-capability-section-renderers.tsx
  • src/main/persistence-settings-update.test.ts
  • src/renderer/src/components/settings/CustomAgentProfilesSection.tsx
  • src/renderer/src/lib/launch-custom-agent-in-new-tab.test.ts
  • src/renderer/src/components/settings/AgentsPane.tsx
  • src/renderer/src/components/settings/AgentCatalogRow.tsx
  • src/renderer/src/components/settings/custom-agent-profile-draft.ts
  • src/renderer/src/components/settings/AgentDetectionCatalog.tsx
  • src/shared/custom-agent-profile.test.ts

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

Comment thread src/shared/custom-agent-profile.ts Resolved
@Dhi13man
Dhi13man force-pushed the Dhi13man/custom-agents branch from 92cd460 to 0ab4b9b Compare September 2, 2026 12:43
@Dhi13man

Dhi13man commented Sep 3, 2026

Copy link
Copy Markdown
Author

Local testing is done on the rebased head.

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

✅ No new issues found.

Reviewed changes

Reviewed the single new commit 0952d1c ("fix(agents): harden Windows custom launch transport") since the prior pullfrog review:

  • Dropped -EncodedCommand / -ExecutionPolicy Bypass — the Windows bootstrap now runs powershell.exe -NoProfile -NonInteractive -Command with a plain-text script, removing the EDR-posture signals documented in docs/reference/windows-edr-posture.md.
  • Moved cmd quoting into the shared layer — the inline PowerShell Quote-CmdArgument helper was replaced by quoteWindowsCmdArgument (a faithful port), so argv is pre-quoted once and shipped as a structured { executable, runner } payload in ORCA_CUSTOM_AGENT_WINDOWS_RUNNER_V1.
  • Resolved the executable via an env reference — the runner references the exe through %ORCA_CUSTOM_AGENT_WINDOWS_EXECUTABLE_V1% (resolved by Get-Command), keeping the exe path out of cmd's %-expansion; only args are %-doubled.
  • Inlined the PowerShell shell case — the powershell shell now emits the transport script bare (dropping the redundant nested powershell.exe), matching the built-in launchCommand contract (buildShellCommandFromArgv → & ...).
  • Tightened the env-length guard — fitsWindowsEnvironmentValue now measures the actual encoded runner payload rather than a base64-size estimate, and the win32 corpus tests were updated to cover the new transport and exit-code propagation.

The quoting logic is a faithful port of the previously-reviewed PowerShell mechanism (verified equivalent to quoteWindowsCmdArgument), and the round-trip corpus — metacharacters, Unicode, empty args, spaces, %VAR%, and exit-code propagation — remains covered by custom-agent-profile.win32.test.ts (run on Windows; describe.skip on non-Windows, as previously noted).

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@Dhi13man
Dhi13man force-pushed the Dhi13man/custom-agents branch from 1f4cba1 to ffa2139 Compare September 11, 2026 12:42
@webparadoxer

Copy link
Copy Markdown

waiting on orca too?

@Dhi13man

Copy link
Copy Markdown
Author

waiting on orca too?

I think Orca is building this. Until then, I am using this fork of mine for my usecases. Just have to annoyingly rebase this every now and then and rebuild :)

@Dhi13man

Copy link
Copy Markdown
Author

Converted to Draft because I don't think Orca team will proceed with this, as they are building their own version. Will close once their version is live (no pressure).

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.

2 participants