Repository navigation
fix(chat): hide stale option chips once the running turn moves on - #24766
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the scan stops showing chips once a row is newer than the offer, the argument is optional so the three sibling surfaces are untouched, and the four attached screenshots show before and after. Notes
[DESIGN-REVIEWED] a0bad52 Description read[DESCRIPTION-READ] 3d4ccf2b78f914b091dde5eb9154bc77ece27904a793f2974f9b74f6c9badbeb That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The fix works at the mechanism level and comes with a reproduction. One note: the hide rule is exposed on the public app-sdk export, and only one caller uses it. Notes
What this change shipsInventory (5 items) — 4 justifiedIntent: a FIX. In the main chat, chips from an earlier segment stop offering an answer to a question the agent has already moved past.
[FIRST-PRINCIPLES-REVIEWED] a0bad52 Description read[DESCRIPTION-READ] 1747c8b935fda75a94af00e76c5f6fe39c29ca78e6245f4324df801615877dff That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks: the change only hides existing chips in one more state, and the blind reader read shot-04 correctly ("the quick replies went away, maybe because the assistant moved on"). Notes
[UX-REVIEWED] a0bad52 Description read[DESCRIPTION-READ] daf6f585b4ff81586fe4d02a122b462d92ed223d15af7617e7a44c8465ac4cb5 That sha256 names everything this verdict read: the PR description, plus the 7 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
bolichen97
left a comment
There was a problem hiding this comment.
Thanks for the clear write-up and the before/after captures. The approach (hide the chips only once a tool or thinking row follows the offering row, and only while the turn runs) is the right scope: it fixes the stale chips and keeps the mid-turn steering that the busy-send tests pin. The optional fourth argument defaults to false, so ChatPane, SideChat and the embed keep their current behaviour.
One blocker on this head:
- Frontend Tests (1) is red because of this diff.
src/test/reasoningBurst.contract.test.tsx("no display-layer file re-spells the reasoning-role predicate") scansapp-sdk/and rejects the newm.role === 'thinking'inoptions.ts. Use the sharedisReasoningRolehelper instead (inline comment below). Frontend Coverage Merge fails only because that shard failed.
Not caused by this PR: Integration (in-process gateway) fails on test_route_sweep with /api/publish-providers -> 500, a backend route this frontend-only change does not touch.
Verified at 094c4d0: read the full diff and the scan loop in options.ts; tool and thinking rows previously matched no branch, so skipping them with continue keeps the old scan when turnRunning is false; read the failing job logs for both red jobs.
| let movedOn = false | ||
| for (let i = messages.length - 1; i >= 0; i--) { | ||
| const m = messages[i] | ||
| if (m.role === 'tool' || m.role === 'thinking') { if (turnRunning) movedOn = true; continue } |
There was a problem hiding this comment.
The new role check fails the reasoning-role structural pin, so Frontend Tests (1) is red.
reasoningBurst.contract.test.tsx walks app-sdk/ and fails on any role === 'thinking' spelling, so the reasoning role keeps one definition (REASONING_ROLES in pages/chat/groupDisplayItems). This line re-spells it, and CI reports: "options.ts re-spells the reasoning predicate, use isReasoningRole/hasReasoningContent/REASONING_ROLES from groupDisplayItems".
if (m.role === 'tool' || m.role === 'thinking') { if (turnRunning) movedOn = true; continue }Suggestion (the same import app-sdk/messageRenderers.tsx already uses):
import { isReasoningRole } from '../../pages/chat/groupDisplayItems'
// ...
if (m.role === 'tool' || isReasoningRole(m)) { if (turnRunning) movedOn = true; continue }Rule: reuse the shared reasoning-role predicate; the structural pin forbids re-spelling it.
There was a problem hiding this comment.
Fixed in 79facdc. app-sdk/protocol no longer spells the role: deriveFollowUpOptions takes an optional movedOnRow predicate, and followUpChips.ts passes isTurnActivityRow, built on the shared isReasoningRole, only while the turn runs. The predicate stays out of the protocol module because that module may not import from pages/ (chatProtocolBoundary.test.ts).
The one red left, Backend Tests (Windows) (2), is the strict xfail now red on main too (#24765, fix in #24774). I'll rebase once that lands.
094c4d0 to
79facdc
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround. The blocker from my earlier review is fixed at 79facdc: deriveFollowUpOptions now takes an optional movedOnRow predicate, and the main chat passes isTurnActivityRow, which uses the shared isReasoningRole helper, only while its turn runs. Nothing in app-sdk/ spells the reasoning role any more, and all four Frontend Tests shards pass on this head, including the reasoning-role structural pin.
Verified at 79facdc: read the range diff against the previous head; with no predicate the scan behaves as on main, so the pane, side chat and embed are unchanged; groupDisplayItems does not import back from followUpChips, so there is no cycle; the only useFollowUpChips caller (ChatPage) passes turnRunning.
The code looks good to ship. I am holding the approval only for CI: Backend Tests (Windows) (2) failed on test/test_crew_log_fullscan_guard.py::test_a_warm_session_read_that_earns_a_savepoint_reads_only_the_gap (a strict xfail that passed), a backend crew log test this frontend change does not touch, and several backend shards plus PR Readiness are still pending. Once that shard is rerun green and readiness passes, I will approve.
|
The main chat gated its option chips on the newest row being 'streaming'. After a segment finalized into an assistant row, the tool and thinking rows that followed opened that gate, so chips from the earlier segment stayed up for a question the agent had already moved past. deriveFollowUpOptions takes an optional movedOnRow predicate: a matching row newer than the offering row hides its chips. The main chat passes isTurnActivityRow (a tool row or a reasoning row, via the shared isReasoningRole) only while its turn runs. While the offering row is still the newest row the chips stay, so a pick can still be steered into the turn (#17291). The pane and embed already hide chips for the whole busy turn and pass nothing. Fixes #15926
79facdc to
a0bad52
Compare
|
@bolichen97 head |
bolichen97
left a comment
There was a problem hiding this comment.
Approving at head a0bad52. This replaces my earlier request for changes.
What changed since that review: deriveFollowUpOptions no longer takes a turnRunning boolean that spelled the reasoning role inside app-sdk/. It now takes an optional movedOnRow predicate, and the main chat passes isTurnActivityRow, built on the shared isReasoningRole helper, only while its turn runs. Nothing in app-sdk/ spells the reasoning role any more, so the structural pin is satisfied. This head is a rebase of 79facdc onto newer main with an identical patch per git range-diff.
What I verified:
- Read the range diff against the head I reviewed before. With no predicate the scan behaves as on main, so the pane, side chat and embed are unchanged.
groupDisplayItemsdoes not import back fromfollowUpChips, so there is no import cycle.- The only
useFollowUpChipscaller passesturnRunning. - Gates: readiness passed on this head, all required checks green, no AI lane BLOCK, no merge conflict, no other review requesting changes.
Problem / Motivation
Goal: In the main chat, option chips from an earlier segment disappear once the running turn has moved on to tool work.
The agent writes a segment that ends in
[OPTIONS: ...]and keeps working in the same turn (most often after a steered message). The chips from that segment stay under the composer while tool calls and "Thinking..." run below it. They answer a question the agent has already moved past.Why it matters
Clicking a stale chip queues or steers a duplicate instruction. In the reported case the chip asked the user to confirm a step that the steered message had already confirmed. The split-view pane does not show these chips, so the two surfaces disagree on the same transcript.
Not a goal
Intended? / Repro
Intended? No.
ChatPage.tsx:597on main gates the chips onlastMsg?.role === 'streaming'only. Thetool/thinkingrows that follow a finalized segment close that gate, andderiveFollowUpOptions(website/src/app-sdk/protocol/options.ts) skips those rows, so the earlier segment's options come back. Nothing in the code, the docs or #17291 asks for chips to survive the agent moving on; #17291 only needs them while the offering row is the newest row.Repro on main
6c3c0f105: the real built SPA with fixture APIs and a Playwright-driven websocket (website/scripts/capture-15926-chips-mid-turn.mjs). A segment streams... [OPTIONS: Done, check now | Wait], achat_segmentfinalizes it, then atool_calland itstoolrow arrive while the slot stays running. On main both chips stay up under the tool row and "Thinking..." (before screenshot 02 below). The issue's reducer-driven repro gives the same result.What changed (motivation → approach → change)
toolorthinkingrow follows the offering row) over A (hide for the whole running turn): B fixes the report and keeps fix(chat): option chip sends honor the busy-send mode #17291's mid-turn chip steering and its pinned tests intact.deriveFollowUpOptionstakes an optional 4th argument, amovedOnRowpredicate. A matching row newer than the offering row hides that row's chips. Without it the scan is unchanged. It is a predicate, not a flag, becauseapp-sdk/protocolimports no rendering layer and so cannot import the sharedisReasoningRole.useFollowUpChips(pages/chat/page/followUpChips.ts) takesturnRunningand, only while it is true, passesisTurnActivityRow: atoolrow, or a reasoning row by the sharedisReasoningRole.ChatPage.tsxpassesturnRunning: !!slotRunning. When the turn ends the chips come back from whatever the newest offer is.Backwards compatibility
Compatible: the new argument is optional and unset by default, so
ChatPane,SideChat,ChatEmbedand app-kit callers keep today's behaviour.Removes nothing: no key, function, record or accepted input is taken away; one surface hides chips in one more state.
Tests
website/src/test/followUpChips.midTurn.test.ts(new):chatSlicereducer and the realuseFollowUpChipshook: chips hide oncetoolandthinkingrows follow the segment while the turn runs;deriveFollowUpOptions: a tool row, a thinking row, nomovedOnRow(old scan), and a newer offer after tool rows.website/src/test/ChatPage.followUpBusySend.test.tsxis unchanged and should stay green: its rows have no tool or thinking row after the offer.Proof: not provable -- frontend test (prove.py runs Python only)
Tests run in CI only. Locally:
tsc -p tsconfig.app.json(plus the new test file),eslinton the changed files andlint:i18nare clean.Manual verification
Done with the capture harness above against dists built from main and from this branch. Still useful for a reviewer: in a live session, steer a message into a turn that just offered chips and confirm they leave once the agent starts a tool call.
Screenshots / video
Before (main): the segment just finalized, chips shown.
Before (main): a tool row follows, the stale chips stay.
After (this PR): the segment just finalized, chips still shown so a pick can be steered in.
After (this PR): a tool row follows, the chips are gone.
Related Issues
Fixes #15926
Refs #17291: the mid-turn chip steering this keeps.
Sibling sweep
Swept:
git grep -n "deriveFollowUpOptions(" -- website/srcSibling: website/src/components/ChatPane.tsx:394 -- not affected -- gates on selectComposerBusy, so no chips during any busy turn
Sibling: website/src/app-sdk/ChatEmbed.tsx:579 -- not affected -- gates on the embed's running flag for the whole turn
Sibling: website/src/pages/chat/SideChat.tsx:238 -- not affected -- gates on the side chat's whole-stream flag, not the newest row
Sibling: website/src/pages/chat/page/followUpChips.ts:45 -- changed here
Pattern harvest
Not generalizable: the defect is one surface using "newest row is streaming" as its turn-running signal; the other three surfaces already use a real running flag.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement