Repository navigation
fix(claude): stream partial text and reasoning without duplicate blocks - #233
Merged
Merged
Conversation
xxchan
force-pushed
the
fix/claude-partial-messages
branch
from
October 8, 2026 08:07
c001fdf to
db79401
Compare
Merged
xxchan
added a commit
that referenced
this pull request
Oct 8, 2026
Release OAR and CLI 0.41.0. This PR changes only the two package version fields. **Behavior change for claude** (#233, closes #226) - claude now runs with `--include-partial-messages`, so text and thinking show up while they are generated. - `text_delta` and readable `reasoning` from claude are now streamed pieces, as they already were for codex and pi, instead of whole blocks. A completed block does not repeat what was already streamed. Tool calls still start once, with their complete input. - Every native `stream_event` is recorded as a frame, so a claude session produces many more, smaller records. Hosts that store records should budget for this. For display, `events(observer, { coalesceText: true })` merges the pieces. - `stallOf` counts streamed tool arguments as activity, so a long generation is no longer mistaken for silence. - `reasoning` events gain an optional `messageId`; coalescing keeps reasoning from different messages apart. - Background Task children still report complete blocks only: claude sends no stream events for them. **New** (#232, closes #225) - `SessionOptions.disallowedTools`: runtime-native tool names to disable through each runtime's own deny channel, on new and resumed sessions. Give the list again on resume. Omitted or empty adds no restriction. OAR never builds an allowlist and never hides tool events. - claude: `--disallowed-tools`, for example `Bash` or `mcp__server__tool`. Unknown or wrong-case names (`bash`) are accepted silently and disable nothing. - pi: the SDK's `excludeTools`. Unmatched names are accepted silently and disable nothing. - cursor: the SDK's `disallowedTools`, including the groups `shell` and `mcp`. Unknown names refuse with `UnsupportedOptionError`. Native subagents have their own toolset; deny `task` to stop them. - codex: only qualified MCP names `mcp__server__tool` on one unambiguously named configured or session server, through `disabled_tools`. Existing denials are kept. Built-in names refuse. - antigravity: its canonical built-in filter names only. MCP, client tools and unknown names refuse. - grok, kimi, opencode: any non-empty list refuses (`refusedSessionOptions.disallowedTools`). - This selects tools. It is not a sandbox: another allowed tool may do the same work. Validation: all 13 checks passed on #232's final head (`7cb1eda`) and #233's final head (`db79401`), and each merged tree equals its CI tree. After this PR passes CI and merges, tag its exact squash commit as `v0.41.0` to trigger npm trusted publishing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: exe.dev user <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
xxchan
added a commit
that referenced
this pull request
Oct 8, 2026
Closes #227 (second step; the evidence matrix was #230). ## What changes **Contract (additive)** - `FailureClass` gains `model_unavailable`, `input_too_large`, `rate_limited` and `billing`. - A failed `TurnOutcome` gets two optional fields, set only where the runtime says them: - `credential`: `"missing" | "rejected"`; - `status`: the provider's HTTP status. - New `RuntimeFailureError { failure, credential?, status?, reason }`. `session()` rejects with it when the open fails for one of these causes: - ACP -32000 on initialize, authenticate, new or resume → `auth`; - a -32602 answer to the model call → `model_unavailable`; - cursor's `AuthenticationError` → `auth`, `rejected`; - a pi model oar doesn't find → `model_unavailable`. - `observe`: - `failureAdvice(failure)` returns `{ retry: "now" | "later" | "no", userAction }`; - `failureText(failure, runtimeName, credential?)` covers the new classes. **Mapping.** Each adapter reads the runtime's own category first, then the provider error body (`code`, then `type`), then the HTTP status. Matching words is each adapter's documented last resort. | runtime | reads | |---|---| | claude | `assistant.error`, then `api_error_status` / `terminal_reason`; the 400 spend limit by its words | | codex | `codexErrorInfo`, including the transport variants' `httpStatusCode`; for `other`, the code in the provider's JSON body | | pi | `errorMessage`: the status prefix and the JSON body; pi-ai's `isContextOverflow` | | grok | -32003 → `rate_limited`; for -32603, the final `retry_state.error_type` | | ACP | -32000 → `auth` (no `credential`); opencode by its words | - Values a runtime declares but no run produced stay unmapped and are documented. - An OpenAI 429 whose code names a quota or a balance is `quota` / `billing`; only a bare 429 is `rate_limited`. **Fixed misclassifications (each now covered by a test)** - claude: "Credit balance is too low" was `unknown`, now `billing`. An oversized context was `unknown`, now `input_too_large`. - codex: `serverOverloaded` was `unknown`, now `overloaded`. `contextWindowExceeded` was `unknown`, now `input_too_large`. **Docs** - runtime-matrix: the mapping rules, the oar column of each table, the known ambiguities, the vendor tests. - conversation.md: `failureText` with `credential`, and `failureAdvice`. - README; the claude, grok, cursor and kimi pages (kimi now links MoonshotAI/kimi-code#1865); roadmap. ## Behavior changes worth a release note - `FailureClass` has four new members: a host's exhaustive `switch` over it stops compiling until it handles them. - A 429 that names no quota or balance is now `rate_limited`; it was `quota`. - `failureText("auth", name)` without a credential now reads "could not authenticate". It used to read "is not signed in", which was wrong for a refused API key (the Raft complaint in #227). - Some opens now reject with `RuntimeFailureError` (still an `Error`, with the same message; its `reason` reads the message and the agent's error is its `cause`, both redacted like the message when the session carries credential-bearing `mcpServers`) where they rejected with the raw `RequestError` or a plain `Error`: - an ACP agent that requires auth; - a -32602 model answer; - cursor's refused key; - a pi model oar doesn't find. - A grok -32603 reason now includes its `data` text (the provider's answer), not only "Internal error". ## Tests - Unit tests for every mapping, built on the observed facts: `tests/failure-mapping.test.ts` and `tests/failure-class.test.ts` (shared rules, `failureAdvice`). - A claude projection test for the wiring, and updated display-text tests. - Vendor tests, one per mapped cell: - `sea-trial/vendor/failure-classes.vendor.test.ts` runs in CI against the real binaries (claude 10 cells, codex 13, pi 11). - `sea-trial/vendor/failure-classes-acp.vendor.test.ts` runs locally like the other ACP vendor tests: grok 5, kimi 3, opencode 4, antigravity 3. It also pins kimi's and antigravity's completed-looking failures. - Two existing vendor snapshots gained `status: 400`. - `pnpm run check` is green (1127 tests, mock 19/19). After the rebase onto main (#232, #233), the claude/codex/pi vendor suites pass locally, and so do the four ACP suites. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: exe.dev user <[email protected]> Co-authored-by: Claude Opus 5.5 <[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.
Claude now requests
--include-partial-messagesfor new and resumed sessions. Long text and thinking appear while generation is in progress, and streamed tool arguments keep the activity clock moving sostallOfdoes not mistake generation for silence.Every native partial frame remains in the record stream. Text and thinking deltas carry the API message ID; completed assistant blocks emit only content not already streamed. Deduplication tracks each content block within its agent's message, preserving child attribution and messages with multiple blocks.
message_stopreleases only that agent's partial state; the next message starts with fresh deduplication state. Tool calls still start once with complete input; final usage is unchanged.reasoninggains an optionalmessageId, and readable reasoning from different native messages stays separate when coalesced. Docs explain the increase in small raw records and the consumer-side coalescing option.Validation: pure projection and coalescing regressions; Claude 2.1.293 native tests for early text/thinking, create/resume, exact completed content, slowly streamed tool arguments, and background child blocks arriving after the root result; all four behavior backends; full check and build. Real-account basic conversation and resume passed. Further real tool/subagent probes hit the account's weekly limit, so those are recorded as blocked, not successful. The native CLI with a scripted provider confirms background child output is complete blocks only (no child
stream_event), which is documented and tested separately.Closes #226.