Skip to content

[Bug]: worker_done with null taskId/dispatchId silently fails to complete the task #7429

Closed

Description

@ruttybob

Short summary

The orchestration auto-complete contract for worker_done is real but is enforced only softly, only at reconcile time, and is undocumented in the CLI. A worker_done that arrives without taskId / dispatchId is silently dropped with a warning log — before any terminal-based reconciliation — so any worker that does not follow the stock preamble verbatim (custom harness, non-LLM agent, hand-typed command) silently fails to complete its task. There is no error at send time and no terminal fallback.

What happened

Ran a coordinator-managed DAG with 8 parallel worker terminals (one per worktree), each dispatched via orca orchestration dispatch. Every worker finished and emitted worker_done, but all 8 arrived with:

taskId: null
dispatchId: null

None of the 8 tasks auto-completed; each had to be closed by hand with orca orchestration task-update --status completed. The workers were driven through a custom harness that did not run the stock preamble verbatim, so this is partly on my side — but the failure mode is entirely silent, which is the actual problem.

How to reproduce

  1. orca orchestration task-create --title demo → task_<id>
  2. orca orchestration dispatch --task <id> --terminal <handle> --inject
  3. Have the worker complete the work and emit worker_done without explicitly setting taskId / dispatchId (e.g. a custom harness that hand-crafts --payload '{}', or any worker that does not follow the stock preamble verbatim).
  4. orca orchestration task-list → the task stays in dispatched/running state; it never auto-completes.

What the code does today (context for whoever picks this up)

  • reconcileWorkerDoneMessage (src/main/runtime/orchestration/lifecycle-reconciliation.ts) is a four-factor authority check: payload taskId non-empty, payload dispatchId non-empty, the dispatch context's assignee_handle equals msg.from_handle, and that dispatch is the current in-flight one. If either id is missing/empty, it returns { action: 'ignored' } with a Warning: worker_done without taskId/dispatchId from <handle> log line, before the terminal-ownership check — so a null-id worker_done is dropped even when it came from the terminal that owns the live dispatch.
  • The dispatch preamble (buildDispatchPreamble in src/main/runtime/orchestration/preamble.ts) does hardcode the real --task-id / --dispatch-id into the example orchestration send command, so a worker that runs the stock preamble sends the ids. The gap is everything else.
  • dispatch --help / send --help (src/cli/specs/orchestration.ts) do not document that worker_done must carry the matching ids for auto-complete.
  • taskId / dispatchId are not on the SendParams / MessageRow schema (src/main/runtime/rpc/methods/orchestration.ts, src/main/runtime/orchestration/types.ts) — payload is an opaque string | null. The ids exist only as CLI flags assembled into the JSON blob with no validation.
  • There is no --require-payload-ids opt-in or any send-time rejection of null-id lifecycle messages.

Expected

At least one of (the first two are the highest leverage):

  • reject null-id worker_done (and other lifecycle types) at send time with a clear error, so a misbehaving worker fails loudly instead of silently;
  • when a worker_done arrives with null ids, reconcile against the single in-flight dispatch on msg.from_handle and complete that, instead of dropping;
  • document the auto-complete contract in dispatch --help / send --help (that worker_done must carry the matching taskId + dispatchId).

Anything else that might help

Activity

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

    @nwparker
    Contributor

    Status: REPRODUCED (unit test)

    reconcileWorkerDoneMessage in src/main/runtime/orchestration/lifecycle-reconciliation.ts returns {action:'ignored'} at lines 173-183 whenever payload.taskId or payload.dispatchId is missing — before the pane/handle ownership check (hasLifecycleAuthority, line 204). Because the ids are the only key used to look up the dispatch and there is no fallback, a worker_done emitted from the exact pane that owns the sole in-flight dispatch is silently dropped (warning log only, no send-time error) and the task never auto-completes. Confirmed against the real OrchestrationDb: a null-id worker_done from the owning pane stays dispatched, while the identical message with the ids completes.

    Re-run:

    pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/orchestration/repro-7429-worker-done-null-ids.test.ts
    

    Key files: src/main/runtime/orchestration/lifecycle-reconciliation.ts (reconcileWorkerDoneMessage 173-183), db.ts (getDispatchContext), preamble.ts. Repro test + writeup: docs/bug-reproductions/7429.md.

    Fix direction: when ids are absent, reconcile against the single in-flight dispatch owned by from_handle/sender_pane_key instead of returning ignored before the ownership check; and/or reject null-id lifecycle messages at send time.


    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/7429.md.

  4. added
    has_repro
    on Jul 18, 2026
  5. nwparker commented on Jul 21, 2026

    @nwparker
    Contributor

    @Jinwoo-H may agent did some work but giving this to you

  6. rodboev commented on Sep 5, 2026

    @rodboev
    Contributor

    Closing this issue because current main now rejects worker_done messages without both task and dispatch IDs and verifies dispatch ownership before settlement.

  7. nwparker commented on Sep 27, 2026

    @nwparker
    Contributor

    Resolved in current main. worker_done without a JSON payload, taskId, dispatchId, or valid outcome is now converted into a persisted lifecycle rejection; the CLI waits for settlement and surfaces that rejection instead of reporting a successful dispatch. Current orchestration help documents the required task/dispatch IDs and assignee ownership contract. The reconciliation tests cover missing-ID rejection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bughas_repro

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions