Repository navigation
chore: verify OpenCode 2.0.27 and record its MCP resume race - #375
Merged
Merged
Conversation
stamp-build Bot
added a commit
that referenced
this pull request
Nov 20, 2026
…or, DSH, Factory, and Pi Durable (#1070) <!-- stamp:review:v1 --> <sup><img src="https://api.raft.build/api/avatars/pixel/ZXll.svg" width="16" height="16" align="absmiddle" alt=""> <b>Lookout</b> from open-agent-runtime opened this pull request through Stamp</sup><br><sup><a href="https://stamp.build/review?receipt=prc_2f47dc7fecca6e2c6e48943e85683c53"><picture><source media="(prefers-color-scheme: dark)" srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg" width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp →</a></sup> --- <!-- /stamp:review:v1 --> ## Summary Fix the runtime-specific `steer` and `abort()` issues assigned in `#core:#375` (from the `#agy-soak:046f9f1b` audit, re-verified against `main` `94e43d10`), plus the corresponding Decisions 2, 3, 4, and 5 requirements on those runtimes. Community Morph was not modified; filed low-priority issue #1069 instead. ## Per-Item Verification & Changes - **B.3 Pi RPC (`packages/oar/src/runtimes/pi/rpc/session.ts`):** - Disarm the 10 s `fallback` timer when `{ type: "abort" }` returns `{ success: false }` (`pi/abort_rejected`), instead of discarding the disarm handle and killing the live process 10 s later. - Track `exitSettled` from `rpc.child.onExit` and await it in `kernel.dispose` (both active release and `afterExit`) so a `dispose()` racing with process exit never leaves a dangling `dispose` request. - Regression test: `tests/pi/pi-rpc-abort-dispose.test.ts`. - **B.6 Factory manual compaction `abort()` (already fixed on `main` `94e43d10`):** - Verified `packages/oar/src/runtimes/factory/session.ts:256` already rejects `busy` when `compaction.busy()` is true. No change needed. - **B.7 Factory abort refusal rollback (`packages/oar/src/runtimes/factory/session.ts`):** - Roll back `abortingTurn = false` in `factory/session.ts` when `droid.interrupt_session` fails/refuses (Decision 4), so a subsequent retry still reaches `droid`. - Regression test: `tests/factory/factory-session.test.ts` (`refuse-interrupt` mode in `tests/fixtures/fake-droid.mjs`). - Note: per review, the shared `observe/` status/busy rule for `queued_message_handed_back` (a late end or drop for a non-current turn must not move `status()`) moves to `#core:#374`. - **B.8 Cursor `abort()` (`packages/oar/src/runtimes/cursor/session.ts`, `packages/oar/src/runtimes/cursor/run.ts`, `docs/runtimes/cursor.md`):** - **B.8a + Decision 4:** Extracted `cancelActiveRun` in `cursor/run.ts` to catch `run.cancel()` rejections (classifying a late-cancel race after run end as `no_active_turn` and a live native refusal as `runtime_refused` instead of `error`), bound `abort()` at 10 s (`abortTimeoutMs`), arm a 10 s subprocess `createAbortFallback` that stops the subprocess if the run ignores cancel, and bound `run.cancel()` in `dispose()` under `DISPOSE_SETTLE_MS`. - Documented the in-process 10 s timeout limitation in `docs/runtimes/cursor.md`. - **B.8b (verified intentional by spec):** `docs/spec/manual-compaction.md:154-155` and `tests/cursor/cursor-manual-compaction.test.ts:115-130` explicitly specify that Cursor accepts an early cancellation before `summarize()` supplies the run and applies it when the run arrives. Left unchanged. - Regression tests: `tests/cursor/cursor-abort-edge-cases.test.ts`. - **B.9 Pi SDK `abort()` in `agent_end` to `agent_settled` (`packages/oar/src/runtimes/pi/session.ts`):** - Verified against installed `@earendil-works/pi-coding-agent` (`AgentSession.abort()` calls `abortRetry()`, `abortCompaction()`, `abortBranchSummary()`, and sets `_abortDuringBeforeSettle` while `isStreaming` is `false`). - Changed the active-run check from `piAgentSession.isStreaming || compaction.busy()` to `nativeActive || piAgentSession.isStreaming || compaction.busy()`, matching `pi/rpc/session.ts:207`. - Updated `tests/pi/pi-turn-preflight.test.ts` to assert `abort()` calls native `abort()` once during `agent_end -> agent_settled` without leaking onto the next run. - **B.10 Codex `abort()` refusal (`packages/oar/src/runtimes/codex/session.ts`, `refusal.ts`):** - Routed `abortPlan.onError` through `codexControlRefusal(message, native)` so `turn/interrupt` preserves `session_not_found` (`-32600 thread not found`), `failure` (for example `-32001` `overloaded`), and `native`. - Regression test: `tests/codex/codex-abort-refusal.test.ts` (and updated `tests/codex/codex-session-stream.test.ts` to expect `native`). - **B.11 DSH RPC exit and fallback ordering (`packages/oar/src/runtimes/dsh/control.ts`, `session.ts`):** - Tagged exit rejections in `dshControl` (`isDshExitedError`) and mapped them to `code: "runtime_exited"` (not `"error"`) in `dsh/session.ts`. - Moved `fallback.clear()` before `kernel.frame(...)` on root `turn_ended` so a synchronous observer's new turn abort fallback is never cleared by the prior turn's end. - Checked `!active() && !prompting` before `withInputImages` in `steer` so idle `steer` with images answers `no_active_turn` before `unsupported` (Decision 3). - Regression tests: `tests/dsh/abort-and-exit.test.ts`. - **B.12 Pi Durable (`packages/oar/src/runtimes/pi-durable/session.ts`, `projection.ts`, `docs/runtimes/pi-durable.md`):** - Check live running state (`await flush()` + `liveOf(state.view).run ?? liveOf(observation.value).run`) before image validation (Decision 3) and before duplicate-`inputId` idempotency on `steer` (B.12a), and await `admissions` + `flush()` in `abort()` so immediate post-`prompt()` `steer`/`abort` agree with `status() === "running"` (Decision 2 / B.12b). - Pass `whenIdle: "reject"` on `steer` and map native `ConversationIdle` to `no_active_turn` (preserving `ConversationBusy` as `runtime_refused` when locally idle per `pi-durable-watch.vendor.test.ts`). - Separate `conversation.submit()` from `submission.status()` error handling so a status-read failure after a durable commit records `pi-durable/submissions_error` and still returns `accepted` (B.12c). - Bound `abort()` at 10 s (Decision 4) and document the in-process timeout behavior in `docs/runtimes/pi-durable.md`. - Observe unplaced `pi.inbox` removals whose native receipts settle `unanswered` with `reason: "aborted"` (excluding explicit `withdraw()`) and emit `input_dropped` with `reason: "turn_interrupted"` (Decision 5). - Updated `docs/runtimes/pi-durable.md` and added `tests/pi-durable/controls.test.ts`. ## Call-Site Audit - **`codexControlRefusal` (`packages/oar/src/runtimes/codex/session.ts`):** Checked all 4 control plans (`promptPlan`, `steerPlan`, `queuePlan`, `abortPlan`); all 4 now route through `codexControlRefusal(message, native)`. - **`createAbortFallback`:** Checked all 6 call sites across `packages/oar/src/`: - Changed: `pi/rpc/session.ts` (capture and call `disarm()` on refusal), `cursor/session.ts` (added subprocess fallback + bounded cancel), `dsh/session.ts` (clear before `kernel.frame`), `factory/session.ts` (roll back `abortingTurn` on refusal). - Unchanged (owned by Otter `#core:#374`): `shared/abort-fallback.ts`, `shared/stream-json/session.ts`, `shared/acp/turns.ts`, and `onFallback` requirement on Factory/DSH `arm()`. - **Community runtimes:** Untouched; Morph tracked in #1069. ## Verification - Local `CI=1 pnpm run check`: typecheck, oxlint (0 warnings), vitest (`583` files / `5,510` tests passed), and mock sea-trial (`19` passed, `1` skipped, `0` failed), plus `OAR_TEST=pi-durable-aimock` `sea-trial/vendor/pi-durable-watch.vendor.test.ts` (`9` passed). --------- Co-authored-by: Lookout <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenCode 2.0.27 now returns a nonempty cold model catalog, so the boundary probe must expect
okwith models instead of reproducing the 2.0.26 failure. This records today's core-runtime inventory, updates the probe with the requested cwd, and documents the current v2 evidence.The check also found the native MCP resume race in #371. A standalone Node script sends ACP JSON-RPC without importing OAR, saves native catalog/connection evidence, and requires an actual completed echo result. The runtime page names the known issue; there is no adapter workaround or dependency change. The upstream-report draft has been delivered to Cindy for account-owner approval and has not been posted upstream.
Validation:
a34e670; full check passed (1,754 tests, mock behavior suite) and both packages built.Detailed evidence and reproduction commands are in
experiments/runtime-version-checks/2026-10-12.md. #371 remains open.