Skip to content

Add named launch profiles for built-in agents - #5728

Draft
brennanb2025 wants to merge 6 commits into
mainfrom
brennanb2025/agent-launch-profiles-plan
Draft

brennanb2025 wants to merge 6 commits into
mainfrom
brennanb2025/agent-launch-profiles-plan

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Settings:
image
Picker:
image

Summary

Adds named launch profiles under existing built-in TUI agents, resolving the #2521 product direction without introducing custom agent identities. Users can define per-agent launch variants with a name, optional command override, args, and env, then select those variants from the normal + agent launch picker.

Example: Codex remains the built-in Codex agent, while Work is a Codex launch profile that can run with args like --profile work. The launched terminal keeps the underlying built-in agent identity for status, detection, telemetry, and downstream behavior.

Relationship to #2521

Resolves the product direction from #2521 by replacing the proposed custom TUI-agent preset abstraction with named launch profiles under existing built-in agents. This matches the PR discussion there: Codex: Work remains Codex with a different launch configuration, while arbitrary non-agent commands remain Quick Commands.

What's Included

  • Shared AgentLaunchProfile normalization and startup-option resolution for built-in agents.
  • Settings persistence, runtime RPC, preload, and paired-web sync for GlobalSettings.agentLaunchProfiles.
  • Settings -> Agents launch-profile UI for creating, editing, saving, and deleting named profiles.
  • Profile fields for name, built-in agent, optional command override, args, and env.
  • Normal + picker integration that groups launch choices under the built-in agent row.
  • Parent agent rows with multiple launch choices show a count badge; hover/focus opens a right-side submenu.
  • Clicking the parent agent row launches the default built-in agent option; selecting a submenu profile launches that profile.
  • Safety validation that keeps command overrides to a single executable token/path and leaves arbitrary command recipes to Quick Commands.

Out of Scope

  • Managed Claude/Codex account switching.
  • Project-level default profile selection.
  • Resume/hibernation profile metadata.
  • SSH/WSL managed-account materialization.
  • Arbitrary custom/non-agent command registration.

Screenshots

Local screenshot artifacts were captured during Electron validation and intentionally not committed:

  • artifacts/agent-launch-profiles-settings.png — Settings -> Agents launch profile editor.
  • artifacts/agent-launch-profiles-grouped-picker.png — + picker with Codex showing a 2 launch-choice badge and hover submenu entries for Codex and Work.

Real CLI Profile Evidence

Safe no-prompt/profile commands were exercised with temporary CODEX_HOME directories:

  • codex --help confirmed -p, --profile layers $CODEX_HOME/<name>.config.toml.
  • CODEX_HOME=<temp> codex debug prompt-input "hello" read the base config and showed sandbox_mode = read-only.
  • CODEX_HOME=<temp> codex --profile work debug prompt-input "hello" read work.config.toml and showed the profile-specific sandbox mode.
  • No paid model prompt was sent; debug prompt-input only emits local prompt-input JSON.

AI Review Report

  • Product scope: verified this is launch-option profiles for built-in agents only, not managed accounts or arbitrary custom agents.
  • Accessibility: addressed CodeRabbit feedback by adding an accessible name/title to the icon-only delete profile button.
  • Cross-platform: addressed CodeRabbit feedback by replacing a hardcoded /tmp fixture with tmpdir() + path.join().
  • Runtime/web parity: addressed CodeRabbit feedback so paired-web launches forward the computed command when prompt, profile, or explicit args require it.
  • Picker behavior: added coverage that clicking the parent Codex row launches the default option, while the grouped menu still launches Work with profileId: codex:work.
  • Merge status: merged current origin/main and kept both upstream startup-command delivery behavior and this PR's launch-agent profile identity.

