Skip to content

feat: app_request_cancelled, the ask's body on its part, appRequestText() - #266

Merged
xxchan merged 2 commits into
mainfrom
cindy/app-request-cancelled
Oct 9, 2026
Merged

xxchan merged 2 commits into
mainfrom
cindy/app-request-cancelled

Conversation

@xxchan

@xxchan xxchan commented Oct 9, 2026

Copy link
Copy Markdown
Member

Closes #263.

What

  • app_request_cancelled {requestId} (new RuntimeEventBody): the runtime withdrew a toApp request it had sent. Read off claude control_cancel_request and codex serverRequest/resolved (OAR answers no codex request, so a resolved one was cleared by codex). Never inferred from a turn ending.
  • SessionView: the request leaves pendingRequests and its app_request part gets cancelled: true (answered stays false). The root process exit empties pendingRequests (whoever asked is gone); the part stays as it was. The part now carries the native body, which ViewPart declared but the fold never filled.
  • appRequestText(type, body) beside appRequestKind (observe and root exports): the words of the ask. claude elicitation request.message, can_use_tool request.tool_name; codex mcpServer/elicitation/request message, item/tool/requestUserInput every questions[].question one per line, item/commandExecution/requestApproval command; ACP elicitation/create message, session/request_permission toolCall.title. Undefined otherwise, never guessed.
  • status fold, CLI progress ([runtime withdrew its request]), docs (record-stream, claude, codex, chat-ui).

Evidence

  • claude 2.1.292 on xxwork, a stdio MCP server whose tool elicits: claude sent control_request elicitation with message; an interrupt 1.5 s later was answered, then {"type":"control_cancel_request","request_id":<the elicitation's id>}, then result. One short turn on the existing login. The test fixture is those frames.
  • codex 0.160.1 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.
  • Field sources for 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 and appRequestText reads the live elicitation; the cancel empties pendingRequests and marks the part; the exit empties pendingRequests without marking; codex serverRequest/resolved with a numeric id; appRequestText per type, plus unknown type, empty list, blank text and no body. session-view.test.ts now expects the body on the part.

🤖 Generated with Claude Code

exe.dev user and others added 2 commits October 9, 2026 07:23
…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
xxchan force-pushed the cindy/app-request-cancelled branch from e954e14 to 270bc8c Compare October 9, 2026 07:25
@xxchan
xxchan merged commit e64bb02 into main Oct 9, 2026
13 checks passed
@xxchan
xxchan deleted the cindy/app-request-cancelled branch October 9, 2026 10:31
@xxchan xxchan mentioned this pull request Oct 9, 2026
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]>
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.

observe: what an unanswered question asks, on its part, and pending requests whose turn ended

1 participant