Skip to content

feat(orchestration): Orcastrator — a persistent director for multi-worktree orchestration - #6293

Open
zaridan wants to merge 1 commit into
stablyai:mainfrom
zaridan:feat/orcastrator-complete-upstream
Open

zaridan wants to merge 1 commit into
stablyai:mainfrom
zaridan:feat/orcastrator-complete-upstream

Conversation

@zaridan

@zaridan zaridan commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #6036 and folds in the granular follow-ups #6099, #6103, #6115, #6125 into one cohesive, recipe-free submission.

Re-applies the complete, recipe-free Orcastrator feature on top of current
upstream/main. An Orcastrator is a persistent "director" agent that runs in its
own dedicated worktree, decomposes work, and dispatches workers — coordinated
through Orca's orchestration runtime.

What's included:

  • Orcastrators sidebar section + launch flow, Create Orcastrator modal
    (name + project + agent + task), inline rename, persistence via
    reattach/close-cleanup, and a registry store slice.
  • Orchestration bridge (F1–F4): per-run isolation of the orchestration DB,
    coordinator creates lineage-visible worktrees, worktree-per-track reuse with
    serialization + multi-track concurrency, coordinator resume-on-boot, and a
    preload binding exposing run/taskCreate to the renderer.
  • Live Control Panel: syncs and renders the coordinator DAG in Mission Control
    with a live activity line; director console with workers, shipped history,
    and PR links; collapsible PR review cards; token-sourced PR-state pills.
  • Focus handling: don't steal active-tab focus when a director opens a worktree
    or spawns a worker via the CLI; supervising dot for background-active directors.
  • Shipped-scope fix: Mission Control "Shipped" is scoped to the director's
    lifetime. "+" styling/weight/alignment to match the Projects section.
  • "Send to Orcastrator" action on the new-workspace composer; experimental
    orchestrators feature flag + Settings toggle.

Recipe-free: the recipe-director layer was removed; the only residual recipe
field is a mode-agnostic, always-null snapshot column for LLM directors.

Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]

ELI5

Orcastrator is a persistent “director” agent in its own worktree that breaks work up and dispatches worker agents. Adds UI to create and manage multi-worktree orchestration.

…AG control panel

Re-applies the complete, recipe-free Orcastrator feature on top of current
upstream/main. An Orcastrator is a persistent "director" agent that runs in its
own dedicated worktree, decomposes work, and dispatches workers — coordinated
through Orca's orchestration runtime.

What's included:
- Orcastrators sidebar section + launch flow, Create Orcastrator modal
  (name + project + agent + task), inline rename, persistence via
  reattach/close-cleanup, and a registry store slice.
- Orchestration bridge (F1–F4): per-run isolation of the orchestration DB,
  coordinator creates lineage-visible worktrees, worktree-per-track reuse with
  serialization + multi-track concurrency, coordinator resume-on-boot, and a
  preload binding exposing run/taskCreate to the renderer.
- Live Control Panel: syncs and renders the coordinator DAG in Mission Control
  with a live activity line; director console with workers, shipped history,
  and PR links; collapsible PR review cards; token-sourced PR-state pills.
- Focus handling: don't steal active-tab focus when a director opens a worktree
  or spawns a worker via the CLI; supervising dot for background-active directors.
- Shipped-scope fix: Mission Control "Shipped" is scoped to the director's
  lifetime. "+" styling/weight/alignment to match the Projects section.
- "Send to Orcastrator" action on the new-workspace composer; experimental
  orchestrators feature flag + Settings toggle.

Recipe-free: the recipe-director layer was removed; the only residual `recipe`
field is a mode-agnostic, always-null snapshot column for LLM directors.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR implements "Orcastrators" — persistent director agents that coordinate multi-task work by spawning per-track child worktrees. The orchestration SQLite schema is bumped to v10, adding per-run isolation via coordinator_run_id/target_key columns throughout tasks, dispatch contexts, decision gates, and coordinator runs. The Coordinator engine gains worktree-backed dispatch: track: parsing (fenced-code-block aware), per-track child worktree creation with drift checking, cached agent reuse with tui-idle gating, and agent relaunch via launchAgentTerminal. A boot-reconcile pass recovers zombie running coordinator runs on startup. The runtime syncs orchestration activity counts and per-run task DAGs per pane-key. New renderer slices (OrchestratorsSlice, OrchestrationActivitySlice, OrchestrationRunDagSlice) back an Orchestrators sidebar section, an OrchestratorMissionControl right-sidebar panel showing supervision state and spawned/shipped worker PRs, and an OrchestratorLaunchModal. The feature is gated behind experimentalOrchestrators in global settings.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.16% 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 gives a summary, but it omits the required template sections for screenshots, testing, AI review, security audit, and notes. Add the missing template sections and fill in testing status, screenshots or no-visual-change, review notes, security audit, and any platform-specific follow-ups.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding Orcastrator orchestration for persistent multi-worktree directors.
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: 19

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/store/slices/worktrees.ts (1)

2200-2259: 🩺 Stability & Availability | 🟡 Minor

Forward suppressActivation through local worktree creates. The remote RPC path passes activate, but the local window.api.worktrees.create path drops it and createLocalWorktree never reads an activation flag. If programmatic/local creates should avoid switching the active tab, thread that flag through the local IPC path too.