Validation

  • GitHub PR Checks verify passed on head commit 2c26b1bc5bcf6c7b3f3b373056bb13f6ef6a2dda.
  • pnpm exec vitest run --config config/vitest.config.ts src/main/persistence.test.ts -t "normalizes agent launch profiles on load and update" passed.
  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/settings/AgentLaunchProfilesSection.test.tsx src/renderer/src/components/tab-bar/QuickLaunchButton.test.ts src/renderer/src/components/tab-bar/tab-agent-launch-options.test.ts src/renderer/src/lib/launch-agent-in-new-tab.test.ts src/shared/agent-launch-profiles.test.ts src/shared/tui-agent-startup.test.ts passed: 6 files, 64 tests.
  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/tab-bar/QuickLaunchButton.test.ts src/renderer/src/components/tab-bar/tab-agent-launch-options.test.ts passed: covers default parent click and profile submenu launch behavior.
  • pnpm run typecheck:web passed.
  • pnpm run typecheck:node passed.
  • Targeted pnpm exec oxlint ... passed on changed launch-profile files.
  • Pre-commit hook passed oxlint, react-doctor oxlint config, and oxfmt across staged files.
  • git diff --check passed.

Note: local pnpm commands may emit an existing warning about ${GITHUB_TOKEN} in ~/.npmrc; it did not affect validation.


Open in Stage

@ghost

ghost commented Jun 18, 2026 •

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Jun 18, 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

This pull request introduces a named agent launch profiles system across the full stack. New shared types (AgentLaunchProfile) are added to GlobalSettings. A new src/shared/agent-launch-profiles.ts module exports normalizeAgentLaunchProfiles, resolveAgentLaunchProfile, and resolveAgentLaunchProfileStartupOptions, with validation for commandOverride syntax and compatibility default merging. The agentLaunchProfiles field is wired through persistence (load and update paths), OrcaRuntimeService get/update client settings, the settings.update RPC schema, the renderer settings slice, and the web preload API. The renderer builds tab launch options with profile variants using buildTabAgentLaunchGroups, implements an AgentLaunchProfilesSection settings UI for managing profiles, refactors launchAgentInNewTab to resolve and apply profile options, updates tab launch UI components to render and select profile entries, and extends the preload IPC surface to forward agent identity when creating terminals.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.08% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'Add named launch profiles for built-in agents' directly and clearly summarizes the main feature being implemented—adding named launch profiles under existing built-in TUI agents.
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.
Description check ✅ Passed PR description is comprehensive with clear summary, screenshots, testing validation, AI review findings, and security considerations addressed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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 and usage tips.

@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

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 19865c59-7899-4057-a4ee-7d71531655f7

📥 Commits

Reviewing files that changed from the base of the PR and between 93345e3 and fa4631b.

📒 Files selected for processing (14)
  • src/main/persistence.test.ts
  • src/main/persistence.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/client-ui.test.ts
  • src/main/runtime/rpc/methods/client-ui.ts
  • src/renderer/src/store/slices/settings.ts
  • src/renderer/src/web/web-preload-api.test.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/agent-launch-profiles.test.ts
  • src/shared/agent-launch-profiles.ts
  • src/shared/constants.ts
  • src/shared/tui-agent-startup.test.ts
  • src/shared/types.ts

Comment thread src/renderer/src/web/web-preload-api.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.

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/renderer/src/lib/launch-agent-profile-options.ts (1)

43-45: ⚡ Quick win

Add a short “why” note for explicit-vs-profile args precedence.

This agentArgs === undefined gate encodes a non-obvious contract (explicit caller args win; profile args are fallback only). A 1–2 line rationale here would prevent accidental inversion in future edits.

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

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 00dda61a-e9b3-42a9-8f89-1fd815e4715e

📥 Commits

Reviewing files that changed from the base of the PR and between 17369c6 and f0b92df.

📒 Files selected for processing (21)
  • src/main/runtime/orca-runtime.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/settings/AgentLaunchProfilesSection.test.tsx
  • src/renderer/src/components/settings/AgentLaunchProfilesSection.tsx
  • src/renderer/src/components/settings/AgentsPane.tsx
  • src/renderer/src/components/settings/agent-launch-profile-draft.ts
  • src/renderer/src/components/settings/agents-search.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
  • src/renderer/src/components/tab-bar/TabBar.tsx
  • src/renderer/src/components/tab-bar/TabBarCreateEntry.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/hooks/useIpcEvents.ts
  • src/renderer/src/lib/agent-draft-paste-after-launch.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.test.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.ts
  • src/renderer/src/lib/launch-agent-profile-options.ts
  • src/shared/agent-launch-profiles.test.ts
  • src/shared/agent-launch-profiles.ts
  • src/shared/types.ts
💤 Files with no reviewable changes (1)
  • src/shared/types.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/runtime/orca-runtime.ts

@brennanb2025 brennanb2025 changed the title Add launch profiles foundation for built-in agents Add named launch profiles for built-in agents Jun 18, 2026
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{}

@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 (3)
src/main/runtime/orca-runtime.ts (3)

8325-8331: ⚡ Quick win

Document why multi-token searches run both pattern groups.

At Line 8326, the segmented + branch-root dual search is non-obvious; add a 1–2 line rationale so future changes don’t break intended matching behavior.

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

Source: Coding guidelines


10405-10405: ⚡ Quick win

Use explicit undefined checks for automationProvenance serialization.

These writes currently use truthy checks, which can silently drop falsy-but-valid values and are inconsistent with Line 1189’s !== undefined pattern.

Suggested consistency patch
- ...(args.automationProvenance ? { automationProvenance: args.automationProvenance } : {}),
+ ...(args.automationProvenance !== undefined
+   ? { automationProvenance: args.automationProvenance }
+   : {}),

Also applies to: 10925-10925, 11257-11257


13159-13174: 🏗️ Heavy lift

Reduce positional-argument drift in createMobileSessionTerminal.

At Line 13159, this signature now has several optional positional params; the new inserted undefined at Line 3175 is a signal that callsites are becoming brittle. Prefer an options object to prevent silent argument misrouting in future edits.

Refactor direction (shape only)
- private async createMobileSessionTerminal(
-   worktreeId: string,
-   activate: boolean,
-   afterTabId?: string,
-   command?: string,
-   startupCommandDelivery?: WorktreeStartupLaunch['startupCommandDelivery'],
-   identity?: { tabId: string; leafId: string; sessionId?: string },
-   launchAgent?: TuiAgent
- )
+ private async createMobileSessionTerminal(
+   worktreeId: string,
+   opts: {
+     activate: boolean
+     afterTabId?: string
+     command?: string
+     startupCommandDelivery?: WorktreeStartupLaunch['startupCommandDelivery']
+     identity?: { tabId: string; leafId: string; sessionId?: string }
+     launchAgent?: TuiAgent
+   }
+ )

Also applies to: 3175-3178, 13067-13073


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b3600b69-0af8-41b8-bd6d-e83162804fb9

📥 Commits

Reviewing files that changed from the base of the PR and between b888e48 and 2c26b1b.

📒 Files selected for processing (16)
  • src/main/persistence.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/client-ui.test.ts
  • src/main/runtime/rpc/methods/client-ui.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/settings/AgentLaunchProfilesSection.test.tsx
  • src/renderer/src/components/settings/AgentLaunchProfilesSection.tsx
  • src/renderer/src/components/tab-bar/QuickLaunchButton.test.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
  • src/renderer/src/hooks/useIpcEvents.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/constants.ts
  • src/shared/tui-agent-startup.test.ts
  • src/shared/types.ts
🚧 Files skipped from review as they are similar to previous changes (14)
  • src/shared/constants.ts
  • src/preload/api-types.ts
  • src/main/runtime/rpc/methods/client-ui.test.ts
  • src/shared/tui-agent-startup.test.ts
  • src/renderer/src/hooks/useIpcEvents.ts
  • src/main/runtime/rpc/methods/client-ui.ts
  • src/main/persistence.test.ts
  • src/renderer/src/components/settings/AgentLaunchProfilesSection.test.tsx
  • src/renderer/src/components/settings/AgentLaunchProfilesSection.tsx
  • src/preload/index.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
  • src/renderer/src/components/tab-bar/QuickLaunchButton.test.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.ts

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

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

🧹 Nitpick comments (3)
src/main/runtime/orca-runtime.ts (3)

8325-8331: ⚡ Quick win

Document why multi-token searches run both pattern groups.

At Line 8326, the segmented + branch-root dual search is non-obvious; add a 1–2 line rationale so future changes don’t break intended matching behavior.

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

Source: Coding guidelines


10405-10405: ⚡ Quick win

Use explicit undefined checks for automationProvenance serialization.

These writes currently use truthy checks, which can silently drop falsy-but-valid values and are inconsistent with Line 1189’s !== undefined pattern.

Suggested consistency patch
- ...(args.automationProvenance ? { automationProvenance: args.automationProvenance } : {}),
+ ...(args.automationProvenance !== undefined
+   ? { automationProvenance: args.automationProvenance }
+   : {}),

Also applies to: 10925-10925, 11257-11257


13159-13174: 🏗️ Heavy lift

Reduce positional-argument drift in createMobileSessionTerminal.

At Line 13159, this signature now has several optional positional params; the new inserted undefined at Line 3175 is a signal that callsites are becoming brittle. Prefer an options object to prevent silent argument misrouting in future edits.

Refactor direction (shape only)
- private async createMobileSessionTerminal(
-   worktreeId: string,
-   activate: boolean,
-   afterTabId?: string,
-   command?: string,
-   startupCommandDelivery?: WorktreeStartupLaunch['startupCommandDelivery'],
-   identity?: { tabId: string; leafId: string; sessionId?: string },
-   launchAgent?: TuiAgent
- )
+ private async createMobileSessionTerminal(
+   worktreeId: string,
+   opts: {
+     activate: boolean
+     afterTabId?: string
+     command?: string
+     startupCommandDelivery?: WorktreeStartupLaunch['startupCommandDelivery']
+     identity?: { tabId: string; leafId: string; sessionId?: string }
+     launchAgent?: TuiAgent
+   }
+ )

Also applies to: 3175-3178, 13067-13073


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b3600b69-0af8-41b8-bd6d-e83162804fb9

📥 Commits

Reviewing files that changed from the base of the PR and between b888e48 and 2c26b1b.

📒 Files selected for processing (16)
  • src/main/persistence.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/client-ui.test.ts
  • src/main/runtime/rpc/methods/client-ui.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/settings/AgentLaunchProfilesSection.test.tsx
  • src/renderer/src/components/settings/AgentLaunchProfilesSection.tsx
  • src/renderer/src/components/tab-bar/QuickLaunchButton.test.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
  • src/renderer/src/hooks/useIpcEvents.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/constants.ts
  • src/shared/tui-agent-startup.test.ts
  • src/shared/types.ts
🚧 Files skipped from review as they are similar to previous changes (14)
  • src/shared/constants.ts
  • src/preload/api-types.ts
  • src/main/runtime/rpc/methods/client-ui.test.ts
  • src/shared/tui-agent-startup.test.ts
  • src/renderer/src/hooks/useIpcEvents.ts
  • src/main/runtime/rpc/methods/client-ui.ts
  • src/main/persistence.test.ts
  • src/renderer/src/components/settings/AgentLaunchProfilesSection.test.tsx
  • src/renderer/src/components/settings/AgentLaunchProfilesSection.tsx
  • src/preload/index.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/renderer/src/components/tab-bar/QuickLaunchButton.tsx
  • src/renderer/src/components/tab-bar/QuickLaunchButton.test.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.ts
🛑 Comments failed to post (1)
src/main/runtime/orca-runtime.ts (1)

8293-8322: ⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Locate provider.exec callsites in runtime =="
rg -n -C3 --type=ts '\bprovider\.exec\s*\(' src/main/runtime/orca-runtime.ts

echo
echo "== Locate buildSearchBaseRefsArgv definition/usage =="
rg -n -C4 --type=ts '\bbuildSearchBaseRefsArgv\b' src/main/git/repo.ts

echo
echo "== Inspect git execution implementation for shell usage =="
rg -n -C4 --type=ts 'child_process\.(exec|execSync)\b|shell\s*:\s*true|spawn\(|execFile\(' src/main/git src/main/runtime

echo
echo "== Inspect provider exec signatures/implementations =="
rg -n -C4 --type=ts 'interface .*exec\s*\(|type .*exec\s*=|class .*exec\s*\(' src/main/git src/main/runtime

Repository: stablyai/orca

Length of output: 9419


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Search for provider type definitions (GitProvider, SshGitProvider) =="
rg -n --type=ts 'interface.*GitProvider|class.*GitProvider|type.*GitProvider' src/main/git src/main/runtime | head -20

echo
echo "== Find exec method signature in provider definitions =="
rg -n -A5 --type=ts 'exec\s*\(' src/main/git/provider.ts src/main/git/git-provider.ts 2>/dev/null || echo "Files not found, searching broadly..."
fd -name '*provider*.ts' src/main/git -x rg -l 'exec\s*\(' {} \; | head -5

