Skip to content

feat(orchestration): fix check --wait + read/unread semantics#1389

Closed
Jinwoo-H wants to merge 1 commit intomainfrom
Jinwoo-H/orca-improvements-check-wait
Closed

feat(orchestration): fix check --wait + read/unread semantics#1389
Jinwoo-H wants to merge 1 commit intomainfrom
Jinwoo-H/orca-improvements-check-wait

Conversation

@Jinwoo-H
Copy link
Copy Markdown
Contributor

@Jinwoo-H Jinwoo-H commented May 4, 2026

Summary

  • Fixes ORCHESTRATOR_FEEDBACK.md items 1, 2, 3, 4
  • §3.1 transport keepalive frames (10s interval) lift the 30s server-side + 60s client-side RPC ceiling; long-poll admission counter (cap 16) with AbortController cancels the waiter when the socket dies
  • §3.2 splits the read bit: new delivered_at column means push-on-idle no longer clobbers the coordinator's unread signal
  • §3.3 adds check --all + inbox --terminal <handle> for consistent "show everything" semantics
  • §3.4 stderr JSON heartbeat (15s) so check --wait from Claude Code's Bash tool no longer auto-backgrounds
  • Design doc at DESIGN_DOC_CHECK_WAIT_FIX.md (local-only; not checked in)

Test plan

  • pnpm typecheck clean
  • 137/137 targeted tests pass (runtime-rpc, rpc/methods/orchestration, orca-runtime, envelope-schema, formatter, subprocess)
  • Full test suite 4008/4014 (6 pre-existing failures in shell-ready tests unrelated to this change)
  • Manual smoke: check --wait --timeout-ms 90000 resolves from a Claude Code Bash subprocess without auto-backgrounding
  • Manual smoke: check --all returns consumed messages while default check still filters

…ck --wait

Implements the four §3 fixes from the check-wait design doc:

- §3.1 Transport keepalive: long-poll RPCs (orchestration.check --wait) emit
  `{"_keepalive":true}` frames every 10s so neither server nor client tears
  the socket down on idle. A `longPoll` admission counter capped at 16 fails
  fast with `runtime_busy` when saturated; an AbortController wired through
  the RPC dispatcher cancels the inner waiter the moment the socket closes.
- §3.2 delivered_at split: push-on-idle now stamps `delivered_at` instead of
  flipping `read`, so the check caller remains the sole consumer of its
  queue. Adds a synchronous idempotent schema migration that hard-fails on
  error.
- §3.3 inbox/check parity: `orchestration inbox --terminal <handle>` and
  `orchestration check --all` agree on the same rows (sequence DESC, no
  mark-read). `check --unread=false` kept for one release as a compat shim.
- §3.4 CLI heartbeat: `orca orchestration check --wait` emits JSON heartbeat
  lines to stderr every 15s so Claude Code's Bash tool sees continuous
  output and doesn't auto-background the subprocess.

Tests: extends runtime-rpc, orca-runtime, envelope-schema, orchestration
method, and formatter suites; adds a subprocess test that spawns the built
CLI and verifies stderr line-flushing, heartbeat cadence, and stdout
cleanliness end-to-end.

Co-authored-by: Orca <help@stably.ai>
@Jinwoo-H
Copy link
Copy Markdown
Contributor Author

Jinwoo-H commented May 4, 2026

Superseded by #1403, which bundles this PR with the other three orchestration improvement PRs and resolves the merge conflicts they shared. Branch preserved for diff comparison — not deleting.

@Jinwoo-H Jinwoo-H closed this May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant