Repository navigation
📯 feat: Apply Steers, Labels, and Pauses in the Chat Event Applier - #18195
Conversation
2b5022f to
490a1fe
Compare
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
490a1fe to
e634ed1
Compare
751f70a to
baf81f5
Compare
baf81f5 to
4d17f30
Compare
8a3b7d4 to
6c96c6b
Compare
6c96c6b to
13bda61
Compare
13bda61 to
5f5a00c
Compare
f680225 to
f2315dd
Compare
f2315dd to
59d9c93
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59d9c9387c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| context.write(next); | ||
| settle(syncStreamMessage(stream, placement.message)); |
There was a problem hiding this comment.
Sync side-frame changes back to the submission placeholder
During regeneration, if a steer or activity label lands on the optimistic response before the first run step assigns its durable ID, this updates the list and streaming map but leaves submission.initialResponse unchanged. When that run step arrives, reduceStep seeds the durable response from submission.initialResponse for regenerate-shaped turns, discarding the already-settled side frame. Preserve the updated placeholder in the submission as well, as ResponsePatcher.syncSubmissionPlaceholder does; the new placeholder-renaming test only covers a fresh turn, which seeds from the list instead.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Valid. Fixed in e316285: when a side frame lands on the submission's placeholder, the updated placeholder is carried into the submission as well, as ResponsePatcher.syncSubmissionPlaceholder does, so a regenerate-shaped turn that seeds its reply from the submission keeps the frame through the first run step's rename. Every side frame goes through the one place function, so steers, activity and reasoning labels and pauses are all covered by it. Pinned by keeps a steer placed on the placeholder of a regeneration, which seeds from the submission, which fails against the previous code.
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
A
Chatbuilt withcreateEventApplier(#18190) applies a turn's deltas but not the frames a stream carries beside them: an injected steer, an activity label, a reasoning title, a pause for approval or a question, a pending MCP OAuth prompt. A reader following a conversation through aChattherefore sees tool groups without their labels, reasoning without its title, a paused run with no controls, and guidance sent to the run missing from the transcript. A background subagent's stream carriessteer_applied, so the child-thread pane this stack builds would lose every steer sent to the child.The applier now places all of them, with the functions main chat's
ResponsePatchercalls (#18194). For the same frames, the two paths write the same parts to the same indexes.Seventh in a stack, on #18194.
How it works
The patcher and the applier share where a frame lands and differ only in when they try again. The hooks session writes messages asynchronously, so the patcher retries on later animation frames. The applier applies every event in order, so the list can only change when an event (or a scheduled token write) is applied, and that is when a waiting frame is placed again:
A waiting frame never forces a write. While tokens are held for the next animation frame, waiting frames are placed when that write runs, so a title waiting on a reasoning part that has not started costs nothing per token.
What ends a wait: the frame settles; a resume snapshot arrives (its content already holds every applied steer and label, so what was waiting is dropped); the turn's final frame;
reset. Acreatedframe keeps what was waiting, like the steps held before it.A resume snapshot is applied in the order
handleSyncuses: run steps, the response, pending OAuth prompts (throughoauthPromptSteps), the pause the snapshot was taken under, thenreplayEventsandpendingEventswith their steps and side frames interleaved as the server recorded them. A replayed OAuth step event for a step that has a pending prompt is skipped, because the prompt holds the live sign-in link and the replayed event may hold one that was since replaced.Not applied here, by design: usage, titles, attachments and the composer's steer chips are state beside the message list.
Chatreports every event throughonEvent, which is where a host keeps that state.Type of change
Testing
Tested environments/configuration:
Unit level, against the real step reducer and the real placement functions.
Automated tests:
packages/chat/src/core/__tests__/apply.spec.ts, 15 new cases: a steer between the parts that stream around it; a replayed steer written once; a steer injected before the first run step surviving the rename of the reply; a steer held beforecreated; a waiting frame dropped by a snapshot; an activity label beside the tools it heads; a reasoning title that arrives before its reasoning part; a pause on its tool call and on a sibling call drawn later; the pause a snapshot was taken under; a pending OAuth prompt drawn once with its link; the live link kept over a replayed one; side frames replayed in order with a snapshot's steps; a waiting frame forgotten at the end of the turn; held tokens landing before a placement; no per-token write while a frame waits.packages/chat:npx jest src/core src/react/__tests__/follow.spec.tsx src/components/pane(75 suites, 1771 tests);npx tsc --noEmit;npm run static-checks -- --against origin/dev.Screenshots / recordings
No user-facing change: nothing in the app constructs the applier yet.
Risk / compatibility
Additive to the applier, which has no caller in the app. Main chat's path is not touched by this PR.