[Bug]: injected/sent prompts land in agent composer but are never submitted. Send reports success, worker sits idle.
Operating system
macOS
Orca version
1.4.182
Details
Summary
orca orchestration worker-start / dispatch --inject and orca terminal send --text ... --enter frequently deliver the prompt into the spawned agent's composer without it ever being submitted. The CLI reports a successful send (bytes accepted), but the agent (Claude Code in our case) sits idle indefinitely with the full prompt visible in its input field. From the coordinator's side this is indistinguishable from a slow worker, so orchestrators wait, then respawn — and the respawned worker hits the same thing.
Environment
- macOS (Apple Silicon, M4) — Darwin 25.5.0
- Orca 1.4.182 (also observed on earlier 1.4.x builds over the past several days)
- Workers: Claude Code agents launched via
orca orchestration worker-start --task <id> --worktree current --agent claude --model opus
Reproduction
orca orchestration run-create+task-create(spec ~1.5-2.5 KB)orca orchestration worker-start --task <id> --worktree current --agent claude --model opus --json→ returns dispatch + terminal handle,dispatch_input: accepted- Observe the worker terminal: the injected preamble+spec sits in the Claude composer, never submitted. No error anywhere.
- Manually pressing Enter in the terminal (or
orca terminal send --terminal <handle> --enter) submits it and everything proceeds normally.
Frequency: intermittent but frequent — multiple times per day across different sessions/worktrees for the past several days.
What it is NOT
- Not the update-available modal (#13805): this has been reproducing for days; the update modal only appeared on our machine today, long after dozens of occurrences. Most repros had no modal present.
- Not the large-payload paste issue (#11343): our payloads are well under the ~4.5 KB threshold reported there, and the target is Claude, not Codex.
- Not a TUI-booting race: it reproduces after
terminal wait --for tui-idleis satisfied and the agent is fully interactive.
Impact
Silent orchestration deadlock: check --wait never receives worker_done, coordinators burn their timeout, and users conclude workers are dead. We now unconditionally send a follow-up bare Enter and verify via worker-read (source: "transcript" vs "terminal") after every dispatch, which works but shouldn't be necessary.
Related
#10662 (confirmed-send primitive) and PR #13763 (honest submit verdict) would both mitigate this — an honest verdict at send time is exactly what's missing.
Same failure on Windows dogfooding of unattended Claude / cursor-agent workers (also #14505; the closed #14525 came back). Coordinator sees send / dispatch --inject success; the prompt sits in the composer; the worker never starts.
Runtime already knows the Enter can be swallowed and currently recovers with a blind 500ms \r, not a delivery check:
// src/main/runtime/orca-runtime.ts — mail/inject submit
// Why: agent TUIs can swallow a \r in the same PTY write; submit separately after a delay.
flight.enterTimer = setTimeout(() => {
...
this.ptyController?.write(deliveryPtyId, '\r')
}, 500)
That timer reports success even when the composer still holds the draft. Cursor Agent is explicitly not auto-submitted (isCursorAgentOrchestrationTarget returns before the timer), so cursor-agent workers launched via .cmd never get an Enter from this path at all.
#10662 / PR #13763 (honest submit verdict) is the right primitive. Until inject/send is verify-then-retry, coordinators cannot tell “unsubmitted draft” from “thinking.”
Related: #14505 is the same unsubmitted-inject symptom on packaged Windows. #14342 (wait for Claude composer render) merged after v1.4.182 and is in v1.4.183, but this report is on v1.4.182 and explicitly rules out a TUI-boot race (tui-idle already satisfied; also reproduces on later terminal send --enter). Leaving open — not a confident "already fixed in 1.4.183" match. A retest on latest would help.
Retest on v1.4.187 (latest): still present. Adding the bundle-level root cause and a patch we have been running in production for 3 days, since @OrcaWin asked for a retest on latest.
We hit this 10 times in 5 days on Windows 11 (7 on one day, 3 on another) with Claude Code workers and preambles of ~4–6 KB, on 1.4.184 (packaged Windows x64, ConPTY, several agent terminals live at once).
Still unfixed on latest
Checked against the source at tag v1.4.187:
src/shared/agent-prompt-injection.tsstill submits on a fixed timer —WINDOWS_AGENT_PROMPT_SUBMIT_DELAY_MS = 1_500,DEFAULT_AGENT_PROMPT_SUBMIT_DELAY_MS = 500;- there is no verification layer anywhere in the repo (no symbol like
confirmAgentPromptSubmitted).
So #14342 (wait for Claude composer render, in 1.4.183) narrowed the boot race but did not close this one, which matches the report: it reproduces after tui-idle is satisfied.
Root cause, at line level
All references to out/main/index.js inside resources/app.asar (unminified in the shipped build).
1. The submit is blind and time-based — writeTerminalAgentPrompt (~197427):
// ... writes pastePayload in 16 KB chunks ...
await new Promise((resolve) => setTimeout(resolve, AGENT_PROMPT_SUBMIT_DELAY_MS));
await options.beforeWrite?.(ptyId);
if (!(this.ptyController?.write(ptyId, "\r") ?? false)) throw new Error(/* ... */);
The delay is measured from "we finished writing bytes to the pty", not from "the TUI finished consuming the paste". Those are different clocks: a 4–6 KB paste through ConPTY on a busy machine can still be in flight after 1500 ms. When it is, the \r lands inside the ESC[200~ … ESC[201~ window and the TUI treats it as pasted text — which is exactly the extra blank line you see in the composer.
2. Delivery is never verified — worker-start (~87945):
failedStage = "dispatch_input";
const preamble = buildDispatchPreamble({ /* ... */ });
await runtime.sendTerminalAgentPrompt(terminalHandle, preamble);
effects.push({ kind: "dispatch_input", role: "agent", id: terminalHandle, state: "accepted" });
const worker = db.markWorkerDispatchReady(started.dispatch.id, effects);
state: "accepted" is unconditional — the only evidence behind it is that a PTY write did not throw. Note the asymmetry: the code does wait for tui-idle before sending (~87921), but never checks that the terminal left idle afterwards, which is precisely the observable that separates success from this failure.
The decision-gate preamble (~83881), re-dispatch (~88654) and send --preamble (~89572) all go through the same sendTerminalAgentPrompt funnel, so all four paths share the defect — and would share a fix.
Making it deterministic
Temporarily lower WINDOWS_AGENT_PROMPT_SUBMIT_DELAY_MS (e.g. to 50). The failure becomes reliable, which is what confirms it is a race against paste ingestion rather than a TUI-boot race.
The patch we run
Patched at the sendTerminalAgentPrompt level so all four call sites are covered (+1048 bytes, 3 hunks). Verify-and-resubmit while the terminal is still idle:
async confirmAgentPromptSubmitted(handle, options = {}) {
const maxResubmits = 4;
const intervalMs = 2e3;
for (let attempt = 0; attempt <= maxResubmits; attempt += 1) {
await new Promise((resolve) => setTimeout(resolve, intervalMs));
let status;
try {
status = await this.getTerminalAgentStatus(handle);
} catch {
return;
}
if (status.status !== "idle") return; // consumed: agent left the prompt
if (attempt === maxResubmits) {
console.error("[preamble-submit] agent prompt still unsent after re-submits", { handle });
return;
}
let ptyId;
try {
ptyId = this.getTerminalAgentStatusPtyId(handle);
await options.beforeWrite?.(ptyId);
} catch {
return;
}
if (!(this.ptyController?.write(ptyId, AGENT_PROMPT_SUBMIT) ?? false)) return;
}
}
Two properties worth keeping in whatever you land:
- Never re-send
\rwhen the status ispermission. A blind Enter on a permission dialog would silently accept it. Onlyidleshould trigger a re-submit;null/unknown should do nothing. - An extra
\ron an empty composer is a no-op, which is what makes the retry safe.
Result on our side: since applying it, 7+ consecutive dispatches submitted on their own with no manual Enter, on the same machine and the same workload that was failing several times a day.
The part that actually cost us the time
Even with a retry, a dispatch that was never consumed should not be recorded as ready. dispatch_input: accepted on bytes-written alone is what turned all 10 of our incidents from visible into silent — there was nothing to alert on and nothing to retry, because every participant believed the handoff had happened. Marking it unverified, or even just logging it, would have been enough. #10662 / PR #13763 (honest submit verdict) is the right primitive for this half.
An adaptive delay scaled by payload size would narrow the race but cannot close it; only an observation of the terminal state can.
Two corrections to the v1.4.187 retest above, plus one thing it surfaced that is now being reported separately. Everything below is checked against the tag rather than against main.
The verification layer does exist at v1.4.187
there is no verification layer anywhere in the repo (no symbol like
confirmAgentPromptSubmitted)
That symbol is not there, but the layer is — under a different name:
$ git ls-tree -r v1.4.187 --name-only | grep agent-prompt-submission
src/main/runtime/agent-prompt-submission-runtime.test.ts
src/main/runtime/agent-prompt-submission-verification.test.ts
src/main/runtime/agent-prompt-submission-verification.ts
$ git grep -n verifyAgentPromptSubmission v1.4.187 -- src/main/runtime/orca-runtime.ts
19308: await verifyAgentPromptSubmission({
It sits immediately after the \r, inside the same funnel this report identifies:
const suffixWrote = this.ptyController?.write(ptyId, AGENT_PROMPT_SUBMIT) ?? false
if (!suffixWrote) {
throw new Error(options.suffixFailureError ?? 'terminal_not_writable')
}
await verifyAgentPromptSubmission({
baseline,
readActivity: () => this.getAgentPromptActivity(handle, ptyId),
signal: options.signal
})
and it polls for up to AGENT_PROMPT_EFFECT_TIMEOUT_MS = 5_000 looking for current.workingSequence > baseline.workingSequence, throwing agent_prompt_stalled when the agent never starts working. It arrived with #14962, merged 2026-08-17 and released in v1.4.187. The line-level analysis above is from the 1.4.184 asar, which predates it.
dispatch_input: accepted is no longer unconditional in effect
The line is still written unconditionally in source at v1.4.187 (orchestration-workers.ts:236), but it is unreachable when submission fails, because the await above it rejects:
await runtime.sendTerminalAgentPrompt(terminalHandle, preamble)
effects.push({ kind: 'dispatch_input', role: 'agent', id: terminalHandle, state: 'accepted' })
const worker = db.markWorkerDispatchReady(started.dispatch.id, effects)
So the half of this report that made the incidents silent — "every participant believed the handoff had happened" — is closed on v1.4.187. worker-start now returns state: failed, stage: dispatch_input, lastError: agent_prompt_stalled.
The safety property is already implemented
Never re-send
\rwhen the status ispermission.
That is assertPromptNotBlocked in the same file: it throws agent_prompt_blocked when current.status === 'permission' or the permission sequence has advanced since the baseline. Worth knowing if a resubmit is layered on top of it, since the guard is already there to compose with.
What the retest gets right, and what the fix turned the failure into
The blind timer is unchanged. WINDOWS_AGENT_PROMPT_SUBMIT_DELAY_MS = 1_500 still measures from "we finished writing bytes", not "the TUI finished consuming the paste", so the race this report identifies still fires. The verification catches it after the fact; it does not prevent it. The conclusion that only an observation of terminal state can close this, not an adaptive delay, is unaffected by anything above.
What did change is the shape of the failure, and it has its own cost. A dispatch that fails at dispatch_input revokes its capability before any worker_done and leaves its agent terminal behind as a residualResources entry, with worker-release able to answer release_unknown / tab_not_found. That is #15920 (macOS, filed today) and #15826 (Windows). On a released build the failure is no longer silent — it is loud, and it leaves a terminal that no CLI command can reclaim.
None of this argues against the verify-and-resubmit direction proposed here. It does mean such a change would now compose with an existing verification step rather than introduce the first one, and that whatever lands should also say what happens to the residue when it gives up.
Same failure class, Linux + OpenCode 2.1.3 (our case: text never even reaches the composer)
Reproducing this on Linux (Ubuntu 24.04), Orca 1.4.237, OpenCode 2.1.3 TUI, with
orca orchestration dispatch --task <id> --to <opencode-terminal-handle> (no --inject).
Difference from the report: the spec text does not appear in the composer either — the
OpenCode TUI stays on its idle welcome banner (Ask anything…). So it is one step further
along than "delivered but not submitted".
Evidence (two dispatches, same coordinator terminal, ~10 min apart)
| dispatch | worker-list says |
what actually happened | artifact that should exist |
|---|---|---|---|
ctx_59ecd1b1cf68 (task task_32a76b08809c) |
[ready/done] liveness=live provider=opencode — looks green |
worker-read --dispatch … --limit 12 returns only the idle OpenCode welcome screen |
/tmp/threading-research.md missing |
ctx_e5c4e69cb0de (task task_9421dab02e1a) |
[unsupervised/unknown] attention=failure,interruption liveness=exited |
worker-read → No terminal output returned. |
/tmp/xtool-eval/ missing |
worker-read metadata in both cases:
Fallback reason: session_not_reported
Content complete: false
Clipping: terminal_buffer, terminal_fallback
The dispatch call itself returned success with dispatch_input … state: "accepted".
Why this is worse than a plain failure
state: "accepted" plus worker-list [ready] / [done] is read by coordinators as
"dispatched and running". I acted on that reading and reported to a human that two
jobs were in flight; neither had started. The only signal that would have caught it is
checking for the expected artifact, which the contract does not require.
Suggestions (matching the ask in this issue)
- Deliverability gate before reporting success: after injecting, read the terminal
buffer back and require the task text (or a hash of it) to appear. Only then report
dispatched; otherwise reportundeliveredwith the buffer excerpt. worker-list: add adeliveredfield distinguishing coordinator accepted from agent session actually received it, so[ready]stops being read as "running".- Terminal-backend-aware injection: OpenCode TUI apparently needs a different
keystroke/paste sequence than the Claude/Codex paths; pick it automatically instead of
making the caller guess (
--injectalso fails with the same "already has an active dispatch" guard in this scenario, so there is no working fallback). - Docs/skill: state plainly that artifact existence is the required post-dispatch
assertion — the current
orca-subagentsflow impliesdispatchreturning OK is enough.
Environment
- Orca
1.4.237, OpenCode2.1.3(TUI, provideropencode, default free model), Linux x86-64. - Coordinator: pi terminal (
term_e9a…) in the same Orca instance; workspace/home/leon/studio/devel/cellforth. pi --version1.4.0.
Local record: our own issue tracker entry issue_20261023010848_8a13 (repo-side evidence +
repro steps) — happy to attach more logs if useful.
I hit what looks like the same symptom (macOS, Claude worker, brief typed but never submitted, intermittent) and traced one concrete cause.
Mechanism. On exit, Node.js unconditionally writes the termios it saw at startup back to a tty stdio, even when it is a background process (nodejs/node#66753 fixes this on main; not in a release yet). If a shell startup script runs a Node-based CLI in the background with the terminal inherited, its exit after Claude has started puts the shell's termios back under Claude. Which termios depends on when that process started:
- while the shell was running a command: canonical mode (
icanon echo icrnl); - while zsh was waiting at its prompt: zsh's line-editor mode (
-icanon -echo isig icrnl inlcr). This one looks raw if you only checkicanon.
Both keep ICRNL on, so Orca's Enter (\r) reaches Claude as \n, which Claude treats as a newline, not submit. Orca then reports turn_start_unobserved.
Evidence.
- Every failing worker I captured had one of the two termios above while Claude was running; Claude's own raw mode is
-isig -iexten -icrnl -inlcr -ixon. An Orca CLI process (orca account list --json, invoked by a status script from.zshrc) was among the background processes exiting at the switch. - A/B on a source build of Orca, alternating only that
.zshrcline in the same instance: v1.4.279 3/12 failed with the tty inherited vs 0/12 detached (</dev/null >/dev/null 2>&1); v1.4.284 6/12 vs 0/12. - Minimal reproductions without Orca: a background
node -e "setTimeout(()=>{},500)"that inherits the tty reverts a raw-mode program 10/10 (0/10 detached), including with the Node bundled in Orca 1.4.279 and 1.4.284 (24.22.1, 24.22.3). Started while zsh sits at its prompt and exiting afterclaudeis up, it leaves Enter unsubmitted 5/5 (0/5 detached). - It is intermittent because it needs that timing; failures clustered at high load.
Workaround. Detach background jobs in shell startup files from the terminal.
Note for Orca. The bundled Orca CLI runs on Electron's Node, so it is one such process until the bundled Node includes nodejs/node#66753.