Repository navigation
feat: app_request_cancelled, the ask's body on its part, appRequestText() - #266
Merged
Merged
Conversation
…xt() (#263) A request the runtime withdrew leaves pendingRequests on the runtime's word: claude control_cancel_request (observed on 2.1.292 when an interrupt cancels a pending elicitation), codex serverRequest/resolved. The exit empties pendingRequests. The app_request part now carries the native body, and appRequestText reads the words of the ask per runtime. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d it claude sends an MCP elicitation under skip permissions; through OAR codex never asks (approvalPolicy never), and directly driven app-server sends serverRequest/resolved after an interrupt and after a client answer alike. Co-Authored-By: Claude Opus 5.5 <[email protected]>
xxchan
force-pushed
the
cindy/app-request-cancelled
branch
from
October 9, 2026 07:25
e954e14 to
270bc8c
Compare
Merged
xxchan
added a commit
that referenced
this pull request
Oct 9, 2026
Release OAR and CLI 0.46.0. This PR changes only the two package version fields. **Added: `Session.contextBreakdown()`** (#264, closes #262) - What fills the context window, by the runtime's own categories, read on demand and never recorded: `{ tokens, contextWindow, categories: [{ name, tokens, kind, items? }] }`. `kind` is `used | deferred | reserved | free | unknown`; names stay the runtime's words. - claude only (`get_context_usage`, `detail: "full"`): System prompt, System tools, MCP tools, Memory files, Skills, Custom agents, Messages, Autocompact buffer, Free space, with memory files, skills, agents and MCP tools itemized. Every other session has no `contextBreakdown` member; show `contextUsage()` there. - Each read makes claude send the provider a batch of `count_tokens` requests (16 to 28 for a small setup), so read when the user asks, never poll. Null from the start of a dispose and after the exit. **Added: a request the runtime withdrew leaves `pendingRequests`** (#266, closes #263) - New event `app_request_cancelled { requestId }`, read off claude `control_cancel_request` (claude cancels a pending MCP elicitation when the turn is interrupted) and codex `serverRequest/resolved`. SessionView drops the request from `pendingRequests` and marks its `app_request` part `cancelled: true`. - `appRequestText(type, body)` beside `appRequestKind`: what a question asks, or the tool or command an approval is for, read off the native body; undefined where OAR does not know. **Behavior changes** - `RuntimeEventBody` has a new kind, `app_request_cancelled`: an exhaustive `switch` over event kinds needs a case for it. - The `app_request` view part now carries the native `body` (it was declared but never filled). - The root process exit now empties `pendingRequests`; the parts stay as they were. - `LineProcess.write` drops writes once `kill()` has ended stdin, and stdin gets an error listener, so a write racing a dying child (the abort fallback's kill) no longer crashes the host with `ERR_STREAM_WRITE_AFTER_END` or `EPIPE`. Validation: all 13 checks passed on #264's final head (`2fa106c`) and #266's final head (`270bc8c`); each merged tree equals its CI tree. Lookout inspected both against claude 2.1.292 and codex 0.160.1. After this PR passes CI and merges, tag its exact squash commit as `v0.46.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]>
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.
Closes #263.
What
app_request_cancelled {requestId}(newRuntimeEventBody): the runtime withdrew atoApprequest it had sent. Read off claudecontrol_cancel_requestand codexserverRequest/resolved(OAR answers no codex request, so a resolved one was cleared by codex). Never inferred from a turn ending.pendingRequestsand itsapp_requestpart getscancelled: true(answeredstays false). The root process exit emptiespendingRequests(whoever asked is gone); the part stays as it was. The part now carries the nativebody, whichViewPartdeclared but the fold never filled.appRequestText(type, body)besideappRequestKind(observe and root exports): the words of the ask. claudeelicitationrequest.message,can_use_toolrequest.tool_name; codexmcpServer/elicitation/requestmessage,item/tool/requestUserInputeveryquestions[].questionone per line,item/commandExecution/requestApprovalcommand; ACPelicitation/createmessage,session/request_permissiontoolCall.title. Undefined otherwise, never guessed.[runtime withdrew its request]), docs (record-stream, claude, codex, chat-ui).Evidence
control_requestelicitationwithmessage; an interrupt 1.5 s later was answered, then{"type":"control_cancel_request","request_id":<the elicitation's id>}, thenresult. One short turn on the existing login. The test fixture is those frames.app-server generate-json-schema:v2/ServerRequestResolvedNotification {threadId, requestId: string | int64}; mapped from the schema, not observed live (the codex page says so). Request ids are recorded as strings, so a numeric id is stringified to match.appRequestText: claude 2.1.292 binary (subtype:"elicitation",mcp_server_name,message,…,subtype:"can_use_tool",tool_name,…), codex schema files, ACP SDK 1.4.0 types.Tests
tests/app-request-cancelled.test.ts: the part carries the body andappRequestTextreads the live elicitation; the cancel emptiespendingRequestsand marks the part; the exit emptiespendingRequestswithout marking; codexserverRequest/resolvedwith a numeric id;appRequestTextper type, plus unknown type, empty list, blank text and no body.session-view.test.tsnow expects the body on the part.🤖 Generated with Claude Code