Repository navigation
view: steers enter where the runtime took them; text splits per message - #86
Merged
Merged
Conversation
…er message The session view put a steered input in `messages` when the steer request was recorded. Codex holds a steer until its current step ends, so the reply to an earlier steer rendered after inputs the agent had not read yet (#82). Separately, `text_delta` carried no message identity, so two assistant messages of one turn folded into one run-on text part. Where an input enters the view: - A prompt enters at its request and opens its turn, as before. - A steer or queue enters at its first `user_message` carrying its `inputId` and seals the open segment there. Until then it waits in the new `SessionView.pendingInputs` (request order), so a host can show it above the composer. - Whether a stream echoes is read off the stream: once it has carried a `user_message` with an `inputId` (codex and claude echo the first prompt), later steers wait for their echo. A stream that never has (grok, kimi; pi's echo has no inputId) keeps request placement. No capability flag or runtime name is involved. - A rejected input enters where it was refused; a `deliver` or `steerOrQueue` retry of it that must wait for its echo takes it back out and reopens the segment it had sealed. - An input never echoed stays pending after its turn ends; no position is invented for it. - Records already folded in a stream are now a no-op for the whole view, not only for the conversation fold (a re-folded prompt request used to open an empty turn). Text: `text_delta` gains an optional `messageId`, the runtime's id of the assistant message (codex: the agentMessage `itemId`; claude: the API `message.id`). The view starts a new text part when it changes, and `coalesceText` no longer merges across it. Without one (pi, ACP, older records) text concatenates as before. Text parts carry `messageId`. Tests replay a real codex run (prompt `sleep 100`, three steers) with every frame re-read through today's codex projection, plus unit cases for the no-echo fallback, an unread steer at turn end, a late echo in a later turn, the queue drain, refused-then-retried inputs, a resumed stream and double folding; codex and claude messageId adapter tests and a coalesceText case. Docs: chat-ui mapping, conversation spec, record-stream, codex and claude runtime pages. `pnpm run check` and `pnpm run build` pass; codex-aimock and claude-aimock sea-trial and vendor tests pass. Closes #82 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
xxchan
added a commit
that referenced
this pull request
Oct 3, 2026
Minor release (behaviour change in the session view): #86 by Ferryman. On a stream that echoes input ids (codex, claude), a steered or queued input enters `messages` where the runtime took it (its first matching `user_message`) and waits in the new `SessionView.pendingInputs` until then; streams that never echo keep the request position. `text_delta.messageId` (codex itemId, claude message id) splits two assistant messages of one turn into separate text parts; `coalesceText` no longer merges across them. `reduceSessionView` skips records its stream already folded. Closes #82. Version bump only. 🤖 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 #82.
Why
Two problems in the session view (
viewOf/reduceSessionView), both visible in a real codex run (promptsleep 100, then three steers while the agent waits):upsertInputappended the input and sealed the turn on thesteerrequest. Codex holds a steer until its current step ends, so the reply totest 1rendered aftertest 2andtest 3, which the agent hadn't read yet.text_deltacarried no message identity, so separateagentMessageitems in one turn became one run-on text part.Before (today's
viewOfon the recording):After:
(The
sleeptool parts come from #84, already on main.)Rules (as agreed with @cindy)
A steer enters the conversation where the agent read it.
steerorqueueinput entersmessagesonly at the firstuser_messagewhoseinputIdmatches it, and seals the open segment there. Until then it is not inmessages. It waits in the newSessionView.pendingInputs(ConversationInput[], request order), so a host can show it above the composer.user_messagewith aninputId(codex and claude echo the first prompt), later steers and queues wait for their echo. A stream that never has (grok, kimi; pi's echo has noinputId, so it can't match) keeps today's placement at the request. This is derived fromview.conversation: some input has an observation.deliver/steerOrQueueretry of the same input then has to wait for its echo (prompt refusedbusy→ steer, steer refused → queue), the input leavesmessagesagain. The segment it had sealed reopens, so the turn doesn't split at an input that is no longer there.pendingInputs. No position is invented for it. If its echo arrives later (a later turn, or a later stream after resume, since input identity crossesstreamIds), it enters there.reduceSessionViewInput(an app's own submission) still places the input immediately.Text splits per message.
text_deltagains optionalmessageId: codex = the agentMessageitemId(item/agentMessage/delta), claude = the assistantmessage.id. pi and ACP name none, so they are left as is.text_deltawhosemessageIddiffers from the last text part's starts a new part. Without amessageId(pi, ACP, older records) text concatenates as before. TextViewParts carrymessageId.coalesceText(Session.events({ coalesceText })) no longer merges across differentmessageIds.Also fixed on the way:
reduceSessionViewnow skips a record its stream has already folded, for the whole view. Before, only the conversation fold skipped it, so folding a log twice opened an extra empty turn from the duplicated prompt request.Public API
SessionView.pendingInputs: readonly ConversationInput[](new)text_delta.messageId?: stringonRuntimeEventBody/Event(new, optional)ViewParttext:messageId?: string(new, optional)Behaviour change for hosts on codex/claude: a steer or queue is no longer in
messagesuntil the runtime echoes it. A host that wants it visible meanwhile should renderpendingInputs.Tests
tests/replay/codex-steer-order.test.tsreplays the real codex recording (tests/replay/fixtures/codex-steer-order.records.jsonl, oar RawEvent records, scrubbed). Every frame is re-read through today's codex projection, somessageIdis exercised (frames whose native the scrub emptied keep their recorded events). It pins the order above,pendingInputs=[test 2, test 3]mid-run, re-read text = recorded text plus four distinct agentMessage ids, and double-folding idempotence. It also has a focused codexmessageIdadapter case.tests/session-view-inputs.test.tscovers an echoing stream, the no-echo fallback (including pi's unlinked echo), an unread steer at turn end and its late echo in a later turn, the queue drain, a refused steer retried as a queue, a prompt refusedbusyretried as a steer, a pending steer echoed in a resumed stream, and records folded twice.messageIdadapter test, a viewmessageIdsplit test, and acoalesceTextmessageIdtest.pnpm run check(typecheck, lint, 530 tests, mock sea-trial) andpnpm run buildpass.OAR_TEST=codex-aimock/claude-aimockpnpm sea-trialand their vendor tests pass.Docs
docs/design/chat-ui.md(surface, mapping rows for prompt/steer/queue request and response,user_message,text_delta, assistant-ui mapping),docs/spec/conversation.md(new section: where an input enters the session view),docs/spec/record-stream.md, and the codex and claude runtime pages.🤖 Generated with Claude Code