Skip to content

orchestration run-use --takeover-legacy always fails with legacy_read_only, leaving legacy dispatches permanently stuck #12804

Closed

Description

@taeseong-ryaniee

Summary

orca orchestration run-use --id <run> --takeover-legacy always fails with legacy_read_only, including when invoked from a freshly created, live Orca agent terminal. Because it is the only documented recovery path for an adopted Run that still holds legacy dispatches, those dispatches become permanently unclearable.

Orca 1.4.169, macOS 15 (darwin 25.5.0), local host scope.

Repro

Given an adopted Run whose original coordinator terminal is gone:

run_4dc392a596a8
  coordinator_handle:    null
  coordinator_pane_key:  null
  consumer_generation:   0
  legacy:                0

with 6 tasks stuck in dispatched, each backed by a dispatch context with contract_version: 0.

1. Plain run-use refuses and points at --takeover-legacy:

{
  "code": "consumer_fenced",
  "message": "This adopted Run still has live legacy work. Its attested coordinator may rebind it, or a current coordinator may explicitly use run-use --takeover-legacy.",
  "data": {
    "effectsApplied": false,
    "recoveryCommand": "orca orchestration run-use --id run_4dc392a596a8 --takeover-legacy"
  }
}

2. The suggested recovery command refuses:

{
  "code": "legacy_read_only",
  "message": "Legacy takeover must be invoked by the live coordinator agent terminal it will bind. No effects were applied.",
  "data": { "effectsApplied": false }
}

Identical result for all four variations tried:

# Invocation Result
1 From an existing live Orca agent terminal legacy_read_only
2 Same, plus explicit --from $ORCA_TERMINAL_HANDLE legacy_read_only
3 After run-create (so the caller is a current coordinator with a bound Run) legacy_read_only
4 From a brand-new terminal made with orca terminal create --command 'claude ...' legacy_read_only

Case 4 is the important one: a freshly launched, live agent terminal — exactly what the error message asks for — is still rejected.

Analysis

In app.asar, orchestration.runUse:

handler: (params, { runtime, legacyCoordinatorAuthority, orchestrationCompatibilityEvidence,
                    orchestrationCompatibilityCallerAuthority: callerAuthority }) => {
  const paneKey = requireCallerPane(runtime, params.from, callerAuthority);
  if (params.takeoverLegacy &&
      (callerAuthority?.terminalHandle !== params.from || callerAuthority.paneKey !== paneKey))
    throw new OrchestrationError("legacy_read_only", ...);

callerAuthority for this path comes only from OrchestrationLegacyCompatibility.tryHandle:

if (request.method === "orchestration.runUse" && values.takeoverLegacy === true) {
  const callerAuthority = this.runtime.verifyOrchestrationCompatibilityCaller(request.orchestrationCompatibilityEvidence);
  return { handled: false, ...(callerAuthority ? { orchestrationCompatibilityCallerAuthority: callerAuthority } : {}) };
}

verifyOrchestrationCompatibilityCaller returns null unless agentHookServer.attestCompatibilityAuthority() succeeds:

const attestation = this.attestAgentHookCompatibilityAuthorityFn?.({
  paneKey: claimedPaneKey, launchTokenHash,
  connectionId: terminal.hostScope.kind === "ssh" ? terminal.hostScope.targetId : null,
  terminalProvenance
});
if (!attestation || attestation.paneKey !== terminal.paneKey) return null;

and attestCompatibilityAuthority requires, for terminalProvenance === "current_runtime":

const hasUniqueCurrentObservation =
  observations.length === 1 && paneObservations.length === 1 &&
  this.resolvePaneKeyAlias(observations[0].paneKey) === paneKey;
if (candidate.terminalProvenance === "current_runtime")
  return hasUniqueCurrentObservation ? Object.freeze({ paneKey, source: "current_hook" }) : null;

callerAuthority ends up null in every case, so callerAuthority?.terminalHandle !== params.from is unconditionally true and the guard always throws. The --takeover-legacy branch appears unreachable in this build.

Note that a non-attesting call to run-create in the same terminal, in the same second, succeeds and binds the pane — so the terminal does have a stable, resolvable pane identity. Only the agent-hook attestation path fails.

No fallback exists

  • task-update --run <run> without a binding → consumer_fenced: This coordinator terminal is no longer bound to Run <run>.
  • worker-abandon --dispatch <ctx> → dispatch_not_found. These dispatches are contract_version: 0, so the supervised-worker path does not see them.
  • orchestration reset --tasks is global scope, not per-Run — it would destroy tasks belonging to other, live Runs.

Result: the 6 dispatches cannot be settled by any command surface.

Secondary: no way to remove a Run

Attempt 3 above required creating a throwaway Run (run-create) to become a "current coordinator". There is no run-delete / run-archive RPC, so that Run is now permanently listed in run-list. Diagnosing this class of problem therefore leaves litter that cannot itself be cleaned up.

Expected

Either:

  1. --takeover-legacy succeeds from a live agent terminal, as the error message and recoveryCommand both promise; or
  2. a per-Run settle/abandon surface exists that does not depend on agent-hook attestation — e.g. orchestration reset --run <run>, or letting worker-abandon accept contract_version: 0 dispatches.

Plus a way to remove a Run created by mistake.

Made with Orca 🐋

Activity

  1. AmethystLiang commented on Aug 6, 2026

    @AmethystLiang
    Contributor

    thanks for reporting. looking into it

  2. Jinwoo-H commented on Aug 8, 2026

    @Jinwoo-H
    Contributor

    will be in next release, usually within 24 hours

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

Metadata

Metadata

Assignees

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