echo
echo "== Inspect normalizeRefSearchQuery implementation =="
rg -n -A10 --type=ts '\bnormalizeRefSearchQuery\b' src/main/git

echo
echo "== Check SshGitProvider.exec for argv handling =="
rg -n -B2 -A15 'class SshGitProvider\|exec\s*\(' src/main/git/ssh-git-provider.ts 2>/dev/null || rg -n 'SshGitProvider' src/main/git --type=ts | head -5

Repository: stablyai/orca

Length of output: 574


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Find provider files =="
find src -name '*provider*.ts' -type f | head -20

echo
echo "== Locate ssh-git-provider.ts =="
find src -name 'ssh-git-provider.ts' -type f

echo
echo "== Inspect SshGitProvider.exec method =="
if [ -f "src/main/providers/ssh-git-provider.ts" ]; then
  rg -n -A12 'exec\s*\(' src/main/providers/ssh-git-provider.ts | head -40
fi

echo
echo "== Search for normalizeRefSearchQuery implementation =="
rg -n -A8 'function normalizeRefSearchQuery|export.*normalizeRefSearchQuery' --type=ts src/main/git

echo
echo "== Check if provider.exec uses shell interpolation or argv =="
rg -n -B5 -A10 'provider\.exec' src/main/runtime/orca-runtime.ts | grep -A10 'buildSearchBaseRefsArgv'

Repository: stablyai/orca

Length of output: 4113


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Inspect buildSearchBaseRefsArgv implementation =="
rg -n -A40 'export function buildSearchBaseRefsArgv' src/main/git/repo.ts

echo
echo "== Check mux.request 'git.exec' handler to confirm argv handling =="
rg -n -B3 -A10 "mux\.request.*'git\.exec'" src/main/providers --type=ts | head -60

Repository: stablyai/orca

Length of output: 4506


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Find git.exec handler in mux/orchestration =="
rg -n -B5 -A15 "'git\.exec'" src/main/orchestration src/main/providers --type=ts | head -100

echo
echo "== Look for mux request handler registration =="
rg -n 'git\.exec|registerHandler.*git' src/main/orchestration --type=ts | head -20

echo
echo "== Check if normalizedQuery special chars are properly escaped =="
rg -n -B2 -A8 'normalizeRefSearchQuery' src/main/git/repo.ts

Repository: stablyai/orca

Length of output: 6183


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Find orchestration files and git.exec handler =="
find src/main -name '*orchestration*' -type f | head -10

echo
echo "== Search for 'git.exec' handler in all orchestration files =="
find src/main -name '*orchestration*.ts' -type f -exec grep -l 'git\.exec' {} \;

echo
echo "== Search for mux handler or request handler registration =="
rg -n "handleRequest.*'git\.exec'|case.*'git\.exec'|git\.exec.*handler" --type=ts src/main | head -20

echo
echo "== Look at the orchestration structure =="
ls -la src/main/orchestration* 2>/dev/null || echo "No orchestration directory"

echo
echo "== Find where git.exec is handled - broader search =="
rg -n "'git\.exec'" --type=ts src/main | head -20

Repository: stablyai/orca

Length of output: 438


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Check the mux type to understand where handlers are registered =="
rg -n "this\.mux\s*=" --type=ts src/main/providers/ssh-git-provider.ts | head -5

echo
echo "== Look at SshGitProvider constructor and mux initialization =="
rg -n -B10 -A5 "class SshGitProvider" src/main/providers/ssh-git-provider.ts | head -50

echo
echo "== Search for git.exec handler across entire codebase =="
rg -n "git\.exec" --type=ts src/main | grep -v test | grep -v '.stdout' | head -30

Repository: stablyai/orca

Length of output: 2320


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Find SshChannelMultiplexer to understand how requests are handled =="
rg -n "class SshChannelMultiplexer|interface SshChannelMultiplexer" --type=ts src/main

echo
echo "== Look for request method in SshChannelMultiplexer =="
rg -n -A8 "request\s*\(" --type=ts src/main/providers | grep -A8 "SshChannelMultiplexer\|multiplexer" | head -30

