Repository navigation
Conversation
Captures the proposed "Orcastrators" sidebar section + create-flow, build phases, settings (mapped to coordinator TUNABLES + external-LLM adversarial review), multi-coordinator isolation, and integration points. Planning doc for the feat/orcastrators-sidebar prototype. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ggle First slice of the Orcastrators feature (see ORCASTRATORS-SPEC.md): the GlobalSettings.experimentalOrchestrators flag, an Experimental-pane toggle (extracted to OrchestratorsExperimentalToggle to respect max-lines), and a settings-search entry (extracted to orchestrators-search-entry). Gates the upcoming sidebar section; no behavior yet beyond the toggle. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Records the traced, confirmed renderer call sequence for spawning a coordinator in a repo's existing primary worktree with /orcastrate seeded (primary-worktree lookup, createTab, startup payload, ensureAgentStartup- InTerminal / pasteDraftWhenAgentReady), plus the two args left to copy from the composer submit path. De-risks the launch slice. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Adds the experimental "Orcastrators" section above Projects with a + that opens a project picker; selecting a project launches a coordinator agent in that project's primary worktree and seeds /orcastrate. - orchestrator-launch.ts: resolves the project's primary worktree, builds the agent startup plan, activates the worktree with that startup command, and paste-submits /orcastrate when the TUI is ready (reuses the verified launch-work-item-direct agent helpers). - OrchestratorsSidebarSection.tsx: the gated section + picker, wired into the sidebar above the project list. Gated behind experimentalOrchestrators. typecheck + lint clean. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Locks the revised design from the working session: the Orcastrator is a persistent *director* (lives in the ORCASTRATORS section, no worktree shown, runs in the primary checkout but display-decoupled), survives restart, allows several per project, and uses disposition (delegate / decide-done / adversarial review / write-as-last-resort) rather than a permission sandbox. Adds an ordered v2 build plan (launch robustness, registry, persistence/reattach, display-decoupling) with a verify-before-commit risk note. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Replaces the activation-startup approach (which no-ops when the worktree is already active, so relaunch spawned nothing) with createTab + queueTabStartupCommand: forces a fresh agent tab and queues the launch command directly onto it, working whether or not the worktree is already open. Also delivers /orcastrate via pasteDraftWhenAgentReady with a 90s window so a cold agent boot no longer drops the prompt with a "took too long" toast. Verified live: relaunch into an open worktree spawns a fresh director and /orcastrate auto-runs. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Adds an OrchestratorsSlice tracking launched directors (id/project/worktree/ tab/launchedAt); launchOrchestratorForProject registers one on launch. The ORCASTRATORS sidebar section now lists live directors as clickable entries (project name, no worktree shown) and drops entries whose tab was closed. Wired the slice into the store + both test-store helpers. Verified live: launching shows a persistent "my-project" entry under ORCASTRATORS. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Display-decoupling (step 4, part 1): exclude an Orcastrator's agent tab from the worktree card's agent rows so the director no longer appears under Projects, and show the director's live state (working spinner / ready dot) on its ORCASTRATORS entry instead. Verified live: the /orcastrate agent row is gone from under the worktree and the section entry shows a status indicator. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Make the ORCASTRATORS list a navigator: highlight the active director's entry with the worktree card's exact active-surface styling — adds an `.orcastrator-active-surface` class to the shared active-surface CSS rule group in main.css (single source of truth) and reuses `worktree-sidebar-card-hover` for hover. Status now renders via the shared AgentStateDot. No invented styles. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The Orcastrator is now a first-class director, fully decoupled from the project's primary checkout: launch creates a *dedicated* worktree via createWorktree (skip-setup), runs the coordinator + /orcastrate there, and registers it by worktree id. WorktreeList excludes director worktrees so they never appear under Projects — they live only in the ORCASTRATORS section. Verified live: launching spawns a director in its own worktree (workspaces/<project>/orcastrator-<project>), shown only under ORCASTRATORS, with nothing leaking into Projects. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Step 3 + lifecycle. The in-memory registry doesn't survive a reload, so on load (and when worktrees change) reattachOrchestrators rebuilds it by detecting director worktrees via the ORCASTRATOR_DISPLAY_PREFIX displayName marker — re-hiding them from Projects and re-showing them under ORCASTRATORS, reattached to their still-running agent. The section now keys off worktree existence (robust to tab-id drift on reattach) and derives status from the worktree's tabs. Adds closeOrchestrator (X-on-hover) which tears down the director's dedicated worktree and drops it from the registry. Note: pending live verification (author away); typecheck + lint clean and gated behind experimentalOrchestrators. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Covers register/dedupe/remove, reattach detection (by displayName prefix, project mapping, fallback to repo id + stripped name, idempotency, skipping non-directors), and closeOrchestrator teardown (incl. the worktree-removal- failure path). 7 tests, all passing. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…tores
The Orcastrator feature reads new store fields (orchestrators registry,
worktreesByRepo) in WorktreeList, WorktreeCardAgents, and the section. Older
component test mocks build partial stores without these, so the reads threw.
Guard them (?? [] / ?? {}). Fixes 49 renderer test regressions; full renderer
suite green. (Remaining failures are pre-existing main/relay PTY/bash/relay
env tests, unrelated to this branch.)
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Records the implemented state of the director rearchitect (flag, launch, registry/navigator, dedicated worktree, reattach, close/cleanup), the dedicated-worktree design decision, and known follow-ups. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… + task)
Replaces the +-dropdown with a native modal matching the "Create worktree"
composer (same Dialog + ProjectCombobox + AgentCombobox). Fields: Name (shown
in the ORCASTRATORS list), Project, Agent, and a task prompt — the prompt is
seeded after /orcastrate so the director starts planning the task instead of
asking for it. Also adds a gated "Create Orcastrator" button to the Landing
empty state next to Add Project / Create worktree.
launchOrchestratorForProject now takes { name, agent, prompt }. Verified live:
a named director ("Build Site") launched with a task, planned it, and spun up
worker worktrees under the project while staying in the ORCASTRATORS section.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…", design polish - Source Control: show a director explainer instead of the publish/PR empty state for an Orcastrator's worktree (it has no branch of its own to publish). - Suppress the "local main is behind" suggestion toast for director worktrees. - Send to Orcastrator: hand a tracked issue (GitHub/GitLab/Linear/Jira) to a director from the GitHub issue-row menu and the New Workspace composer footer; opens the launch modal prefilled, pre-selecting the project when the issue is repo-bound. - Launch modal: read prefill from modalData; align with the Create-worktree composer (max-w-lg, auto-focus Name, matching textarea focus/shadow tokens). - Experimental toggle: use the shared SettingsSwitch for the focus ring + a11y. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FNy4vrv3mvyjpPnhJMZr82
… shipped history, and PR links Replaces the misleading publish/PR view for a director's worktree with a Mission Control console, consistent across the right-sidebar panels: - Source Control: director header + 'no branch to publish' summary, plus the worker worktrees it spawned (linked via lineage parent) with each worker's live agent-state dot and a clickable PR badge. - Checks (and other branch/PR panels): a director notice with an 'Open Mission Control' jump, routed centrally so directors read correctly on every tab. - Shipped: the director's completed work, read from its own .orcastrate/log.jsonl so it survives worker teardown. Each branch is matched to its merged PR by head ref — prefix-agnostic, so branch-rename-on-push still resolves — with a direct PR link. - PR state renders as GitHub-styled pills (merged/open/closed/draft) with an external-link affordance. Shared logic (lineage worker selection, agent-dot derivation, PR-badge derivation, log parsing, branch matching, PR-search-URL fallback) is extracted into pure, unit-tested helpers. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FNy4vrv3mvyjpPnhJMZr82
…feat/orcastrator-upstream # Conflicts: # src/renderer/src/store/slices/worktrees.ts
The runtime node_modules closure bundles x86_64 copies of @parcel/watcher and node-pty alongside the arm64 ones. They're never loaded on Apple silicon, but recent macOS warns that the app 'includes an Intel component'. Remove them in afterPack for darwin/arm64 builds. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FNy4vrv3mvyjpPnhJMZr82
…astrator-upstream # Conflicts: # src/renderer/src/i18n/locales/zh.json
Resolves the 9 CodeRabbit findings on stablyai#6036: - launch: tear down the created worktree when activation fails, so a failed launch doesn't leave an orphaned hidden director workspace. - close: surface (log) teardown failures instead of swallowing every error. - reattach: skip directors with no live tab — a blank tabId created orphan entries unreachable from the sidebar (+ tests for the new contract). - worktrees: key the Orcastrator toast suppression off the authoritative result.worktree.displayName, not the input displayName. - sidebar: gate director-worktree exclusion behind experimentalOrchestrators, so disabling the flag keeps those worktrees reachable. - mission control: move PR-state pill colors to theme-scoped --pr-state-* tokens in main.css (no raw hex in the renderer); clear stale prItems when fetch preconditions fail; localize the "PR #N" label. - launch modal: seed form state only on open (don't clobber in-progress edits), and keep the modal open when launch fails. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…-implement gap Ship the orcastrate skill (SKILL.md) and its coordinator spec as a bundled skill under skills/orcastrate/, instead of leaving them honor-system in ~/.claude. This makes the Orcastrator's director behavior part of the build. Tightening: the skill front-door framed the whole decision around worktree *count*, so a single-PR task read as "no split needed → do it inline" — the exact failure where an Orcastrator resolved a conflict and applied review fixes itself. SKILL.md now separates two questions (how many PRs vs who does the work), and the coordinator calls out "one PR" as the most common trap: one PR still means one worktree with one worker, never zero workers. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> (cherry picked from commit a4a83f2)
…ch landed Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
📝 WalkthroughWalkthroughThis PR introduces Orcastrators as a first-class persistent coordinator concept in Orca, gated behind an 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Tools execution failed with the following error: Failed to run tools: 8 RESOURCE_EXHAUSTED: Received message larger than max (301697982 vs 209715200) 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 13
🧹 Nitpick comments (1)
src/renderer/src/lib/orcastrator-dot-state.ts (1)
9-20: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAvoid first-match activity selection; make stalled precedence deterministic.
Returning on the first matching pane key makes dot state dependent on object entry order when multiple matches exist. Prefer scanning all matches and short-circuiting on any
staleDispatches > 0.Suggested refactor
function findOrchestrationActivityForTabs( tabIds: readonly string[], orchestrationActivityByPaneKey: Record<string, OrchestrationActivity> ): OrchestrationActivity | null { + let candidate: OrchestrationActivity | null = 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 + if (activity.staleDispatches > 0) { + return activity + } + candidate = candidate ?? activity } - return null + return candidate }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 54d19fc7-9a0e-4c27-a184-2c971d94107c
📥 Commits
Reviewing files that changed from the base of the PR and between cea8d97 and f06e6c2758794b25d820474755c9fcf9075990b8.
📒 Files selected for processing (65)
.nvmrcORCASTRATORS-SPEC.mdconfig/electron-builder.config.cjsskills/orcastrate/SKILL.mdskills/orcastrate/orcastrate-coordinator.mdsrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/orchestration/db.test.tssrc/main/runtime/orchestration/db.tssrc/renderer/src/App.tsxsrc/renderer/src/assets/main.csssrc/renderer/src/components/AgentStateDot.tsxsrc/renderer/src/components/Landing.tsxsrc/renderer/src/components/NewWorkspaceComposerCard.tsxsrc/renderer/src/components/NewWorkspaceComposerModal.tsxsrc/renderer/src/components/OrchestratorLaunchModal.tsxsrc/renderer/src/components/TaskPage.tsxsrc/renderer/src/components/right-sidebar/OrchestratorMissionControl.tsxsrc/renderer/src/components/right-sidebar/OrchestratorPanelNotice.tsxsrc/renderer/src/components/right-sidebar/SourceControl.tsxsrc/renderer/src/components/right-sidebar/right-sidebar-panel-content.tsxsrc/renderer/src/components/settings/ExperimentalPane.tsxsrc/renderer/src/components/settings/OrchestratorsExperimentalToggle.tsxsrc/renderer/src/components/settings/experimental-search.tssrc/renderer/src/components/settings/orchestrators-search-entry.tssrc/renderer/src/components/sidebar/OrchestratorsSidebarSection.tsxsrc/renderer/src/components/sidebar/WorktreeCardAgents.tsxsrc/renderer/src/components/sidebar/WorktreeList.tsxsrc/renderer/src/components/sidebar/index.tsxsrc/renderer/src/components/sidebar/worktree-card-agent-summary.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/github-pr-search-url.test.tssrc/renderer/src/lib/github-pr-search-url.tssrc/renderer/src/lib/orcastrate-log-shipped-work.test.tssrc/renderer/src/lib/orcastrate-log-shipped-work.tssrc/renderer/src/lib/orcastrator-dot-state.test.tssrc/renderer/src/lib/orcastrator-dot-state.tssrc/renderer/src/lib/orchestrator-launch.tssrc/renderer/src/lib/orchestrator-mission-control-data.test.tssrc/renderer/src/lib/orchestrator-mission-control-data.tssrc/renderer/src/lib/orchestrator-work-item-prompt.test.tssrc/renderer/src/lib/orchestrator-work-item-prompt.tssrc/renderer/src/lib/orchestrator-worker-pr-badge.test.tssrc/renderer/src/lib/orchestrator-worker-pr-badge.tssrc/renderer/src/lib/send-work-item-to-orchestrator.tssrc/renderer/src/lib/shipped-branch-pr-match.test.tssrc/renderer/src/lib/shipped-branch-pr-match.tssrc/renderer/src/lib/use-orchestrator-active-worktree.tssrc/renderer/src/lib/worktree-agent-dot-state.tssrc/renderer/src/runtime/sync-runtime-graph.tssrc/renderer/src/store/index.tssrc/renderer/src/store/slices/diffComments.test.tssrc/renderer/src/store/slices/orchestration-activity.tssrc/renderer/src/store/slices/orchestrators.test.tssrc/renderer/src/store/slices/orchestrators.tssrc/renderer/src/store/slices/store-test-helpers.tssrc/renderer/src/store/slices/ui.tssrc/renderer/src/store/slices/worktrees.tssrc/renderer/src/store/types.tssrc/shared/runtime-types.tssrc/shared/types.ts
| // Skip reattachment until a live tab exists for this director — a blank | ||
| // tabId would create an orphan entry that can't be activated from the sidebar. | ||
| const tabId = state.tabsByWorktree[worktree.id]?.[0]?.id | ||
| if (!tabId) { | ||
| continue |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Avoid one-shot reattach skips when tabs hydrate after worktrees.
Lines [83]-[87] hard-skip entries with missing tabId. Combined with the current sidebar lifecycle (reattachOrchestrators() triggered from worktree changes), an orchestrator can be skipped once and never reattached until another worktree change/reload.
…c fence langs closeOrchestrator removed the registry entry optimistically and only logged on removeWorktree failure, so a real teardown error (fs locked, perms) left the director gone from the sidebar while its worktree survived on disk — unreachable for retry. Restore the entry on failure (dedupe-safe). Update the test to assert rollback. Add text language identifiers to the remaining bare fenced blocks in the orcastrate skill docs (CodeRabbit markdownlint nits). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Double-click an Orcastrator's name in the sidebar to edit it inline, matching the existing worktree-title rename UX. Reuses WorktreeTitleInlineRename (Enter commits, Escape cancels, blur commits, empty/unchanged guarded). The rename updates both sources of truth: an optimistic in-memory updateOrchestrator for instant UI, then the durable worktree displayName (prefixed with ORCASTRATOR_DISPLAY_PREFIX) via the existing updateWorktreeMeta path so reattachOrchestrators reconstructs the name after a reload. The activate target became a role="button" div because an Input nested in a <button> is invalid HTML; Enter/Space keep it keyboard-accessible and the close (X) button is unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ayName reattachOrchestrators preferred project?.displayName over the persisted worktree displayName, so a renamed Orcastrator with a matching project reverted to the project name on reload — silently discarding the rename. Treat the prefix-stripped worktree displayName as the durable source of truth (it's `prefix + project.displayName` at launch, so un-renamed directors reconstruct identically), falling back to project/repo only when no name survives the prefix. Adds a test that fails against the old precedence, and a "why" note on the optimistic rename update. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- OrchestratorLaunchModal: guard against rapid Enter/double-click firing concurrent launches (in-flight isLaunching flag) so one intent produces one worktree/director. - orchestrator-launch: surface a toast when the backgrounded /orcastrate seed times out or rejects, instead of silently leaving the session idle. - OrchestratorsSidebarSection: persist the rename to durable worktree metadata FIRST (new throwOnPersistError option) and only mirror it into the in-memory entry on success, so the sidebar name can't diverge. - OrchestratorsSidebarSection: give the close button keyboard focus visibility (group-focus-within + focus-visible ring). - i18n: register the new seed_failed key across all locales. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
An Orcastrator's sidebar dot rendered the agent hook's `done` state as a
green completion check, even while the director was still supervising
background workers — reading as "finished" when the run was mid-flight.
Surface the in-flight orchestration run as a distinct signal:
- Main: buildOrchestrationActivityByPaneKey() emits per running coordinator
run, keyed by the coordinator's pane, with outstanding-task / active- and
stale-dispatch counts (db.listCoordinatorRuns + count helpers). Returned
on the syncWindowGraph result.
- Renderer: new orchestration-activity store slice receives it via the
existing graph-sync channel; deriveOrcastratorDotState prefers the run
signal once the foreground turn ends, so a supervising director shows a
calm emerald pulse ('supervising'), a hung worker shows amber ('stalled'),
and a truly idle one shows a neutral dot — never the completion check.
The dashboard's AgentStateDot 'done' check is intentionally unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- Scope per-pane orchestration activity to each run by the coordinator handle that owns its tasks/dispatches, so concurrent Orcastrators report independent metrics and one run's stale worker can't mark another's pane stalled. - Match worktree-attributed agent statuses by worktreeId (not just tab prefix) so worktree-level dots don't show idle before tabs attach. - Run orchestrator reattach from the sidebar root (always mounted) keyed on tabsByWorktree too, so a collapsed sidebar / late tab hydration can't leave stale or skipped orchestrator state. - Gate WorktreeCardAgents director filtering behind experimentalOrchestrators. - Use status-success/status-warning design tokens for the supervising/stalled dots instead of raw Tailwind palette values. - Add visible focus-visible state to the Orcastrator row activator. - Key Mission Control's PR refresh on the shipped branch set, not its length. - Make orcastrator dot-state stalled precedence deterministic across panes. - Tear down the director worktree when activation throws, not only on falsy. - Gate director worktrees to Mission Control before SourceControlInner mounts so its branch/PR effect graph never runs for them. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
f06e6c2 to
da3ebc7
Compare
CodeRabbit feedback addressedRebased onto the updated Core bug — per-run pane activity (
No remaining open markdown/doc nits in this review. Verified locally: |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/runtime/orchestration/db.test.ts (1)
583-587: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a non-stale assertion for a “current” threshold.
This block only checks the positive stale case with a far-future threshold. Add one near-now negative assertion so fresh dispatches are proven non-stale in this test path.
Suggested test addition
d.createDispatchContext(aTask.id, 'worker_a') expect(d.countActiveDispatchesForCoordinator('coord_a')).toBe(1) expect(d.countActiveDispatchesForCoordinator('coord_b')).toBe(0) + const now = new Date().toISOString() + expect(d.getStaleDispatchesForCoordinator('coord_a', now)).toHaveLength(0) + // A future threshold reads the only dispatched worker as stale, but the // staleness is attributed solely to the run that owns it. const future = '2999-01-01T00:00:00.000Z' expect(d.getStaleDispatchesForCoordinator('coord_a', future)).toHaveLength(1)
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7f00e280-9527-47bb-922a-2f6fc7ffcf4d
📥 Commits
Reviewing files that changed from the base of the PR and between f06e6c2758794b25d820474755c9fcf9075990b8 and da3ebc7.
📒 Files selected for processing (36)
skills/orcastrate/SKILL.mdskills/orcastrate/orcastrate-coordinator.mdsrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/orchestration/db.test.tssrc/main/runtime/orchestration/db.tssrc/renderer/src/assets/main.csssrc/renderer/src/components/AgentStateDot.tsxsrc/renderer/src/components/OrchestratorLaunchModal.tsxsrc/renderer/src/components/right-sidebar/OrchestratorMissionControl.tsxsrc/renderer/src/components/right-sidebar/SourceControl.tsxsrc/renderer/src/components/sidebar/OrchestratorsSidebarSection.tsxsrc/renderer/src/components/sidebar/WorktreeCardAgents.tsxsrc/renderer/src/components/sidebar/index.tsxsrc/renderer/src/components/sidebar/use-reattach-orchestrators.tssrc/renderer/src/components/sidebar/worktree-card-agent-summary.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/orcastrator-dot-state.test.tssrc/renderer/src/lib/orcastrator-dot-state.tssrc/renderer/src/lib/orchestrator-launch.tssrc/renderer/src/lib/worktree-agent-dot-state.tssrc/renderer/src/runtime/sync-runtime-graph.tssrc/renderer/src/store/index.tssrc/renderer/src/store/slices/diffComments.test.tssrc/renderer/src/store/slices/orchestration-activity.tssrc/renderer/src/store/slices/orchestrators.test.tssrc/renderer/src/store/slices/orchestrators.tssrc/renderer/src/store/slices/store-test-helpers.tssrc/renderer/src/store/slices/worktree-helpers.tssrc/renderer/src/store/slices/worktrees.tssrc/renderer/src/store/types.tssrc/shared/runtime-types.ts
✅ Files skipped from review due to trivial changes (3)
- src/renderer/src/i18n/locales/en.json
- src/renderer/src/i18n/locales/zh.json
- src/renderer/src/i18n/locales/ko.json
🚧 Files skipped from review as they are similar to previous changes (22)
- src/renderer/src/components/sidebar/worktree-card-agent-summary.ts
- src/shared/runtime-types.ts
- skills/orcastrate/SKILL.md
- src/renderer/src/store/slices/store-test-helpers.ts
- src/renderer/src/lib/orcastrator-dot-state.test.ts
- src/renderer/src/components/AgentStateDot.tsx
- src/renderer/src/components/sidebar/WorktreeCardAgents.tsx
- src/renderer/src/store/slices/diffComments.test.ts
- src/renderer/src/store/slices/orchestration-activity.ts
- src/renderer/src/store/index.ts
- src/renderer/src/components/sidebar/OrchestratorsSidebarSection.tsx
- src/renderer/src/assets/main.css
- src/renderer/src/store/slices/worktrees.ts
- src/main/runtime/orca-runtime.test.ts
- src/main/runtime/orca-runtime.ts
- src/renderer/src/components/right-sidebar/OrchestratorMissionControl.tsx
- src/renderer/src/components/OrchestratorLaunchModal.tsx
- src/renderer/src/store/types.ts
- src/renderer/src/lib/orchestrator-launch.ts
- skills/orcastrate/orcastrate-coordinator.md
- src/renderer/src/i18n/locales/ja.json
- src/renderer/src/i18n/locales/es.json
| // Why: run-scoped variant of getStaleDispatches. A dispatch belongs to a run | ||
| // via the task's coordinator handle (the coordinator that created the task), | ||
| // so joining through tasks keeps concurrent runs from seeing each other's | ||
| // stale workers — without it, one hung run marks every Orcastrator stalled. | ||
| getStaleDispatchesForCoordinator( | ||
| coordinatorHandle: string, | ||
| thresholdIso: string | ||
| ): DispatchContextRow[] { | ||
| return this.db | ||
| .prepare( | ||
| `SELECT d.* FROM dispatch_contexts d | ||
| JOIN tasks t ON t.id = d.task_id | ||
| WHERE d.status = 'dispatched' | ||
| AND d.dispatched_at IS NOT NULL | ||
| AND d.dispatched_at < ? | ||
| AND (d.last_heartbeat_at IS NULL OR d.last_heartbeat_at < ?) | ||
| AND t.created_by_terminal_handle = ?` | ||
| ) | ||
| .all(thresholdIso, thresholdIso, coordinatorHandle) as DispatchContextRow[] | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify mixed timestamp formats and raw TEXT comparisons in stale-dispatch queries.
rg -n -C2 "INSERT INTO dispatch_contexts|dispatched_at < \\?|last_heartbeat_at < \\?" src/main/runtime/orchestration/db.ts
python - <<'PY'
import sqlite3
db = sqlite3.connect(":memory:")
a = "2026-06-23 23:59:59" # sqlite datetime('now') shape
b = "2026-06-23T00:00:00.000Z" # ISO shape
print("raw_text_compare (a < b):", db.execute("SELECT ? < ?", (a, b)).fetchone()[0])
print("normalized_compare:", db.execute("SELECT datetime(?) < datetime(?)", (a, b)).fetchone()[0])
PYRepository: stablyai/orca
Length of output: 1989
🌐 Web query:
SQLite TEXT comparison datetime('now') vs ISO 8601 format timestamp mismatch
💡 Result:
In SQLite, datetime('now') returns a string in the format YYYY-MM-DD HH:MM:SS [1][2]. While SQLite supports various ISO 8601 strings (including those with a 'T' separator, like YYYY-MM-DDTHH:MM:SS) [1][3], discrepancies in comparisons between these formats typically arise because SQLite performs binary string comparisons when it treats them as plain text [4]. If you are encountering a "mismatch" or unexpected results during comparison, it is usually due to one of the following reasons: 1. Lexicographical Comparison Issues: SQLite compares TEXT values lexicographically [4]. The string YYYY-MM-DD HH:MM:SS (space separator) and YYYY-MM-DDTHH:MM:SS ('T' separator) will not sort or compare identically because the character 'T' does not have the same ASCII/binary value as a space [4][5][6]. 2. Format Mismatches in Comparisons: If you compare a column containing ISO 8601 strings (e.g., '2026-06-23T12:00:00') against a literal that does not follow the exact same format (e.g., '2026-06-23 12:00:00'), the comparison may fail or produce incorrect results because the strings differ at the separator position [5][6]. To ensure robust and accurate comparisons: - Normalize your inputs: Use SQLite's date/time functions to convert both operands into a consistent format before comparing [7][8]. For example, wrap both sides of the comparison in the datetime() function: SELECT * FROM my_table WHERE datetime(my_column) = datetime('now'); [5] - Use consistent storage: Decide on one format (e.g., always YYYY-MM-DD HH:MM:SS or always ISO 8601 with 'T') and enforce this format when inserting data or using literals [9][8]. - Understand the affinity: Remember that SQLite does not have a dedicated date/time type [10][11]. Columns containing dates are typically TEXT, and operations on them are standard text operations unless explicitly parsed by SQLite's built-in date/time functions [10][7]. Using the datetime() function is the safest way to perform comparisons, as it acts as a "Swiss Army knife" that understands both ISO 8601 strings and other supported formats, normalizing them for logical comparison [7][8].
Citations:
- 1: https://www.sqlite.org/lang_datefunc.html
- 2: https://www.sqliz.com/sqlite-ref/datetime/
- 3: https://sqlite.org/lang_datefunc.html
- 4: https://stackoverflow.com/questions/49304114/why-does-this-sqlite-date-comparison-work
- 5: https://allenap.me/posts/iso-8601-and-datetime-in-sqlite
- 6: https://stackoverflow.com/questions/24530299/date-comparison-in-sqlite-using-iso8601-format
- 7: https://adhdecode.com/articles/sqlite/sqlite-date-time-storage-format/
- 8: https://blog.sqlite.ai/handling-timestamps-in-sqlite
- 9: https://runebook.dev/en/docs/sqlite/lang_datefunc
- 10: https://www3.sqlite.org/datatype3.html
- 11: https://www.sqlitetutorial.net/sqlite-date/
Normalize timestamp comparisons in stale-dispatch queries.
dispatched_at is written with datetime('now') (SQLite format: YYYY-MM-DD HH:MM:SS with space separator), while thresholdIso is ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ with T separator). Comparing these as raw TEXT performs lexicographic comparison in SQLite, which fails because the separator characters differ ('T' vs space), potentially marking fresh dispatches as stale.
Suggested fix
getStaleDispatches(thresholdIso: string): DispatchContextRow[] {
return this.db
.prepare(
`SELECT * FROM dispatch_contexts
WHERE status = 'dispatched'
AND dispatched_at IS NOT NULL
- AND dispatched_at < ?
- AND (last_heartbeat_at IS NULL OR last_heartbeat_at < ?)`
+ AND datetime(dispatched_at) < datetime(?)
+ AND (last_heartbeat_at IS NULL OR datetime(last_heartbeat_at) < datetime(?))`
)
.all(thresholdIso, thresholdIso) as DispatchContextRow[]
}
...
getStaleDispatchesForCoordinator(
coordinatorHandle: string,
thresholdIso: string
): DispatchContextRow[] {
return this.db
.prepare(
`SELECT d.* FROM dispatch_contexts d
JOIN tasks t ON t.id = d.task_id
WHERE d.status = 'dispatched'
AND d.dispatched_at IS NOT NULL
- AND d.dispatched_at < ?
- AND (d.last_heartbeat_at IS NULL OR d.last_heartbeat_at < ?)
+ AND datetime(d.dispatched_at) < datetime(?)
+ AND (d.last_heartbeat_at IS NULL OR datetime(d.last_heartbeat_at) < datetime(?))
AND t.created_by_terminal_handle = ?`
)
.all(thresholdIso, thresholdIso, coordinatorHandle) as DispatchContextRow[]
}|
Folded into the consolidated Orcastrator PR #6293. |
What
Adds a supervising state to an Orcastrator's sidebar dot so a director that has handed control back (its agent hook fired
done) but is still running background workers reads as working in the background — not finished.Why
The sidebar dot derives from the per-pane agent hook, which reports
donethe moment the director's foreground turn ends. The dashboard'sAgentStateDotrendersdoneas a green completion check. But an Orcastrator is a long-lived supervisor: when it dispatches workers and a background watcher is waiting onworker_done, the director's turn is over while the run is very much alive. The result is a green checkmark that implies the mission is complete when it isn't.donefrom a hook means "my turn ended", not "the mission is complete" — and for a supervisor those are very different.How
The orchestration DB already knows a run is in flight; surface that as a distinct, DB-backed signal independent of the per-pane hook:
buildOrchestrationActivityByPaneKey()emits one record per running coordinator run, keyed by the coordinator's own pane, carrying outstanding-task / active-dispatch / stale-dispatch counts (db.listCoordinatorRuns+ count helpers). Returned on thesyncWindowGraphresult alongside the existingagentOrchestrationByPaneKey.orchestration-activitystore slice receives it via the existing graph-sync channel (reference-stable so high-frequency title ticks don't churn).deriveOrcastratorDotStateapplies a precedence ladder: foreground attention (blocked/waiting) →working→supervising(in-flight run, calm emerald pulse) /stalled(a dispatched worker's heartbeat is hung past the coordinator's threshold, amber pulse) →idle(truly standing by). A finished turn with no live run now shows a neutral dot — never the completion check.The sidebar row gains a count-aware hover tooltip (e.g. "Supervising · 2 tasks, 1 worker"). The dashboard's
AgentStateDotdonecheck is intentionally unchanged — that divergence is the point: the dashboard lists agents whose turns finished; the Orcastrator nav reflects a supervisor's run.Tests
orcastrator-dot-state.test.ts— precedence ladder, never-done, supervising/stalled, foreground precedence, cross-worktree isolationorca-runtimeintegration tests — activity keyed by coordinator pane; omitted when no run is runningFull typecheck clean; feature + orchestration suites green.
Stacking
Builds on the Orcastrator stack — depends on #6036 (core) and #6099 (inline rename). Best reviewed/merged after them; the diff narrows to just this feature once they land.
Note on the DB model
Counts come from the global orchestration DB (one namespace, no per-run association), so with multiple concurrent runs the counts are shared across runs while
runId/ coordinator attribution stays per-run accurate.🤖 Generated with Claude Code