Skip to content

[Other]: Include Dispatch-aware reclaim guidance in failed worker-start receipts #15944

Closed

Description

@Tauri-EPO

Current scope — 2026-09-04

A failed worker-start can name residual resources without providing an applicable next action for them. The remaining request is recovery guidance through the Dispatch-aware owner, not a general instruction to close the terminal by handle.

I withdrew that terminal close proposal in the 2026-08-22 comment. This body now reflects that correction. The comment describes work proposed in #15966; that PR is still open, so it should not be read as a shipped fix.

Evidence

The CLI contract promises stage, effects, residual resources and recovery commands when needed. The original Windows/PowerShell report on 1.4.188 had a failed-start receipt naming a created agent terminal in residualResources. The existing mutation recovery text supplied --retry-request, but that recovers the request result; it does not explain what to do with the resource named in that result.

Requested behavior

  • First recover an unknown mutation outcome idempotently. Do not start a second worker while the first request remains unresolved.
  • For a failed supervised Dispatch, provide the applicable inspection/release action keyed by Dispatch, using worker-release --dispatch <id> only when the runtime says it is eligible.
  • Re-check present ownership on the execution host when acting, preserve inspectable output, and retain adopted/configured/setup terminals or anything whose ownership cannot be established.
  • Preserve release_pending / release_unknown guidance. Neither is permission to substitute terminal close, and a federated resource must not be reclaimed on the coordinator's host.

A receipt proving that this attempt once created a terminal does not prove it still owns that terminal. A subsequent worker or a person may have adopted it before cleanup. Wording alone cannot remove that race.

#15966 and #15949 are open approaches to coordinate, not two separately required fixes. #15920 covers a release-path failure; #15313 covers orphan visibility. No live release/close operation was performed for this editorial update.

Activity

  1. added 2 commits that reference this issue on Aug 22, 2026
    8aa046a
    ba2f440
  2. Tauri-EPO commented on Aug 22, 2026

    @Tauri-EPO
    ContributorAuthor

    Update on the direction, because the PR that closes this (#15966) deliberately does not do half of what I asked for here.

    What I asked for

    Two things: emit a recovery command for a residual resource, and state the affirmative terminal close case in the orchestration guide, scoping the existing line-246 prohibition to a settled Dispatch.

    The first is done. The second is gone, and should stay gone.

    Why the affirmative case cannot be written safely

    The first attempt emitted orca terminal close --terminal <id> directly. Review killed it twice, and the second reason is the one that generalises.

    At the moment a failed start hands you a residual terminal, the receipts available prove two things: that this Dispatch once created that terminal, and that the old Dispatch no longer owns it. Neither says anything about now. Between the proof and the action, a later worker-start --terminal <handle> — or a person taking the terminal over — can adopt it. Closing it then destroys live work.

    That is a race, not an ambiguity, so no wording fixes it. Any guide sentence of the form "if the receipt says X, closing is safe" is wrong the moment adoption is possible, and adoption is always possible.

    What #15966 does instead

    orca orchestration worker-release --dispatch <id> --json is the only reclaim path the guide names. It re-checks ownership on the host that holds the terminal, at the moment of the action, preserves inspectable output first, and retains setup terminals, configured tabs, adopted terminals and anything it cannot prove. WORKER_RELEASABLE_STATES already includes failed, so no state change was needed.

    A federated receipt gets worker-show --dispatch and a note naming the worker server, because workerRelease fails closed on federation and a home-side close would target the wrong host.

    The line-246 prohibition is restored verbatim rather than scoped.

    So this issue is still closed by that PR, but read it this way

    The gap this issue reports is real: worker-start names a leak in residualResources, the spec promises "recovery commands when needed", and nothing told the orchestrator what to do. That is fixed.

    What changed is the answer. I asked for the guide to teach a command; the right fix was to route the decision to the component that can make it correctly and to teach that instead. Recording the reasoning here so the closing PR does not look like it drifted from its issue by accident.

  3. changed the title [-][Other]: worker-start names a residual resource with no stated way to reclaim it[/-] [+][Other]: Include Dispatch-aware reclaim guidance in failed worker-start receipts[/+] on Sep 5, 2026
  4. Tauri-EPO commented on Sep 7, 2026

    @Tauri-EPO
    ContributorAuthor

    Closing as resolved on main by #16904 (merged 2026-09-06, not yet in a release as of v1.4.197).

    The failed worker-start receipt now carries the Dispatch-scoped reclaim path itself, and only when the ownership table accepted the residual terminal for that Dispatch: src/main/runtime/rpc/methods/orchestration/worker/worker-start-receipt.ts returns recovery: "This start created a terminal that never ran the Task. Close it with: orca orchestration worker-release --dispatch <id>". The guide says the same and forbids substituting terminal close (skill-guides/orchestration/references/recovery-and-cleanup.md). The idempotency half is covered by the mutation-recovery guidance in src/cli/orchestration-mutation-recovery.ts (inspect with worker-show / request-show before --retry-request).

    Residual, small enough for a follow-up PR rather than this issue: the human-readable worker-start output (src/cli/handlers/orchestration/worker-output.ts) prints nextCommands but not recovery, so the guidance is JSON-only today. I will retest the receipt on the first release that carries #16904.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions