Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
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: 📥 CommitsReviewing files that changed from the base of the PR and between dfd297df1ca8c77084e35706bf68e4ede597ab47 and dde27ee. 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 7 remain after this review. 📝 WalkthroughWalkthroughAdds Fleet Echo contracts and bounded lane derivation for orchestration dispatches. Runtime integration collects dispatch, worker-stage, terminal, and timestamp data, then attaches fleet data to check responses across mailbox paths and timeout states. The CLI supports 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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: 7
🧹 Nitpick comments (1)
src/cli/handlers/orchestration-fleet-echo-format.ts (1)
38-40: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueShorten this comment.
Lines 38-40 describe implementation behavior and build state in three lines. Keep only the reason for showing a non-
liveprocess state. As per coding guidelines, comments must be concise, non-obvious, and brief; prefer one line.Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 366c25ae-56a9-47c8-8622-76351dc399ad
📥 Commits
Reviewing files that changed from the base of the PR and between e4e54a1 and 9dbe9e9352647ca10a6a1e7c82c085e57c87f716.
📒 Files selected for processing (16)
skill-guides/orchestration.mdsrc/cli/bundled-skill-guides.tssrc/cli/handlers/orchestration-fleet-echo-format.test.tssrc/cli/handlers/orchestration-fleet-echo-format.tssrc/cli/handlers/orchestration.tssrc/cli/specs/orchestration.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/orchestration/db-dispatch-liveness.test.tssrc/main/runtime/orchestration/db.test.tssrc/main/runtime/orchestration/db.tssrc/main/runtime/rpc/methods/orchestration-check.test.tssrc/main/runtime/rpc/methods/orchestration-fleet-echo-sources.test.tssrc/main/runtime/rpc/methods/orchestration-fleet-echo-sources.tssrc/main/runtime/rpc/methods/orchestration.tssrc/shared/orchestration-fleet-echo.test.tssrc/shared/orchestration-fleet-echo.ts
💤 Files with no reviewable changes (1)
- src/main/runtime/orchestration/db.test.ts
Included review availability: Your plan includes up to 10 reviews per rolling hour; 8 remain after this review.
|
Listing what this PR deliberately leaves out, so reviewers do not have to find it by reading for absences. Left out on purpose, with reasoning:
One thing I would like a steer on: the block is default-on, suppressed with Also opened while working on this, all independent of these PRs: #14896 (a lane blocked on an agent question is invisible to the coordinator), #14897 (nudging a silent dispatch without taking completion authority), #14898 (a pre-existing |
|
thanks for reporting. looking into it |
|
Thanks @coderabbitai — all seven addressed in Run isolation on so a row whose denormalized This matters more than a defensive tidy-up here: #14898 is an open report of Remote worker mailbox Fixture task in the legacy Run — also correct, and worth flagging how close this came to being invisible. The test passed either way; it just was not proving what it claimed. It now creates the task in The four minor ones: The usage-string point applies to the stacked #14892 as well, where the flag reaches eight more commands; fixed there in Verification: 131 tests across the six affected files, plus 164 across the four on #14892 after rebasing it onto this. Both typechecks and |
|
Tip For best results, initiate chat on the files or code changes.
The Run isolation fix now rejects mismatched The remote mailbox path now resolves the Run from its task. The fixture now uses ᕕ(ᐛ)ᕗ 🐇 ✏️ Learnings added
🧠 Learnings usedIf you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! You are interacting with an AI system. |
f049d33 to
dfd297d
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Rebased onto
|
db.test.ts sits just under the 800-line max-lines budget, leaving no room for new coverage. Move the recordHeartbeat and getStaleDispatches tests into a new db-dispatch-liveness.test.ts — a coherent unit around detecting whether a dispatched task is still alive — and leave the dispatch-context CRUD coverage behind, which is a different concern. No assertions or fixture behaviour changed; only file location.
Add a `fleet` block that orchestration methods can attach to their response: a live snapshot of the caller's active dispatch lanes (handle, task, dispatch, lifecycle, quiet time, and delivery state), capped at 12 lanes with truncation reported. The `delivery` column is the point: `not_accepted` means a dispatched prompt never actually started a turn in the worker terminal, something a coordinator would otherwise only discover minutes later by noticing silence. This wires the fleet echo into `orchestration.check` only, including every wait/timeout return path — a complete, reviewable vertical slice covering the builder, runtime adapter, the check RPC method, CLI rendering, and the skill guide. The remaining eight orchestration methods (send, reply, inbox, task-create/list/update, dispatch, dispatch-show) get the same wiring in a follow-up PR.
- listActiveDispatchesForRun now requires dispatch_contexts.run_id to match the caller's Run and to agree with the task's, so a divergent denormalized row cannot leak another Run's lane. Regression test covers both. - A remote worker mailbox resolves its Run from the task instead of passing undefined, which had omitted the block entirely for remote worker checks. - The check fixture now creates its task in the bound Run; without it the assertion could pass against the legacy Run rather than the caller's. - quietMs null-checks the timestamp instead of testing truthiness, so an epoch-zero value means the same thing to it as it does to delivery. - The TZ-pinned test deletes TZ when it was originally unset, rather than restoring the literal string "undefined" into sibling tests. - check's usage string documents --no-fleet, and the guide's output example carries a fence language.
… a blind re-dispatch buildFleetEcho now clamps a caller-supplied limit to FLEET_ECHO_MAX_LANES. The cap is the response contract, not a default, and this block rides on every orchestration response. The guide told a coordinator to re-dispatch on `not_accepted`. That is right for a worker-start lane, where the verdict comes from the worker never reaching `input_accepted`. For a plain `dispatch --inject` there is no acceptance signal to read, so the verdict is inferred from the terminal having produced no output since the dispatch — and acting on a false positive duplicates work that is already running. The guide now distinguishes the two sources and says to confirm with `terminal read` first.
dfd297d to
dde27ee
Compare
…from The block reported accepted/not_accepted from two observations of unequal strength under the same word. A worker-start lane reads stage from the worker-dispatch row; an unsupervised `dispatch --inject` lane has no such row and the verdict was inferred from the terminal having stayed quiet since dispatched_at. Lanes now carry deliveryEvidence, rendered as NOT_ACCEPTED:output or accepted:stage, so a coordinator can tell a read verdict from an inferred one without consulting the guide. The guide's claim that a worker-start verdict is authoritative was also stronger than the code supports, and is corrected here. markWorkerDispatchReady writes stage='input_accepted' as soon as sendTerminalAgentPrompt returns, so it records that the runtime wrote the prompt, not that the agent began a turn: a composer that swallowed the submit still reports accepted (stablyai#14525). Only not_accepted is authoritative on that path.
Correcting a claim this PR made, and labelling a verdict it was flatteningPushed The guide overstated what a 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'The stage is written as soon as the prompt write returns. Nothing between those lines consults the agent, so The block was flattening two observations into one word.
This is the narrow version of the steer I asked for above ("if maintainers would rather the inferred verdict carry its own value"). I did not widen the Why now: #15105 landed today and gave the lane class this affects a name — I have filed the larger finding as #15180 rather than pulling it into this PR: neither basis observes the agent, and the signal that would answer it — a turn boundary from the harness hook stream — is on Verification on |
…p repeating a healthy table Three changes to the same problem: the block rides on every run-scoped response, so what it costs and what it hides both matter. Ranking. The cap was applied by the query's oldest-first order, so a Run past 12 active lanes truncated its newest — which is where a freshly broken lane lives. Severity cannot be a SQL predicate because it needs runtime signals, so the query now reads a wider bounded window and the builder ranks it before cutting: a not_accepted read from the worker row, then one inferred from silence, then a dead process, then the longest silence. Truncation lands on the healthy tail. Past the window ranking degrades to age, which the guide states rather than hides. Repetition. A healthy fleet says the same thing on every response. Text mode now collapses it to one line and opens the full table as soon as any lane needs attention, so the table itself is the signal. JSON keeps every lane: a machine consumer can summarize, and a payload that changes shape with its contents is a worse contract than one that does not. Honesty. The guide now says the block answers which lane to look at, and does not cover a coordinator parked in check --wait, since it only arrives when asked. It also drops the lifecycle column from the table, which delivery already implies.
|
Pushed Ranking, because the cap was cutting the wrong end. Lanes came back in the query's oldest-first order, so a Run past 12 active lanes truncated its newest — which is exactly where a freshly broken lane lives. Severity cannot be a SQL predicate, since it needs runtime signals the query cannot see, so the read is now a wider bounded window and the builder ranks it before cutting: Truncation now lands on the healthy tail. Past the window it degrades to oldest-first, and the guide says so rather than leaving it to be discovered. Equal-severity lanes keep query order, so two identical responses do not shuffle. Repetition, because a healthy fleet says the same thing every time. Text mode collapses to one line when no lane needs attention and opens the full table — every lane, not just the degraded one — as soon as any does: That makes the table itself the signal. JSON keeps every lane in every response: a machine consumer can summarize, and a payload whose shape depends on its contents is a worse contract than one whose shape is fixed. Honesty, because the guide was selling more than the block does. It now states that this answers which lane to look at, and does not cover a coordinator parked in The Verification on |
|
Closing this, and #14892 with it. Recording why here rather than just hitting the button, because the reason is about ordering, not about the code. What changed underneath itThis branch was written on 2026-08-16. Three things have shipped since that it re-derives by hand:
Each of those is fixable with a rebase and a rename. That is not why I am closing it. The ordering problemA fleet read has to report a delivery verdict per lane, and what that verdict is has not been decided. It is DEC-01 on #15190, and #14962 landing the throwing guard in v1.4.187 changed that question rather than settling it. Landing this PR would have written my guess at an open contract into a So this was built at the wrong point in the sequence: a read surface over an unsettled contract, using hand-rolled inference for three things that now have shipped answers. What this is notNothing here says the capability is unnecessary. READ-01 and READ-02 on #15190 stay open as reports, and they now read The review rounds on this branch produced two things worth carrying into whatever replaces it: the Run-isolation fix on |
ELI5
You dispatch a task to a worker terminal. Sometimes the prompt never actually reaches the agent — it sits in the composer, or the dispatch was recorded but never delivered. Today you find out minutes later, by noticing that nobody ever replied.
This makes
orca orchestration checktell you. Every response now carries a small table of your Run's live lanes, and one column says whether each lane's prompt actually started a turn.What Changed
orchestration.checkresponses gain an optionalfleetblock: one row per active dispatch in the caller's Run.Columns are handle, task, dispatch, lifecycle, quiet time, and delivery;
processStateis appended in parentheses only when it is not healthy.deliveryis the point.not_acceptedmeans the prompt never started a turn — that lane needs re-dispatching, and waiting on it will never resolve.check --waitreturns the block on timeout too, so a timeout says why nobody spoke instead of only that nobody did.pending,dispatched), capped at 12 lanes withtruncated: truebeyond that.--no-fleetsuppresses it. Under--jsonit stays in the payload.deliveryhas two sources:worker_dispatches.stagereachinginput_acceptedfor worker-start lanes, and — for a plaindispatch --injectonto an existing terminal, which creates noworker_dispatchesrow at all — comparingdispatched_atagainst the terminal'slastOutputAt, since a delivered prompt makes the terminal emit.processStatereportsdeadorunknown, neverlive. A connected PTY does not prove the agent inside it is alive, so the runtime does not claim liveness it has not established.New files: a dependency-free builder in
src/shared/, a runtime adapter, and a CLI renderer.OrchestrationDbgains one query;OrcaRuntimeServicegains one handle-scoped accessor.Why
Relates to #14809 (
dispatchwithout--injectrecords the dispatch, never delivers it, and says nothing) and #14523 ("an orchestrator triaging 5+ worker terminals cannot useterminal listto decide who is stuck vs working; every decision requires a per-handleterminal read, which is O(n) round-trips").The design choice worth arguing about: this rides on an existing response rather than adding a
healthcommand. A coordinating agent forgets to poll — an envelope does not. There is no new command to learn and no turn spent checking; the truth arrives with work the coordinator was already doing.Deliberately not in this PR: any supervisor. No nudging, no escalation ladder, no state table. This only reports.
Linked Issue
Part of #14907. Not
Fixes, because that issue asks for the block on the commands a coordinator already runs and this PR delivers it only oncheck; #14892 completes it and carries theFixes.Also relates to #14809 (the silence it removes, though the
--injectdefault is unchanged) and #14523 (theO(n)triage round-trips it removes, thoughterminal listpreview freshness is untouched).Visual Proof
N/Afor UI — this is CLI/RPC surface only, no renderer changes. The before/after is in What Changed above: previouslycheckreturned only its messages, now it additionally returns thefleetblock shown there. Under--jsonthe block is an additive field older clients already strip.Testing
checkwiring, CLI renderer, DB query — 131 passing across 6 files.src/main/runtime/rpc/methods/andsrc/cli/handlers/— 1143 passing.pnpm exec tsc --noEmiton both the node and CLI projects — clean.pnpm exec oxlint src/ config/— clean.pnpm run lintandpnpm build— both pass locally.TZ=America/Sao_Paulo. See the note in Review.Tested on Windows 11.
AI Disclosure
Written with Claude Opus 5 via Claude Code. Design decisions were made in collaboration with the author; implementation and review passes were agent-assisted, then verified by the author.
Review
dispatched_atfallback initially used a bareDate.parseon SQLite's space-separated, timezone-less UTC, which V8 reads as local time — that made every--injectlane readNOT_ACCEPTEDwest of UTC andacceptedeast of it. Now normalised through the existingexposeUtcTimestamp, with a TZ-pinned regression test.processState: unknownrather than guessing. No new wire opcode; the block is an additive field on an existing result, which older clients strip.fleetparam means on;--no-fleetopts out.ptyController.listProcesses(), bounded at 3000ms, once per command — not per lane. It is skipped entirely when the Run has no active lanes, and the whole build sits inside atry/catchthat returns the untouched result on any failure, so the block can never fail the command carrying it. If reviewers would rather this be opt-in rather than default-on, that is a one-line change and I am happy to make it.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Note on the last box:
pnpm lintand both typechecks pass locally. The fullpnpm testsuite cannot start on Windows from a clean install of this repo — see #14918. Briefly:[email protected]installs with an emptybuild/, so the Windows branch ofensure-native-runtimerefuses to run the suite. Not specific to this branch, and not a Node version problem (reproduced identically on Node 22 and 24).Running vitest directly, bypassing that wrapper, the suite has pre-existing failures on this Windows machine unrelated to this change (missing POSIX shell,
spawnSync … EINVAL, assertions expecting/and receiving\). I verified attribution by running the entire suite on the merge base and on this branch and diffing the failing-file lists: the base fails 81 files, this branch fails the same 81 plus one timing-flaky test inremote-runtime-shared-control-connection.test.tsthat this branch does not touch and that passes 28/28 in isolation.Author