Repository navigation
fix(pi): record native input handling separately from turns - #640
Merged
Merged
Conversation
stamp-build
Bot
force-pushed
the
agent/otter/pi-handled-inputs
branch
2 times, most recently
from
November 5, 2026 14:52
cb1608c to
a76a457
Compare
added 5 commits
November 5, 2026 17:42
stamp-build
Bot
force-pushed
the
agent/otter/pi-handled-inputs
branch
from
November 5, 2026 17:47
83b217d to
0b570c7
Compare
Merged
stamp-build Bot
added a commit
that referenced
this pull request
Nov 6, 2026
<!-- stamp:review:v1 --> <sup><img src="https://api.raft.build/api/avatars/pixel/bXVn.svg" width="16" height="16" align="absmiddle" alt=""> <b>Cindy</b> from open-agent-runtime opened this pull request through Stamp</sup><br><sup><a href="https://stamp.build/review?receipt=prc_54f421873fe7cccec5ccf5a973fd55d4"><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 --> Pi extensions can handle input without starting a turn, and helpers now say so. Codex reports reconnects and no longer loses replies that arrive without text deltas. ## Pi: input handled without a turn (#640) An extension can handle input without a model turn. SDK used to stay busy, RPC could admit another prompt while status read running, and accepted queue dispatches could disappear during extension processing. Native handling now resolves only its own input and keeps independently started runs. **Public type changes:** - `promptAndWait` adds `kind: "handled"`. Exhaustive `PromptRun.kind` switches must handle it, and code that reads `outcome` after excluding only `rejected` must also exclude `handled`. Handling is not a success outcome and carries no text. - Input-scoped `awaitTurnEnd` and `turnEndAfter` widen to `TurnOutcome | InputHandled`. Unscoped next-turn waits are unchanged. - New event `input_handled { requestId, inputId? }`. `input_dropped.inputId` is now optional, because a request reference can identify an input with no logical id. - Pi prompt records add `admission: "native"`, and `SessionView.statusState` is available on every runtime. - The CLI's JSON output for handled input is `{ disposition: ... }`, with no `completed` outcome. **Behaviour changes on every runtime:** - An accepted `withdraw` resolves input-scoped waits with `aborted`, and a rejected dispatch resolves them with `failed`. These waits could stay pending before. - `awaitIdle` resolves with `null` when a provisional prompt is rejected before a turn exists, including `busy`, and after standalone manual compaction. It could stay pending before. **Behaviour changes on Pi:** - An abort accepted during preflight reaches only a run that starts before the handled or refused receipt. An extension run starting after `handled` needs its own abort after `turn_active`; SDK used to cancel it through a stale marker. - SDK holds queued input until its prompt promise finishes, so settlement hooks keep the A, EXT, B order. A run that started before OAR subscribed still ends when later native run events provide evidence; with no evidence at all, no turn end is produced. Idle custom messages no longer count as a run. **Known limits, in `docs/runtimes/pi.md`:** a queued command that launches an extension message and returns can let the next input win the native slot, and the extension message then fails with an `extension_error` frame. RPC has no equivalent barrier, so either the held input or the extension message can lose that race. A prompt during an unobserved run's settlement can still stall (task #181). ## Codex: reconnects are `retry` events (#647) - `error` with `willRetry: true` now produces `retry`, with the native text as `reason`. `attempt` is OAR's count within the turn. Status reads `waiting_model` on it. - **OAR adds no stderr channel or OOM option.** A dropped stream reports itself in the protocol, with no stderr line on Codex 0.163.0 and 0.167.0. A host wanting runtime children killed first can wrap `installation.command`: see [process priority](https://github.com/botiverse/oar/blob/main/docs/spec/runtime-matrix.md#process-priority) and the [decision](https://github.com/botiverse/oar/blob/main/docs/design/decisions.md#no-stderr-channel-or-process-priority-option-2026-11-06). ## Codex: completed messages and native metadata (#648) - An `agentMessage` with completed text and no text deltas lost its reply. Its `item/completed` frame now gives the full text once. Streamed replies are not repeated, and a partial stream is not extended. - `text_delta` gains optional `phase` when native reports it. `tool_call_started` gains optional `server` and `toolName` for MCP calls; `tool` stays `mcpToolCall`. - `codexErrorInfo: "unauthorized"` now classifies as `auth`. This follows the generated 0.167.0 protocol; no account failure reproduced it. ## Evidence and tests - The daily check now covers the DSH CLI; DSH 0.2.2-rc.1 passes with local providers, and the CI pin stays 0.2.1-rc.5 (#644). - Qoder 1.1.83 passes inference, file tools and resume with a Free account and a DeepSeek pay-as-you-go key. First-party models are unverified (#644). - Windows CI keeps watchdog startup diagnostics (#645) and retries one more directory removal (#643). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Cindy <[email protected]>
stamp-build Bot
added a commit
that referenced
this pull request
Nov 9, 2026
<!-- stamp:review:v1 --> <sup><img src="https://api.raft.build/api/avatars/pixel/bXVn.svg" width="16" height="16" align="absmiddle" alt=""> <b>Cindy</b> from open-agent-runtime opened this pull request through Stamp</sup><br><sup><a href="https://stamp.build/review?receipt=prc_0ee425e45cd7f3637108653462446205"><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 --> Weekly documentation pass for the runtime pages (antigravity, claude, codebuddy, codex, cursor, dsh, grok, kimi, morph, opencode, pi, pi-durable, qoder, qwen), 93 commits after the 11-02 pass. Each page was compacted where it grew and checked against `packages/oar/src`, then a separate verifier compared the diff with `main` for dropped facts, qualifiers, evidence links, meaning changes and anchors. Corrections where the page disagreed with the code: - Codex: server requests are answered with native refusals (`runtime-requests.ts`), not left open; `thread/compact/start` is reachable through `Session.compact`; child threads are stopped through `stopTask` (`unsupported` for root or unrelated ids, `no_active_turn` without an active turn). - Refused options (`goals`, `endTurnProcessesOnAbort`, and others) and `manualCompaction` declarations added where pages omitted them; Pi Durable `goals` carries its own reason. - Grok CI pin 1.0.70; Qoder compaction outcomes `aborted` and `native_failed`; CodeBuddy (30 s) and Cursor (20 s by default) `authStatus` deadlines return `unknown`. - Pi: the A, EXT, C ordering note names OAR's SDK queue draining before #640, not an older Pi SDK. - Two experiment links pointed at Antigravity headings removed in #622; they now point at current headings. No evidence pointer was removed; every heading other files link to is kept. Docs only, so no CI runs; local link and anchor check passes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Cindy <[email protected]>
stamp-build Bot
added a commit
that referenced
this pull request
Nov 9, 2026
…red runtime pages (#708) <!-- stamp:review:v1 --> <sup><img src="https://api.raft.build/api/avatars/pixel/bXVn.svg" width="16" height="16" align="absmiddle" alt=""> <b>Cindy</b> from open-agent-runtime opened this pull request through Stamp</sup><br><sup><a href="https://stamp.build/review?receipt=prc_1ca34f21cf39bcaef4dea167fbead022"><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 --> Weekly documentation pass for the package READMEs, docs/development.md and the shared runtime pages (README, install, update, steer-delivery, resume-cwd, crash-resume, input-cancellation, inventory, live-configure), plus two stale comments in `contracts/records.ts`. Corrections where the docs disagreed with the code: - packages/oar/README.md: both `PromptRun` examples failed `tsc` after the `handled` branch (#640); they now narrow with `"outcome" in run` and typecheck. DSH added to the reasoning, withdraw (where its inventory advertises it), stdio-only MCP, no updater/login/inventory and model lists; cursor and OpenCode v2 report compaction, codex reports retry; `stopTask`, `retainedBytes`, tool annotations, inventory `env`, `authStatus` timeout as `unknown`. - packages/cli/README.md: `oar run` exits 0 on a handled prompt (`run.ts:129`), 130 on the first Ctrl-C, 1 otherwise. - development.md: `antigravity-aimock` backend, `dsh-aimock` stderr job, Qoder 1.1.81 pin, `DSH_MINIMUM_VERSION`, agy Windows bare exe, `osv-scanner.yml`. - update.md: Pi `^1.5.0`, `@cursor/sdk` 1.2.0; Antigravity `checkUpdate` reads the CLI manifest and has no `upgrade`. - steer-delivery, resume-cwd, input-cancellation, inventory, install, live-configure, crash-resume: DSH, Antigravity agy CLI, Morph and Pi Durable entries match their adapters. - records.ts comments: retry emitters include pi-durable and community morph; Codex `serverRequest/resolved` produces no `app_request_cancelled` because OAR answers every Codex request. A separate verifier checked every changed claim against the code (file:line) and typechecked the README examples. `pnpm run check` passed locally (3,783 tests, mock behavior 18 passed, 1 skipped). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Cindy <[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.
Pi extensions can handle input without starting a model turn. SDK previously kept that input busy, RPC could admit another prompt while the fold stayed running, and accepted queue dispatches could disappear during extension processing. Native handling now resolves only its own input and preserves independently started runs.
Native callbacks and original RPC replies supply
input_handled { requestId, inputId? }. Refused queue dispatches supply request-correlatedinput_dropped, without retrying hooks. Pi prompt records addadmission: "native"; queue acceptance andcarriesdispatch preserve one logical submission. Shared status, conversation and wait helpers track admission separately from native activity.SDK queue draining waits for the owning native prompt promise, including deferred settlement actions. Independent runs arm a native idle wait while active. Fast and slow settlement hooks retain A → EXT → B order. Non-custom message, tool or turn events also prove a run whose
agent_startpreceded subscription. Idle custom notices remain native frames without occupying a run or inventing completion, including notices flushed by failed preparation.Preflight cancellation is consumed once and ends at the handled/refused receipt. EXT starting after that receipt needs its own abort; the RPC deadline starts when cancellation is delivered. Accepted withdrawal resolves input-scoped waits with
abortedacross runtimes, including native queues. Valid dispatch refusal resolves those waits withfailed; provisional direct rejection and standalone compaction resolveawaitIdlewith null.Public type changes belong in the minor release after 0.88.0:
PromptRunaddskind: "handled"; only input-scoped waits widen toTurnOutcome | InputHandled;input_dropped.inputIdbecomes optional alongside its request reference. CLI JSON prints the handling disposition. Pi Durable and ordinary terminal-observer submission restrictions are unchanged.Retained limits are documented: a handled queued command can launch detached EXT after the next input wins native admission; RPC can lose either EXT or the held input according to that race. Extension errors remain observable. Duplicate accepted input IDs and synthetic mixed-child admission logs are also outside this repair.
Rebased the approved
83b217d7onto37b27726. Product and test patches are unchanged. The only manual conflict was theturn_activesource list in record-stream.md, which now retains both the newly merged DSH sources and Pi admission receipts.Validation on Linux x64 for this rebase:
0b570c74, base37b27726: full check (3,484 tests and 18 mock behavior cases), build, and Kimi behavior pass.98f498fc: all 16 behavior backends, full Pi 1.5.0 vendor suites (119 SDK / 113 RPC), build and clean packed-consumer installation pass. The subsequent base change only adds PR fix(kimi): preserve account usage read failures #637's Kimi account-usage classification, covered by the final check and Kimi rerun.83b217d7: all 36 cross-platform CI checks passed, along with 19 focused RPC 1.4.0 cases and the recorded mutation controls. These remain historical evidence. All 39 CI checks for final head0b570c74now pass, including Windows and macOS (run 42078076588).The system-prompt fixture canonicalizes cwd and clears temporary-directory overrides inside its path-query child, because libuv restores a missing Windows TEMP at spawn. Existing replay snapshots and expected prompt content are unchanged. No deadline or assertion was relaxed.
Evidence, reproduction and release notes. Task #173; stream-json/Cursor held-queue work remains task #161. The independently identified bootstrap-run delayed-admission case is tracked in task #181. 0.88.0 is published and the release merge pause has been lifted.