src/main/runtime/rpc/methods/orchestration-gates.ts (1)

161-165: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Handle coordinator loop rejections on initial run start.

This fire-and-forget promise only uses .finally(), so a rejected coordinator loop becomes an unhandled rejection and can leave the DB row running until the next boot reconcile. Mirror the boot-resume fail-safe here.

Proposed fix
-      coordinator.runFromExistingRun(run.id).finally(() => {
-        if (activeCoordinator === coordinator) {
-          activeCoordinator = null
-        }
-      })
+      coordinator
+        .runFromExistingRun(run.id)
+        .catch((err) => {
+          console.error(`Coordinator run ${run.id} rejected; marking failed:`, err)
+          try {
+            db.updateCoordinatorRun(run.id, 'failed')
+          } catch {
+            // best effort only
+          }
+        })
+        .finally(() => {
+          if (activeCoordinator === coordinator) {
+            activeCoordinator = null
+          }
+        })
🧹 Nitpick comments (2)
src/renderer/src/components/right-sidebar/SourceControl.tsx (1)

5171-5176: 🚀 Performance & Scalability | 🔵 Trivial | 🏗️ Heavy lift

Hoist the director gate out of SourceControlInner.

This only swaps the render tree; the branch/PR polling and mutation effects above still run for director worktrees. That keeps unnecessary git/API work alive behind Mission Control and can leave stale Source Control state mounted for a screen that no longer uses it.

src/renderer/src/components/OrchestratorLaunchModal.tsx (1)

215-225: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the shadcn textarea primitive here.

This manually recreates textarea styling in a renderer UI surface; use the shared Textarea primitive so focus, border, and token behavior stay centralized. As per coding guidelines, “All UI work … must follow docs/STYLEGUIDE.md and use tokens defined in src/renderer/src/assets/main.css and shadcn primitives in src/renderer/src/components/ui/.”

Proposed refactor
 import { Button } from '`@/components/ui/button`'
+import { Textarea } from '`@/components/ui/textarea`'
@@
-            <textarea
+            <Textarea
               id={promptId}
               value={prompt}
               onChange={(event) => setPrompt(event.target.value)}
               rows={4}
@@
-              className="flex w-full resize-none rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50"
+              className="resize-none"
             />

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f80c2b3b-8960-4bc9-870e-3c0d34b7872e

📥 Commits

Reviewing files that changed from the base of the PR and between 4ac1e96 and d64ebde.

