Skip to content

[Bug]: Multiple orchestrators in a single workspace kill each other #4389

Description

@ryanmargono

Operating system

macOS

Orca version

No response

Details

In a single workspace if I'm using multiple orchestrators they will try to kill each other and their worker agents.

Activity

  1. nwparker commented on Jul 10, 2026

    @nwparker
    Contributor

    Reproduced on current main source (1.4.132, commit 6f895eff0a) on macOS arm64 with two safe in-memory coordinator fixtures and no real terminals/processes.

    Steps:

    1. Start coordinator A with worktree selector worktree:wt-a.
    2. While A is active, start coordinator B with selector worktree:wt-b.
    3. Separately, with A active, issue orchestration.runStop scoped to worktree:wt-b.

    Expected: A and B have independent coordinator ownership; B can start, and a B stop cannot target A.

    Actual:

    • B start returns runtime_error: Coordinator already running: <A run id>, despite a distinct worktree selector.
    • The stop request from B returns { stopped: true, runId: <A run id> }, so B targets A’s module-global coordinator rather than its own scope.

    Repeatability: deterministic 1/1 for each targeted case. The tests used an in-memory orchestration DB with no available worker terminals, were removed after capture, and left no tracked changes; no attachment or reporter-provided code was opened or run.

  2. added theissue type on Jul 12, 2026
  3. nwparker commented on Jul 18, 2026

    @nwparker
    Contributor

    Status: REPRODUCED on current main via unit test.

    Root cause: orchestrator (coordinator) ownership is tracked at module/process scope, not per worktree. orchestration.run gates on db.getActiveCoordinatorRun() (orchestration-gates.ts:50-53), whose SQL has no worktree predicate (db.ts:1010-1016: SELECT ... WHERE status='running' ... LIMIT 1). The worktree selector is handed to the Coordinator but never persisted on the run nor used in the gate, so a coordinator for wt-b collides with a running wt-a run and throws Coordinator already running: <A>. Compounding it, the active coordinator is a single module-global activeCoordinator (:10) and orchestration.runStop uses an empty params schema z.object({}) (:18) that resolves the same unscoped run — so a stop from B halts A's run and its workers.

    The repro test imports the real gate handlers + real OrchestrationDb (only the Coordinator's background loop is stubbed to avoid a self-completing race) and pins both defects.

    Re-run:

    pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/rpc/methods/repro-4389-coordinator-global-ownership.test.ts
    

    Key files: src/main/runtime/rpc/methods/orchestration-gates.ts, src/main/runtime/orchestration/db.ts, src/main/runtime/orchestration/coordinator.ts. Writeup: docs/bug-reproductions/4389.md.

    Fix direction: add a worktree column to coordinator_runs, persist + filter by it in getActiveCoordinatorRun, replace the module-global activeCoordinator with a per-worktree map, and give runStop a worktree param.


    Automated bug-reproduction pass. Repro artifact committed on branch nwparker/bug-repro-pass2; check it out to run the command above. Writeup: docs/bug-reproductions/4389.md.

  4. added
    has_reproConclusive reproduction exists (test/script/CLI evidence). See docs/bug-reproductions/
    on Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghas_reproConclusive reproduction exists (test/script/CLI evidence). See docs/bug-reproductions/os:macosIssues affecting macOSsize/mMedium PR (≤600 added lines, ≤25 files)

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions