Repository navigation
Conversation
A send that wrote bytes into the PTY reported success even when the Enter was swallowed — by a completion popup, or by a TUI that was mid-turn — and the text was left sitting unsubmitted in the composer. Callers could not tell that apart from an agent that received the prompt and started work. Orca owns the PTY and already receives each harness's own turn-lifecycle hook, so it can answer the question directly. A send that carries a submit now arms a watch on the pane's hook stream before writing, and classifies the outcome: - submitted — the harness announced a turn start after the write; - queued — the harness recorded the text as a user message during a running turn, so it acts on it when that turn ends (OpenCode family); - pending — the harness reports turn starts, the pane was idle, and it said nothing inside the bound; - unknown — no trustworthy evidence: no live hook event for the pane, a harness with no turn-start signal at all, or a send into a running turn. Missing or stale evidence is unknown and is never promoted to submitted, which follows the convention already used for explicit agent status. On a pending verdict the submit key is re-sent once, never the text, so a partly accepted line cannot become a doubled message. The verdict rides an optional field on the terminal.send result and an optional request param, so an older host answers without one and an older client ignores it (docs/reference/remote-wire-compatibility.md, Rule 1). Callers must read a missing verdict as unknown.
… was submitted `dispatch --inject` set `injected = true` as soon as the agent-prompt send resolved, which only proves the bytes reached the PTY. When the Enter was swallowed the preamble sat in the worker's composer while the coordinator was told the task had been handed off, and it then waited on work that never started. The inject path now asks for a submit verdict and reports `injected` only for `submitted`. Every other outcome returns the verdict alongside `injected: false`, including the case where an older host answers with no verdict at all. The dispatch context is deliberately left open on an unproven submit: the bytes are in the pane and a queued or unknown send may still become a real turn, so failing it here would discard work that is about to run.
`orca terminal send --text ... --enter` now asks the host for a submit verdict and prints it in both output modes; `--json` carries the whole `send.submitVerdict` object. `--submit-timeout-ms` sets the bound, `--no-submit-retry` turns off the single submit re-send, and `--no-verdict` skips the wait. The client RPC timeout is widened to clear the bound so the transport cap does not fail a call the host is still answering. `orchestration dispatch --inject` prints a warning when the preamble was not confirmed submitted, so a coordinator does not read the dispatch as delivered. The terminal command specs move to their own file; adding the new flags and notes pushed core.ts past the max-lines limit, and splitting is the fix rather than a suppression.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughAdded terminal submission verdict contracts and harness-specific submit-signal classification. The runtime tracks agent hook events, reports submission status, and retries pending submissions with an Enter-only write. RPC orchestration confirms injection from the verdict and preserves unresolved dispatch contexts. CLI commands accept verdict options and display verdict details. Terminal command specifications moved into a dedicated module. Tests and guides cover confirmed, pending, queued, unknown, and missing verdict outcomes. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/runtime/orca-runtime.ts (1)
32455-32492: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy liftHold the delivery flight until the submit retry settles.
The timer's
finallycallssettlePendingMessageDelivery(deliveryPtyId, flight)whileretryPendingMessageSubmitis still pending.settlePendingMessageDeliveryimmediately re-runs any parked redelivery for the same pty, which writes a new pointer and its own\r. The pending retry can then fire afterwards and write an extra bare\rinto the same pane.
retryPendingMessageSubmitonly re-checkscontrollerKnowsPtyIsLive(ptyId), so it cannot detect that a newer delivery already used the pane. The extra\rsubmits whatever the composer holds at that moment.Keep the flight open until the retry resolves, so the single-flight guard covers the whole pointer-to-submit span.
🐛 Proposed fix: settle after the retry resolves
submitRetryArmed = true - void this.retryPendingMessageSubmit(deliveryPtyId, submitWatch) + void this.retryPendingMessageSubmit(deliveryPtyId, submitWatch).finally(() => { + this.settlePendingMessageDelivery(deliveryPtyId, flight) + }) } catch { // Terminal may have closed during the delay; mail remains queued for check. } finally { if (!submitRetryArmed) { submitWatch?.release() + // Why: with no retry in flight, this callback is the end of the span. + this.settlePendingMessageDelivery(deliveryPtyId, flight) } - // Why finally: every outcome — submit, refusal, throw — ends the flight, - // and settle re-runs any trigger parked during it so nothing strands. - this.settlePendingMessageDelivery(deliveryPtyId, flight) }
retirePendingMessageDeliveryForPtyalready clears the flight on exit, so a retired pty still settles correctly.
🧹 Nitpick comments (1)
src/main/runtime/terminal-send-submit-verdict.test.ts (1)
172-188: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd coverage for the
queuedno-retry branch.The tests verify that
unknowndoes not retry. They do not verify thatqueueddoes not retry. The tracker can returnqueuedwhenUserPromptSubmitoccurs while the pane was working at send time.Add a test that asserts a
queuedverdict writes only['ship it', '\r']. A regression that retries bothpendingandqueuedwould pass the current retry tests.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: caf1011b-1b3f-4265-93bf-d2805b635c73
📒 Files selected for processing (21)
skill-guides/orca-cli.mdskill-guides/orchestration.mdsrc/cli/bundled-skill-guides.tssrc/cli/handlers/orchestration.tssrc/cli/handlers/terminal.tssrc/cli/specs/core.tssrc/cli/specs/terminal.tssrc/cli/terminal-format.tssrc/main/index.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/orchestration-dispatch-submit-verdict.test.tssrc/main/runtime/rpc/methods/orchestration.test.tssrc/main/runtime/rpc/methods/orchestration.tssrc/main/runtime/rpc/methods/terminal.tssrc/main/runtime/terminal-send-submit-verdict.test.tssrc/main/runtime/terminal-submit-verdict-tracker.test.tssrc/main/runtime/terminal-submit-verdict-tracker.tssrc/shared/agent-submit-signal.test.tssrc/shared/agent-submit-signal.tssrc/shared/runtime-types.tssrc/shared/terminal-submit-verdict.ts
A host older than submit verdicts answers `terminal.send` with no `submitVerdict` field at all. The CLI printed only the byte count in that case, and `dispatch --inject` printed no warning, so an unproven submission read exactly like a completed one — the failure the verdict exists to close. Human output now reports `unknown` whenever this invocation asked for a verdict and the response carries none, and the dispatch warning is gated on `--inject` rather than on the presence of the field. Whether a verdict was requested is a property of the invocation, not of the response, so it is passed to the formatter and the JSON output stays exactly what the host sent. Also from review: - the `terminal send` usage string now advertises `--submit-timeout-ms`, `--no-submit-retry`, and `--no-verdict`, which `allowedFlags` already accepted; - a positive fractional timeout is clamped to at least 1ms. Truncating 0.5 to 0 skipped the evidence wait entirely and answered from the pre-write snapshot, which reads as a real verdict from a wait that never happened.
|
One scope question, because the answer decides whether something I just filed is a real gap or already solved here. This PR derives a submit verdict from the pane's hook stream — the only thing in the repo that answers "did a turn actually begin" rather than "did the write return". My question is how far that verdict is meant to travel.
await runtime.sendTerminalAgentPrompt(terminalHandle, preamble)
effects.push({ kind: 'dispatch_input', role: 'agent', id: terminalHandle, state: 'accepted' })
const worker = db.markWorkerDispatchReady(started.dispatch.id, effects) // stage = 'input_accepted'So a dispatch whose prompt is sitting unsubmitted in a composer reads as The question: is the verdict scoped to the
Context is in #15180 — that issue is a report about what Unrelated, in case the notification did not reach you: this branch reads |
|
Straight answer: the verdict is response-scoped in this PR, deliberately, and your gap is real. Nothing here writes durable state. const send = await runtime.sendTerminalAgentPrompt(to, preamble, { submitVerdict: {} })
submitVerdict = send.submitVerdict
injected = isTerminalSubmitDelivered(submitVerdict)No column, no row, no dispatch mutation. A later reader has nothing to consult, which is precisely the case you describe. Your read of So build it, and do not wait on me. One column on
The #15180 is not competing with this. It reports what On the conflict: confirmed, and thank you — this branch and #13762 both read One piece of context for why these have been quiet: our fork is org-owned, and GitHub refuses maintainer pushes on org-owned forks even while |
|
Moved to #15274 and closing this one — same branch, same commits, same head SHA, opened from a personal fork instead of an organisation-owned one. The reason is the one Jinwoo-H hit on #13639: GitHub does not grant maintainer push access on a fork owned by an organisation, even though the API reports Nothing about the change moved. This thread keeps the review history, and #15274 carries the code. @Tauri-EPO — same here: the scope answer stays on this thread, the code is now #15274. The |
The failure this closes
orca terminal send --enterreturned success as soon as the bytes reached the PTY.When the Enter was swallowed — a completion popup ate it, or the TUI was mid-turn —
the text sat unsubmitted in the composer and the caller could not tell that apart
from an agent that received the prompt and started work.
dispatch --injecthad thesame hole: it marked
injected = trueon a bare resolve, so a coordinator waited ona worker whose preamble was still sitting in its composer.
What this does
Orca owns the PTY and already receives each harness's own turn-lifecycle hook, so it
answers the question from that signal rather than from rendered text. A send that
carries a submit arms a watch on the pane's hook stream before writing and reports:
submittedqueuedpendingunknownMissing or stale evidence is
unknownand is never promoted tosubmitted, matchingthe convention already used for explicit agent status and the
lastAgentStatusObservedLivegate on push-on-idle delivery.
Retry rule
On
pending— and onlypending— the submit key is re-sent once. The text is neverre-typed:
pendingmeans the payload is already in the composer, so a second copywould become a doubled message.
queuedandunknownare never retried. Push-on-idlemail delivery uses the same rule.
Surfaces
terminal.sendtakes an optionalsubmitVerdictrequest and returns an optionalsubmitVerdictresult. Old host → no verdict → callers read it asunknown;old client → ignores the field. Rule 1 of
docs/reference/remote-wire-compatibility.md;the cross-version wire harness stays green.
orca terminal send --text ... --enterrequests it by default.--submit-timeout-mssets the bound,
--no-submit-retrydisables the re-send,--no-verdictskips the wait.dispatch --injectreportsinjected: trueonly forsubmitted. The dispatch contextstays open on an unproven submit — the bytes are in the pane and may still become a
turn — but it is not reported as delivered work.
The hook tap is wired once in
src/main/index.tsfromagentHookServer.subscribeEnrichedStatus,which is where local, WSL relay, and SSH relay events all land, so the verdict works on
all three transports and for folder workspaces as well as git worktrees.
Tests
src/shared/agent-submit-signal.test.ts,src/main/runtime/terminal-submit-verdict-tracker.test.ts,src/main/runtime/terminal-send-submit-verdict.test.ts,src/main/runtime/rpc/methods/orchestration-dispatch-submit-verdict.test.ts—submitted, pending, queued, unknown, mid-turn, replayed/restored rows, stale evidence,
the no-retype rule, and the dispatch guard.
tests/e2e/cross-version-wire/cross-version-terminal-wire.unit.test.ts,oxlint, bothcode-quality audits, the max-lines ratchet, and all three tsconfigs are clean. The
terminal command specs move to their own file because the new flags pushed
core.tspast the max-lines limit; splitting is the fix rather than a suppression.
Not in scope
The autonomous coordinator loop (
orchestration/coordinator.ts) still injects withouta verdict. Wiring it means changing
failDispatchcircuit-breaker accounting, whichbelongs in its own change.