📒 Files selected for processing (113)
  • skills/orchestration/SKILL.md
  • src/cli/handlers/orchestration.test.ts
  • src/cli/handlers/orchestration.ts
  • src/cli/handlers/worktree.ts
  • src/cli/index.test.ts
  • src/cli/selectors.ts
  • src/cli/test-fixtures.ts
  • src/main/index.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/orchestration/boot-resume.test.ts
  • src/main/runtime/orchestration/boot-resume.ts
  • src/main/runtime/orchestration/coordinator.test.ts
  • src/main/runtime/orchestration/coordinator.ts
  • src/main/runtime/orchestration/db.test.ts
  • src/main/runtime/orchestration/db.ts
  • src/main/runtime/orchestration/per-run-isolation.test.ts
  • src/main/runtime/orchestration/run-dag-snapshot.test.ts
  • src/main/runtime/orchestration/run-dag-snapshot.ts
  • src/main/runtime/orchestration/types.ts
  • src/main/runtime/rpc/methods/orchestration-gates.ts
  • src/main/runtime/rpc/methods/orchestration-resume-on-boot.test.ts
  • src/main/runtime/rpc/methods/orchestration.test.ts
  • src/main/runtime/rpc/methods/orchestration.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/App.tsx
  • src/renderer/src/assets/main.css
  • src/renderer/src/components/AgentStateDot.tsx
  • src/renderer/src/components/Landing.tsx
  • src/renderer/src/components/NewWorkspaceComposerCard.tsx
  • src/renderer/src/components/NewWorkspaceComposerModal.tsx
  • src/renderer/src/components/OrchestratorLaunchModal.tsx
  • src/renderer/src/components/TaskPage.tsx
  • src/renderer/src/components/right-sidebar/ChecksPanel.review-header.test.tsx
  • src/renderer/src/components/right-sidebar/ChecksPanel.tsx
  • src/renderer/src/components/right-sidebar/ChecksPanelInner.tsx
  • src/renderer/src/components/right-sidebar/ChecksPanelReviewHeader.tsx
  • src/renderer/src/components/right-sidebar/MissionControlPrReviewCard.tsx
  • src/renderer/src/components/right-sidebar/MissionControlPrStatePill.tsx
  • src/renderer/src/components/right-sidebar/MissionControlSupervisionSummary.tsx
  • src/renderer/src/components/right-sidebar/MissionControlTaskRow.test.tsx
  • src/renderer/src/components/right-sidebar/MissionControlTaskRow.tsx
  • src/renderer/src/components/right-sidebar/MissionControlTasksSection.test.tsx
  • src/renderer/src/components/right-sidebar/MissionControlTasksSection.tsx
  • src/renderer/src/components/right-sidebar/OrchestratorMissionControl.dag.test.tsx
  • src/renderer/src/components/right-sidebar/OrchestratorMissionControl.spawned-activity.test.tsx
  • src/renderer/src/components/right-sidebar/OrchestratorMissionControl.tsx
  • src/renderer/src/components/right-sidebar/OrchestratorPanelNotice.tsx
  • src/renderer/src/components/right-sidebar/SourceControl.tsx
  • src/renderer/src/components/right-sidebar/checks-panel-gitlab-review-rpc.ts
  • src/renderer/src/components/right-sidebar/checks-panel-inner-types.ts
  • src/renderer/src/components/right-sidebar/right-sidebar-panel-content.tsx
  • src/renderer/src/components/settings/ExperimentalPane.tsx
  • src/renderer/src/components/settings/OrchestratorsExperimentalToggle.tsx
  • src/renderer/src/components/settings/experimental-search.ts
  • src/renderer/src/components/settings/orchestrators-search-entry.ts
  • src/renderer/src/components/sidebar/OrchestratorsSidebarSection.tsx
  • src/renderer/src/components/sidebar/WorktreeCardAgents.tsx
  • src/renderer/src/components/sidebar/WorktreeList.tsx
  • src/renderer/src/components/sidebar/index.tsx
  • src/renderer/src/components/sidebar/worktree-card-agent-summary.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/director-worktree-shell.test.ts
  • src/renderer/src/lib/director-worktree-shell.ts
  • src/renderer/src/lib/github-pr-search-url.test.ts
  • src/renderer/src/lib/github-pr-search-url.ts
  • src/renderer/src/lib/mission-control-card-target.ts
  • src/renderer/src/lib/orcastrate-log-shipped-work.test.ts
  • src/renderer/src/lib/orcastrate-log-shipped-work.ts
  • src/renderer/src/lib/orcastrator-dot-state.test.ts
  • src/renderer/src/lib/orcastrator-dot-state.ts
  • src/renderer/src/lib/orchestrator-launch.test.ts
  • src/renderer/src/lib/orchestrator-launch.ts
  • src/renderer/src/lib/orchestrator-mission-control-data.test.ts
  • src/renderer/src/lib/orchestrator-mission-control-data.ts
  • src/renderer/src/lib/orchestrator-task-row.test.ts
  • src/renderer/src/lib/orchestrator-task-row.ts
  • src/renderer/src/lib/orchestrator-work-item-prompt.test.ts
  • src/renderer/src/lib/orchestrator-work-item-prompt.ts
  • src/renderer/src/lib/orchestrator-worker-pr-badge.test.ts
  • src/renderer/src/lib/orchestrator-worker-pr-badge.ts
  • src/renderer/src/lib/send-work-item-to-orchestrator.ts
  • src/renderer/src/lib/shipped-branch-pr-match.test.ts
  • src/renderer/src/lib/shipped-branch-pr-match.ts
  • src/renderer/src/lib/use-orchestrator-active-worktree.ts
  • src/renderer/src/lib/worktree-activation-suppress.test.ts
  • src/renderer/src/lib/worktree-activation.ts
  • src/renderer/src/lib/worktree-agent-activity-text.ts
  • src/renderer/src/lib/worktree-agent-dot-state.ts
  • src/renderer/src/runtime/sync-runtime-graph.ts
  • src/renderer/src/store/index.ts
  • src/renderer/src/store/slices/diffComments.test.ts
  • src/renderer/src/store/slices/orchestration-activity.ts
  • src/renderer/src/store/slices/orchestration-run-dag.test.ts
  • src/renderer/src/store/slices/orchestration-run-dag.ts
  • src/renderer/src/store/slices/orchestrators.test.ts
  • src/renderer/src/store/slices/orchestrators.ts
  • src/renderer/src/store/slices/store-test-helpers.ts
  • src/renderer/src/store/slices/ui.ts
  • src/renderer/src/store/slices/worktree-helpers.ts
  • src/renderer/src/store/slices/worktrees.ts
  • src/renderer/src/store/types.ts
  • src/renderer/src/web/web-preload-api.test.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/orchestration-binding.ts
  • src/shared/orchestrator-identity.ts
  • src/shared/runtime-types.ts
  • src/shared/types.ts

Comment thread src/main/index.ts
Comment on lines +1538 to +1543
if (store.getSettings().experimentalOrchestrators) {
void runOrchestrationBootReconcile(runtimeService, (msg) =>
console.log('[orchestration-resume]', msg)
).catch((error) => {
console.error('[orchestration-resume] boot reconcile failed:', error)
})

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Await boot reconcile before exposing launch paths.

The comment says this lands before a user-triggered run can hit the guard, but void lets startup continue immediately. A fast launch after restart can still see the stale running row and fail with an active-run conflict.

Proposed fix
   if (store.getSettings().experimentalOrchestrators) {
-    void runOrchestrationBootReconcile(runtimeService, (msg) =>
+    await runOrchestrationBootReconcile(runtimeService, (msg) =>
       console.log('[orchestration-resume]', msg)
     ).catch((error) => {
       console.error('[orchestration-resume] boot reconcile failed:', error)
     })
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (store.getSettings().experimentalOrchestrators) {
void runOrchestrationBootReconcile(runtimeService, (msg) =>
console.log('[orchestration-resume]', msg)
).catch((error) => {
console.error('[orchestration-resume] boot reconcile failed:', error)
})
if (store.getSettings().experimentalOrchestrators) {
await runOrchestrationBootReconcile(runtimeService, (msg) =>
console.log('[orchestration-resume]', msg)
).catch((error) => {
console.error('[orchestration-resume] boot reconcile failed:', error)
})

Comment on lines +1024 to +1047
function makeDagTaskRow(overrides: {
id: string
assignee_handle?: string
}): Record<string, unknown> {
return {
id: overrides.id,
parent_id: null,
created_by_terminal_handle: null,
coordinator_run_id: 'run-a',
target_key: 'repo:/x',
task_title: overrides.id,
display_name: null,
spec: overrides.id,
status: 'dispatched',
deps: '[]',
result: null,
created_at: '2026-01-01T00:00:00.000Z',
completed_at: null,
assignee_handle: overrides.assignee_handle ?? 'term_worker',
dispatch_id: `ctx_${overrides.id}`,
dispatch_status: 'dispatched',
dispatch_last_heartbeat_at: '2026-06-01T00:00:00.000Z',
dispatch_dispatched_at: '2025-06-01T00:00:00.000Z'
}

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Parameterize the DAG fixture’s run id.

makeDagTaskRow() always emits coordinator_run_id: 'run-a', so the run-b branch builds a task row that claims it belongs to run-a. Let the helper accept coordinatorRunId and set run-b explicitly in this test.

Proposed fix
 function makeDagTaskRow(overrides: {
   id: string
   assignee_handle?: string
+  coordinatorRunId?: string
 }): Record<string, unknown> {
   return {
     id: overrides.id,
@@
-    coordinator_run_id: 'run-a',
+    coordinator_run_id: overrides.coordinatorRunId ?? 'run-a',
@@
       listTasksWithDispatch: vi.fn(({ coordinatorRunId }: { coordinatorRunId: string }) =>
         coordinatorRunId === 'run-a'
           ? [makeDagTaskRow({ id: 'task-a', assignee_handle: 'term_worker_a' })]
-          : [makeDagTaskRow({ id: 'task-b', assignee_handle: 'term_worker_b' })]
+          : [
+              makeDagTaskRow({
+                id: 'task-b',
+                assignee_handle: 'term_worker_b',
+                coordinatorRunId: 'run-b'
+              })
+            ]
       ),

Also applies to: 17694-17698

Comment on lines +745 to +750
const runPromise = coordinator.run()

// Wait for the worktree to be created + dispatch to happen.
await new Promise((r) => {
setTimeout(r, 100)
})

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.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Use waitFor and always drain runPromise in async coordinator tests.

This fixed sleep pattern repeats through the new suite. If the tick is late or an assertion fails before runPromise is awaited, the coordinator loop can survive into DB teardown. Wrap these cases in try/finally like the existing max-concurrency/resume tests and wait on conditions instead of time.

Comment on lines +123 to +124
if (CODE_FENCE_RE.test(lines[i])) {
inFence = !inFence

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Close only the matching fence type when parsing track:.

The current toggle treats any ``` or ~~~ line as opening/closing the same fence. A `~~~` line inside a backtick fence flips `inFence` off, so a later example `track:` inside that code block can be parsed and stripped as the real track.

Proposed fix
-const CODE_FENCE_RE = /^[ \t]*(?:```|~~~)/
+const CODE_FENCE_RE = /^[ \t]*(```+|~~~+)/
@@
-  let inFence = false
+  let fenceMarker: string | null = null
   for (let i = 0; i < lines.length; i++) {
-    if (CODE_FENCE_RE.test(lines[i])) {
-      inFence = !inFence
+    const fence = lines[i].match(CODE_FENCE_RE)?.[1]
+    if (fence) {
+      if (!fenceMarker) {
+        fenceMarker = fence
+      } else if (fence[0] === fenceMarker[0] && fence.length >= fenceMarker.length) {
+        fenceMarker = null
+      }
       continue
     }
-    if (inFence) {
+    if (fenceMarker) {
       continue
     }

Also applies to: 137-143

Comment on lines +437 to +462
const dependsOn = (a: string, b: string): boolean => {
const seen = new Set<string>()
const stack = [...(directDeps.get(a) ?? [])]
while (stack.length > 0) {
const next = stack.pop()!
if (next === b) {
return true
}
if (seen.has(next) || !taskIds.has(next)) {
continue
}
seen.add(next)
stack.push(...(directDeps.get(next) ?? []))
}
return false
}

for (const [trackKey, group] of byTrack) {
if (group.length < 2) {
continue
}
for (let i = 0; i < group.length; i++) {
for (let j = i + 1; j < group.length; j++) {
const a = group[i]
const b = group[j]
if (!dependsOn(a.id, b.id) && !dependsOn(b.id, a.id)) {

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Reject cyclic same-track dependency chains.

A cycle like A depends on B and B depends on A satisfies the pairwise “depends on” check, so the run passes decompose() with every task stuck pending. checkConvergence() treats pending tasks as active, so the coordinator can poll forever. Add cycle detection before accepting the same-track ordering.

Comment on lines +103 to +110
<DropdownMenuItem disabled={!canUnlinkPullRequest} onSelect={onUnlinkPullRequest}>
<Unlink className="size-3.5" />
{translate('auto.components.right.sidebar.ChecksPanel.7202f4a40a', 'unlink PR')}
</DropdownMenuItem>
<DropdownMenuItem onSelect={onLinkAnotherPullRequest}>
<Link className="size-3.5" />
{translate('auto.components.right.sidebar.ChecksPanel.07871c0589', 'Link another PR')}
</DropdownMenuItem>

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Inconsistent capitalization in menu item labels.

The unlink action defaults to 'unlink PR' (lowercase) while the sibling item uses 'Link another PR' (title case). Align the casing for visual consistency in the dropdown.

✏️ Proposed fix
-              {translate('auto.components.right.sidebar.ChecksPanel.7202f4a40a', 'unlink PR')}
+              {translate('auto.components.right.sidebar.ChecksPanel.7202f4a40a', 'Unlink PR')}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<DropdownMenuItem disabled={!canUnlinkPullRequest} onSelect={onUnlinkPullRequest}>
<Unlink className="size-3.5" />
{translate('auto.components.right.sidebar.ChecksPanel.7202f4a40a', 'unlink PR')}
</DropdownMenuItem>
<DropdownMenuItem onSelect={onLinkAnotherPullRequest}>
<Link className="size-3.5" />
{translate('auto.components.right.sidebar.ChecksPanel.07871c0589', 'Link another PR')}
</DropdownMenuItem>
<DropdownMenuItem disabled={!canUnlinkPullRequest} onSelect={onUnlinkPullRequest}>
<Unlink className="size-3.5" />
{translate('auto.components.right.sidebar.ChecksPanel.7202f4a40a', 'Unlink PR')}
</DropdownMenuItem>
<DropdownMenuItem onSelect={onLinkAnotherPullRequest}>
<Link className="size-3.5" />
{translate('auto.components.right.sidebar.ChecksPanel.07871c0589', 'Link another PR')}
</DropdownMenuItem>

Comment on lines +1 to +21
import type { GlobalSettings } from '../../../../shared/types'
import { Label } from '../ui/label'
import { SettingsSwitch } from './SettingsFormControls'
import { SearchableSetting } from './SearchableSetting'
import { matchesSettingsSearch } from './settings-search'
import { getExperimentalSearchEntry } from './experimental-search'
import { translate } from '@/i18n/i18n'

type OrchestratorsExperimentalToggleProps = {
settings: GlobalSettings
updateSettings: (updates: Partial<GlobalSettings>) => void
searchQuery: string
}

// Why: extracted from ExperimentalPane to keep that file under the max-lines
// cap; this owns the single Orcastrators experimental toggle row.
export function OrchestratorsExperimentalToggle({
settings,
updateSettings,
searchQuery
}: OrchestratorsExperimentalToggleProps): React.JSX.Element | null {

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.

📐 Maintainability & Code Quality | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Does the codebase import React when using React.JSX.Element, or rely on a global?
rg -nP 'React\.JSX\.Element' -g '*.tsx' -l | head -20
# Check whether sibling settings components import React explicitly
rg -nP "^import .*\bReact\b" src/renderer/src/components/settings/SearchableSetting.tsx src/renderer/src/components/settings/ExperimentalPane.tsx
# Inspect tsconfig for jsx + any React global typing
fd -t f 'tsconfig*.json' -a | xargs rg -nP '"jsx"|jsxImportSource|"types"' 2>/dev/null

Repository: stablyai/orca

Length of output: 151


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate relevant TypeScript config and the target component/siblings.
git ls-files 'tsconfig*.json' 'src/renderer/src/components/settings/*.tsx' | sed 's#^`#FILE` #'

# Show the exact return-type usage and nearby imports in the target file.
cat -n src/renderer/src/components/settings/OrchestratorsExperimentalToggle.tsx | sed -n '1,40p'

# Inspect sibling files for import style and JSX typing.
printf '\n--- SearchableSetting ---\n'
cat -n src/renderer/src/components/settings/SearchableSetting.tsx | sed -n '1,40p'
printf '\n--- ExperimentalPane ---\n'
cat -n src/renderer/src/components/settings/ExperimentalPane.tsx | sed -n '1,60p'

# Inspect tsconfig JSX settings and React typings.
printf '\n--- tsconfig snippets ---\n'
for f in $(git ls-files 'tsconfig*.json'); do
  echo "### $f"
  rg -n '"jsx"|"jsxImportSource"|"types"|"typeRoots"' "$f" || true
done

Repository: stablyai/orca

Length of output: 20623


🏁 Script executed:

#!/bin/bash
set -euo pipefail

git ls-files 'tsconfig*.json' 'src/renderer/src/components/settings/*.tsx' | sed 's#^`#FILE` #'

printf '\n--- OrchestratorsExperimentalToggle.tsx ---\n'
cat -n src/renderer/src/components/settings/OrchestratorsExperimentalToggle.tsx | sed -n '1,40p'

printf '\n--- SearchableSetting.tsx ---\n'
cat -n src/renderer/src/components/settings/SearchableSetting.tsx | sed -n '1,40p'

printf '\n--- ExperimentalPane.tsx ---\n'
cat -n src/renderer/src/components/settings/ExperimentalPane.tsx | sed -n '1,80p'

printf '\n--- tsconfig snippets ---\n'
for f in $(git ls-files 'tsconfig*.json'); do
  echo "### $f"
  rg -n '"jsx"|"jsxImportSource"|"types"|"typeRoots"' "$f" || true
done

Repository: stablyai/orca

Length of output: 21976


🏁 Script executed:

#!/bin/bash
set -euo pipefail

git ls-files 'tsconfig*.json' 'src/renderer/src/components/settings/*.tsx' | sed 's#^`#FILE` #'

printf '\n--- OrchestratorsExperimentalToggle.tsx ---\n'
cat -n src/renderer/src/components/settings/OrchestratorsExperimentalToggle.tsx | sed -n '1,40p'

printf '\n--- SearchableSetting.tsx ---\n'
cat -n src/renderer/src/components/settings/SearchableSetting.tsx | sed -n '1,40p'

printf '\n--- ExperimentalPane.tsx ---\n'
cat -n src/renderer/src/components/settings/ExperimentalPane.tsx | sed -n '1,80p'

printf '\n--- tsconfig snippets ---\n'
for f in $(git ls-files 'tsconfig*.json'); do
  echo "### $f"
  rg -n '"jsx"|"jsxImportSource"|"types"|"typeRoots"' "$f" || true
done

Repository: stablyai/orca

Length of output: 21976


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show tsconfig files and relevant JSX settings.
for f in $(git ls-files 'tsconfig*.json'); do
  echo "### $f"
  cat -n "$f" | sed -n '1,220p' | rg -n '"jsx"|"jsxImportSource"|"types"|"typeRoots"|extends|include|compilerOptions'
done

echo '### target file'
cat -n src/renderer/src/components/settings/OrchestratorsExperimentalToggle.tsx | sed -n '1,40p'

echo '### sibling files'
cat -n src/renderer/src/components/settings/SearchableSetting.tsx | sed -n '1,40p'
cat -n src/renderer/src/components/settings/ExperimentalPane.tsx | sed -n '1,60p'

Repository: stablyai/orca

Length of output: 6147


🏁 Script executed:

#!/bin/bash
set -euo pipefail
git ls-files | rg '(^|/)(tsconfig[^/]*\.json|OrchestratorsExperimentalToggle\.tsx|SearchableSetting\.tsx|ExperimentalPane\.tsx)$'

Repository: stablyai/orca

Length of output: 584


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- tsconfig.json ---\n'
cat -n tsconfig.json | sed -n '1,220p'

printf '\n--- React namespace usage in this area ---\n'
rg -n "React\.JSX\.Element|import type React from 'react'|import React from 'react'" src/renderer/src/components/settings/*.tsx | sed -n '1,200p'

printf '\n--- explicit React namespace declarations ---\n'
rg -n "declare namespace React|export as namespace React|namespace React" . --glob '!**/node_modules/**' --glob '!**/dist/**' | sed -n '1,200p'

Repository: stablyai/orca

Length of output: 242


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf -- '--- tsconfig.json ---\n'
cat -n tsconfig.json | sed -n '1,220p'

printf '\n--- React namespace usage in this area ---\n'
rg -n "React\.JSX\.Element|import type React from 'react'|import React from 'react'" src/renderer/src/components/settings/*.tsx | sed -n '1,200p'

printf '\n--- explicit React namespace declarations ---\n'
rg -n "declare namespace React|export as namespace React|namespace React" . --glob '!**/node_modules/**' --glob '!**/dist/**' | sed -n '1,200p'

Repository: stablyai/orca

Length of output: 24115


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf -- '--- tsconfig.json ---\n'
cat -n tsconfig.json | sed -n '1,220p'

printf '\n--- React namespace usage in this area ---\n'
rg -n "React\.JSX\.Element|import type React from 'react'|import React from 'react'" src/renderer/src/components/settings/*.tsx | sed -n '1,200p'

printf '\n--- explicit React namespace declarations ---\n'
rg -n "declare namespace React|export as namespace React|namespace React" . --glob '!**/node_modules/**' --glob '!**/dist/**' | sed -n '1,200p'

Repository: stablyai/orca

Length of output: 24130


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf -- '--- tsconfig.json ---\n'
cat -n tsconfig.json | sed -n '1,220p'

printf '\n--- React namespace usage in this area ---\n'
rg -n "React\.JSX\.Element|import type React from 'react'|import React from 'react'" src/renderer/src/components/settings/*.tsx | sed -n '1,200p'

printf '\n--- explicit React namespace declarations ---\n'
rg -n "declare namespace React|export as namespace React|namespace React" . --glob '!**/node_modules/**' --glob '!**/dist/**' | sed -n '1,200p'

Repository: stablyai/orca

Length of output: 24171


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf -- '--- config/tsconfig.web.json ---\n'
cat -n config/tsconfig.web.json | sed -n '1,220p'

printf '\n--- config/tsconfig.node.json ---\n'
cat -n config/tsconfig.node.json | sed -n '1,220p'

printf '\n--- config/tsconfig.relay.json ---\n'
cat -n config/tsconfig.relay.json | sed -n '1,220p'

printf '\n--- react type imports in settings files ---\n'
rg -n "import (type )?React from 'react'|import type React from 'react'" src/renderer/src/components/settings/*.tsx | sed -n '1,200p'

printf '\n--- any JSX config / React types in referenced configs ---\n'
rg -n '"jsx"|"jsxImportSource"|"types"|"typeRoots"' config/tsconfig*.json tsconfig.json | sed -n '1,200p'

Repository: stablyai/orca

Length of output: 5236


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf -- '--- config/tsconfig.web.json ---\n'
cat -n config/tsconfig.web.json | sed -n '1,220p'

printf '\n--- config/tsconfig.node.json ---\n'
cat -n config/tsconfig.node.json | sed -n '1,220p'

printf '\n--- config/tsconfig.relay.json ---\n'
cat -n config/tsconfig.relay.json | sed -n '1,220p'

printf '\n--- package.json deps ---\n'
cat -n package.json | sed -n '1,220p' | rg -n '"typescript"|"react"|`@types/react`|`@vitejs/plugin-react`|jsx|allowUmdGlobalAccess'

printf '\n--- any JSX/type settings in config tsconfigs ---\n'
rg -n '"jsx"|"jsxImportSource"|"types"|"typeRoots"|"allowUmdGlobalAccess"' config/tsconfig*.json tsconfig.json

Repository: stablyai/orca

Length of output: 2153


Import React for the return type Add import type React from 'react'; React.JSX.Element needs the React namespace in scope, and this file currently omits it.

Comment on lines +50 to +81
const result = await store.createWorktree(
repoId,
`orcastrator-${options.label}`,
repo?.worktreeBaseRef,
'skip',
undefined,
undefined,
`${ORCASTRATOR_DISPLAY_PREFIX}${options.label}`,
// Why: positional args up to compareBaseRef are unused for a director
// shell; the trailing options carries suppressActivation so a remote
// (SSH) create reveals the worktree without switching the user's active
// tab — matching the renderer-side activation suppression at the call site.
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
{ suppressActivation: true }
)

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.

🩺 Stability & Availability | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Locate createWorktree definition and print its parameter list to confirm
# the displayName position, the createdWithAgent slot, and that the trailing
# options object (suppressActivation) is the final parameter.
fd -t f -e ts -e tsx | xargs rg -nP 'createWorktree\s*[:(=]' -l | head
ast-grep run --pattern 'createWorktree($$$) { $$$ }' --lang typescript || true
rg -nP -C2 'createWorktree\s*[:(]' --type=ts src/renderer/src/store/slices/worktrees.ts

Repository: stablyai/orca

Length of output: 1073


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the worktree store API definition and the director shell call site.
sed -n '2088,2165p' src/renderer/src/store/slices/worktrees.ts
printf '\n---\n'
sed -n '1,140p' src/renderer/src/lib/director-worktree-shell.ts
printf '\n---\n'
sed -n '1,220p' src/renderer/src/lib/director-worktree-shell.test.ts

Repository: stablyai/orca

Length of output: 9201


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the worktree store API definition and the director shell call site.
sed -n '2088,2165p' src/renderer/src/store/slices/worktrees.ts
printf '\n---\n'
sed -n '1,140p' src/renderer/src/lib/director-worktree-shell.ts
printf '\n---\n'
sed -n '1,220p' src/renderer/src/lib/director-worktree-shell.test.ts

Repository: stablyai/orca

Length of output: 9201


Avoid relying on the positional createWorktree contract here. createdWithAgent must stay undefined and { suppressActivation: true } must remain the last argument; any signature change in createWorktree will silently break the activation-suppression behavior.

Comment on lines +6 to +21
// Why: the freshest in-flight orchestration run among a worktree's tabs, found
// by matching the activity map's coordinator paneKeys (`${tabId}:${leafId}`) to
// the worktree's tab ids. Presence means the director's run is still `running`.
function findOrchestrationActivityForTabs(
tabIds: readonly string[],
orchestrationActivityByPaneKey: Record<string, OrchestrationActivity>
): OrchestrationActivity | null {
for (const [paneKey, activity] of Object.entries(orchestrationActivityByPaneKey)) {
const colon = paneKey.indexOf(':')
if (colon <= 0 || !tabIds.includes(paneKey.slice(0, colon))) {
continue
}
return activity
}
return null
}

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.

🎯 Functional Correctness | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect how orchestrationActivityByPaneKey is populated and whether one worktree maps to multiple pane keys.
rg -nP --type=ts -C4 'orchestrationActivityByPaneKey' src/renderer/src
rg -nP --type=ts -C4 'OrchestrationActivity\b' src/shared src/main/runtime

Repository: stablyai/orca

Length of output: 27105


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the runtime builder that populates orchestrationActivityByPaneKey and the helper used here.
ast-grep outline src/main/runtime/orca-runtime.ts --view expanded | sed -n '17660,17740p'
ast-grep outline src/renderer/src/lib/orchestrator-mission-control-data.ts --view expanded | sed -n '1,120p'
cat -n src/shared/runtime-types.ts | sed -n '115,214p'

Repository: stablyai/orca

Length of output: 5501


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the runtime builder that populates orchestrationActivityByPaneKey and the helper used here.
ast-grep outline src/main/runtime/orca-runtime.ts --view expanded | sed -n '17660,17740p'
ast-grep outline src/renderer/src/lib/orchestrator-mission-control-data.ts --view expanded | sed -n '1,120p'
cat -n src/shared/runtime-types.ts | sed -n '115,214p'

Repository: stablyai/orca

Length of output: 5501


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the runtime builder and any constraints on how many orchestration activities/runs a worktree can expose.
sed -n '17669,17735p' src/main/runtime/orca-runtime.ts
sed -n '1,120p' src/renderer/src/lib/orchestrator-mission-control-data.ts
rg -n -C3 'single.*worktree|one.*worktree|multiple.*orchestrationActivityByPaneKey|orchestrationActivityByPaneKey.*worktree|runningRuns|coordinator_runs|tabsByWorktree' src/main src/renderer src/shared

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Read the helper and the runtime builder with tight line ranges.
sed -n '1,80p' src/renderer/src/lib/orchestrator-mission-control-data.ts
sed -n '17669,17720p' src/main/runtime/orca-runtime.ts

# Find any invariants or comments stating whether a worktree can expose multiple running orchestrations.
rg -n -C2 'one.*running|single.*running|per-worktree|coordinator paneKey|orchestrationActivityByPaneKey|multiple concurrent runs|shared across runs' src/main/runtime src/shared src/renderer/src/lib src/renderer/src/components/sidebar

Repository: stablyai/orca

Length of output: 27439


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Read the helper and the runtime builder with tight line ranges.
sed -n '1,80p' src/renderer/src/lib/orchestrator-mission-control-data.ts
sed -n '17669,17720p' src/main/runtime/orca-runtime.ts

# Find any invariants or comments stating whether a worktree can expose multiple running orchestrations.
rg -n -C2 'one.*running|single.*running|per-worktree|coordinator paneKey|orchestrationActivityByPaneKey|multiple concurrent runs|shared across runs' src/main/runtime src/shared src/renderer/src/lib src/renderer/src/components/sidebar

Repository: stablyai/orca

Length of output: 27439


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,80p' src/renderer/src/lib/orchestrator-mission-control-data.ts
sed -n '17669,17720p' src/main/runtime/orca-runtime.ts
rg -n -C2 'one.*running|single.*running|per-worktree|coordinator paneKey|orchestrationActivityByPaneKey|multiple concurrent runs|shared across runs' src/main/runtime src/shared src/renderer/src/lib src/renderer/src/components/sidebar

Repository: stablyai/orca

Length of output: 27439


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,80p' src/renderer/src/lib/orchestrator-mission-control-data.ts
sed -n '17669,17720p' src/main/runtime/orca-runtime.ts
rg -n -C2 'one.*running|single.*running|per-worktree|coordinator paneKey|orchestrationActivityByPaneKey|multiple concurrent runs|shared across runs' src/main/runtime src/shared src/renderer/src/lib src/renderer/src/components/sidebar

Repository: stablyai/orca

Length of output: 27439


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,80p' src/renderer/src/lib/orchestrator-mission-control-data.ts
sed -n '17669,17720p' src/main/runtime/orca-runtime.ts
rg -n -C2 'one.*running|single.*running|per-worktree|coordinator paneKey|orchestrationActivityByPaneKey|multiple concurrent runs|shared across runs' src/main/runtime src/shared src/renderer/src/lib src/renderer/src/components/sidebar

Repository: stablyai/orca

Length of output: 27439


findOrchestrationActivityForTabs returns the first matching pane, not the freshest. If a worktree can expose multiple live coordinator panes, the selected dot state follows Object.entries insertion order. Either make the selection deterministic across matches or change the comment to say first match.

Comment on lines +61 to +64
const shell = await createDirectorWorktreeShell(project, { label })
if (!shell) {
return false
}

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Show feedback when shell creation fails.

createDirectorWorktreeShell can fail before activation, but this branch returns false without any user-visible error.

Proposed fix
   const shell = await createDirectorWorktreeShell(project, { label })
   if (!shell) {
+    toast.error(
+      translate('auto.lib.orchestrator.launch.no_workspace', 'Could not open the Orcastrator.')
+    )
     return false
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const shell = await createDirectorWorktreeShell(project, { label })
if (!shell) {
return false
}
const shell = await createDirectorWorktreeShell(project, { label })
if (!shell) {
toast.error(
translate('auto.lib.orchestrator.launch.no_workspace', 'Could not open the Orcastrator.')
)
return false
}

@mhingston

Copy link
Copy Markdown

This still looks like a valuable product direction, but the implementation now appears far enough behind current main that a mechanical rebase may not be the best next step. The PR is currently merge-conflicted, and Orca's orchestration model has moved substantially since this was opened (durable Runs/Tasks/Dispatches, mailbox semantics, decision gates, restart/lifecycle work tracked in #15190 and related PRs).

Would maintainers still like the persistent director / Orcastrator concept upstream? If so, would you prefer this to be re-cut as a smaller current-main implementation that treats the existing orchestration runtime as the source of truth, rather than trying to revive the original stack wholesale?

The concept still seems compelling: a long-lived project-level director that decomposes work, dispatches workers, resumes after restart, and exposes a Mission Control view. Clarifying whether that UX/product direction is still wanted would help avoid spending effort rebasing code against an architecture that has since changed a lot.

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.

4 participants