echo
echo "== Search for RPC handler that processes git.exec requests =="
rg -n "git\.exec.*handler|registerHandler.*git|handleRequest" --type=ts src/main/runtime/rpc --type=ts | head -20

echo
echo "== Check if argv is properly preserved in test expectations =="
rg -n "expect.*git\.exec" --type=ts src/main/providers/ssh-git-provider.test.ts -A2 | head -40

Repository: stablyai/orca

Length of output: 265


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Inspect SshChannelMultiplexer.request method =="
rg -n -A20 "request\s*\(" src/main/ssh/ssh-channel-multiplexer.ts | head -60

echo
echo "== Check how git.exec is dispatched in RPC handlers =="
rg -n "'git\.exec'" --type=ts src/main/runtime/rpc -A5 -B2 | head -50

echo
echo "== Final check: verify normalizeRefSearchQuery output for injection risk =="
rg -n -A5 "function normalizeRefSearchQuery\|export.*normalizeRefSearchQuery" src/main/git/repo.ts

Repository: stablyai/orca

Length of output: 843


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Check how dual-search (segmented vs branchRoot) is documented =="
rg -n -B5 -A15 "segmented.*branchRoot|branchRoot.*segmented" src/main/runtime/orca-runtime.ts | head -50

echo
echo "== Verify the actual flow: normalizedQuery -> buildSearchBaseRefsArgv -> argv array =="
rg -n -B2 -A8 "const runSearch.*async" src/main/runtime/orca-runtime.ts | head -30

echo
echo "== Final verification: confirm argv never becomes a shell string =="
rg -n "shell\s*:\s*true|execSync|child_process\.exec\(" src/main/git/runner.ts | head -10

Repository: stablyai/orca

Length of output: 2351


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Verify the dual-search behavior at lines 8326-8331 has no inline comment =="
sed -n '8320,8335p' src/main/runtime/orca-runtime.ts

echo
echo "== Check if similar patterns in the codebase have 'Why' comments =="
rg -n "// Why:" src/main/git/repo.ts | head -5

echo
echo "== Confirm argv flow is fully array-based (no stringification) =="
rg -n "args\[0\]|args\.join|shell\s*:" src/main/providers/ssh-git-provider.ts | head -10

Repository: stablyai/orca

Length of output: 1322


Add explanatory comment for dual-search pattern at line 8326.

The logic at lines 8326–8331 implements a non-obvious dual-search strategy (segmented and branchRoot patterns) when the query contains multiple tokens. Per the coding guidelines for .ts files, add a short "Why:" comment explaining the rationale before the if (searchTokens.length > 1) block—similar to the pattern used throughout src/main/git/repo.ts (e.g., line 741).

🧰 Tools
🪛 ast-grep (0.43.0)

[warning] 8300-8306: Avoid command injection
Context: provider.exec(
buildSearchBaseRefsArgv(normalizedQuery, limit, {
remoteNames: remotes,
patternGroup
}),
repo.path
)
Note: Security best practice.

(command-injection-typescript)


[warning] 8313-8320: Avoid command injection
Context: provider.exec(
buildSearchBaseRefsArgv(normalizedQuery, limit, {
excludeRemoteHead: false,
remoteNames: remotes,
patternGroup
}),
repo.path
)
Note: Security best practice.

(command-injection-typescript)

🪛 OpenGrep (1.22.0)

[ERROR] 8293-8293: Dynamic command passed to child_process.exec/execSync. Use child_process.execFile or spawn with an argument array instead.

(coderabbit.command-injection.exec-js)


[ERROR] 8301-8307: Dynamic command passed to child_process.exec/execSync. Use child_process.execFile or spawn with an argument array instead.

(coderabbit.command-injection.exec-js)


[ERROR] 8314-8321: Dynamic command passed to child_process.exec/execSync. Use child_process.execFile or spawn with an argument array instead.

(coderabbit.command-injection.exec-js)

Source: Linters/SAST tools

@OrcaWin

OrcaWin commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Moving this PR to draft because it has been untouched for more than 80 days (latest recorded PR activity or commit timestamp: 2026-06-18T23:21:14Z; checked on 2026-10-27). This keeps the review queue focused on active work while preserving the proposal. Please mark it ready for review when work resumes.

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