Skip to content

📯 feat: Apply Steers, Labels, and Pauses in the Chat Event Applier - #18195

Merged
danny-avila merged 2 commits into
devfrom
danny-avila/chat-side-frames
Nov 17, 2026
Merged

danny-avila merged 2 commits into
devfrom
danny-avila/chat-side-frames

Conversation

@danny-avila

Copy link
Copy Markdown
Collaborator

Summary

A Chat built with createEventApplier (#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 a Chat therefore 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 carries steer_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 ResponsePatcher calls (#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:

side frame arrives
  land()                     held tokens are written first: a placement replaces the streaming copy,
                             so placing ahead of them would lose them
  place(frame)               placeSteer | placeActivityLabel | placeReasoningLabel | placePendingAction
    settled                  done
    target not drawn yet     -> waiting

after an event is applied, or when the scheduled token write runs
  place again every waiting frame, oldest first

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. A created frame keeps what was waiting, like the steps held before it.

A resume snapshot is applied in the order handleSync uses: run steps, the response, pending OAuth prompts (through oauthPromptSteps), the pause the snapshot was taken under, then replayEvents and pendingEvents with 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. Chat reports every event through onEvent, which is where a host keeps that state.

Type of change

  • Feature
  • Tests / tooling / CI

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 before created; 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.
  • Each new behavior was checked by removing it and confirming a test fails: the write of held tokens before a placement, the retry of waiting frames, the drop at a snapshot, the skip of replayed OAuth events. Two things that no test could tell apart from their absence were removed rather than kept.
  • 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.

@danny-avila
danny-avila added this pull request to stack #18259 November 17, 2026 14:36
@danny-avila
danny-avila force-pushed the danny-avila/chat-side-frames branch 2 times, most recently from 2b5022f to 490a1fe Compare November 17, 2026 15:05
@lia-by-librechat lia-by-librechat Bot changed the title 🧷 feat: Place Steers, Labels and Pauses in the Chat Class's Event Applier 📯 feat: Apply Steers, Labels, and Pauses in the Chat Event Applier Nov 17, 2026
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T17:09:44.087707Z e316285 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 490a1fe1ee

ℹ️ 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".

@danny-avila
danny-avila force-pushed the danny-avila/chat-side-frames branch from 490a1fe to e634ed1 Compare November 17, 2026 15:33
@danny-avila
danny-avila force-pushed the danny-avila/chat-side-frames branch 2 times, most recently from 751f70a to baf81f5 Compare November 17, 2026 15:38
@danny-avila
danny-avila force-pushed the danny-avila/chat-side-frames branch from baf81f5 to 4d17f30 Compare November 17, 2026 15:42
@danny-avila
danny-avila force-pushed the danny-avila/chat-side-frames branch 2 times, most recently from 8a3b7d4 to 6c96c6b Compare November 17, 2026 15:54
@danny-avila
danny-avila force-pushed the danny-avila/chat-side-frames branch from 6c96c6b to 13bda61 Compare November 17, 2026 16:10
@danny-avila
danny-avila marked this pull request as ready for review November 17, 2026 16:11
@danny-avila
danny-avila force-pushed the danny-avila/chat-side-frames branch from 13bda61 to 5f5a00c Compare November 17, 2026 16:15
@danny-avila
danny-avila force-pushed the danny-avila/chat-side-frames branch 2 times, most recently from f680225 to f2315dd Compare November 17, 2026 16:48
Base automatically changed from danny-avila/stream-part-placement to dev November 17, 2026 17:03
@danny-avila
danny-avila force-pushed the danny-avila/chat-side-frames branch from f2315dd to 59d9c93 Compare November 17, 2026 17:03
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Head 59d9c93 (rebased onto dev after #18194 merged).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +274 to +275
context.write(next);
settle(syncStreamMessage(stream, placement.message));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Head e316285.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: e316285826

ℹ️ 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".

@danny-avila
danny-avila merged commit 0cc6696 into dev Nov 17, 2026
59 of 60 checks passed
@danny-avila
danny-avila deleted the danny-avila/chat-side-frames branch November 17, 2026 17:22
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.

1 participant