Repository navigation
refactor(chat-core): route scene popover and feedback sends through sendTurn; drop api.steerChat - #9593
Conversation
50fe774 to
6360361
Compare
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 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: |
UX Review (Fable 5) — 🟡 CONCERNSUX-level review of I have everything I need. The diff is a transport refactor, but it introduces two visible states in the scene-popover composer (an ErrorNotice-styled failure line and a new amber "delivery not confirmed" line) with no committed screenshots, so the blind read could not run. The strings themselves are sound — the unconfirmed copy asserts what happened and offers an action, and the code genuinely doesn't hold the delivery state at that point, so no block predicate applies. One real risk: the feature-request path treats UX-Verdict: CONCERNS Sound send-failure UX, but the new unconfirmed-delivery state and restyled failure line shipped unseen — no screenshot, so the blind read never ran. Watch
Evidence gaps
[UX-REVIEWED] e043fa9 |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Consolidation onto one receipt contract fixes two real steer receipt defects, keeps per-surface reactions as call-site policy, and deletes the last bespoke sender cleanly. The design holds up under scrutiny: the divergent Suggestions
[DESIGN-REVIEWED] e043fa9 |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of All claims verified: First-Principles-Verdict: PASS
What this change shipsInventory (9 items) — 9 justifiedIntent: finish RFC chat-core P2 batch C — the last two hand-rolled dashboard senders move onto the one transport and the bespoke steer helper is deleted. FIX (consolidation tracked by a documented RFC row).
[FIRST-PRINCIPLES-REVIEWED] e043fa9 |
1589f00 to
4bfff54
Compare
Opus 4.8 Review — ✅ no blocking findingsReviewed Review detailsNo findings. The candidate's rendered value is the static [OPUS-REVIEWED] e043fa9 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
26ac70a to
7220e23
Compare
|
4bfff54 to
0bcd395
Compare
7220e23 to
28c1503
Compare
|
self-added: yes
|
|
self-added: yes
|
0bcd395 to
b904346
Compare
28c1503 to
603c231
Compare
|
self-added: yes
|
b904346 to
40dbfc7
Compare
603c231 to
0fb2127
Compare
|
e81ee16 to
caf1b18
Compare
caf1b18 to
c6e545b
Compare
|
|
|
c6e545b to
a08422c
Compare
…gh sendTurn; drop api.steerChat Chat-core RFC P2, batch C of #9570. The last two hand-rolled dashboard senders call the transport's `sendTurn` and branch on its receipt, so the deadline and the six-way classification are the core's: - `hooks/useSceneInteraction.tsx` (scene agent popover composer): the running/idle fork -- `api.steerChat` mid-turn, `api.sendChat` plus a local `readSendReceipt` otherwise -- becomes ONE call, `sendTurn({ message, slot, steer: !!src?.running })`; `steer` is a flag of the same endpoint (#8689), not a different receipt shape. refused -> report on the composer, hand the payload back transport-error -> report on the composer, hand the payload back unknown -> composer back to idle, nothing claimed (as before) response-late -> report on the composer with the core's delivery-unconfirmed copy, hand the payload back (NEW: the old path awaited without bound; nothing proves the gateway saw the request, so silence would discard the text -- same policy as ChatPage) dispatched/queued -> 'sent' tick + mini-thread echo, as before A refused steer used to surface through the outer catch (steerChat parsed via `j` and threw on a non-2xx); it is now a `refused` receipt with the same user-visible result, and a `{ok:false}` steer inside a 200 -- which `j` passed through silently -- is now reported too. - `App.tsx` feature-request send: `refused` -> error row with the server's reason; `transport-error` -> error row; `unknown` and `response-late` stay silent (the request was or may have been accepted; the row is the pill's only signal). - The composer's failed-send line migrates from a hand-written `role="status"` div to `ErrorNotice variant="inline"` (same string), `askAgent` off with a No hand-off comment naming the restored draft (errors-use-error-notice: this diff touches its condition). - `api.steerChat` had no remaining caller and is deleted; `sendChat`'s comment now describes the steer flag it carries for the transport, and `sendChat` runs `checkSessionExpired` on its raw response so a 403 auth challenge on any transport send keeps the silent-refresh / banner recovery the `j`-parsed steer helper had. Tests: the scene coverage file mocks the transport's wire (`api.sendChat`) so the REAL classifier runs; it asserts `steer` is forwarded from the running state, adds a refused-steer case and a deadline (`response-late`) case. The feature-request test pins that the send rides the transport (deadline signal on the wire). Dead `steerChat` stubs removed from four test files. RFC 4.2 row split into the three #9570 batches. Refs #9570
a08422c to
e043fa9
Compare
|
self-added: yes
|
|
|
|
bolichen97
left a comment
There was a problem hiding this comment.
I traced the thing a refactor like this most easily breaks — whether steering an in-flight turn still steers rather than queueing a new turn — and it holds. Old api.steerChat(msg, slot) POSTed /api/chat?ws=1 with {message, slot, steer:true}; the new path is sendTurn({message, slot, steer: !!src?.running}) → api.sendChat(..., true) → the identical body on the identical URL (client.ts:3214). The steer-vs-queue decision was always server-side on that flag, with no client branch carrying it, so there is no queueing regression. api.steerChat also has zero live references left at the head — the only hits are RFC prose and one explanatory test comment.
Dropping App.tsx's try/catch is sound too, since sendTurn catches around both api.sendChat and readSendReceipt and returns a receipt on every path. Optimistic UI on the scene path is unchanged: draft cleared at send start, mini-thread echo still only on dispatched/queued, sameComposer() guards intact.
One real defect, and it is the second half of a finding you already answered:
App.tsx:2969 — on response-late the feature-request path returns silently, leaving the optimistic user bubble on screen next to a slot still marked slotRunning: true. Before SEND_ABORT_MS existed, a send refused at 12s still resolved and cleared the flag; now the code stops watching at 10s. The UX lane raised this twice and you rebutted on the grounds that no existing catalog string fits — that argument covers the copy half, but clearing setSlotRunning(false) needs no new string, and that is the half still undone. Impact is bounded: your own comment at App.tsx:2920 notes a stale flag self-heals from the server snapshot on the next switch-back, so it is a transient stuck spinner rather than a permanent one.
Both new behaviours are real improvements worth naming, since they are what a reviewer might otherwise read as scope creep: a refused steer and an {ok:false} inside a 200 are now reported on the composer, where the first previously surfaced only through the outer catch and the second passed silently as success.
Not approving from here — the open call is yours, not mine: you escalated "pod screenshot vs <!-- no-visual-delta --> waiver" across four heads, and this diff does change what the scene popover renders (a new amber "delivery not confirmed" line, the failed-send line moved to ErrorNotice variant="inline", and the red Retry treatment now gated behind sendFailedHard). All five lanes are SUCCESS on e043fa91e with every non-PASS item dispositioned on that head, and there are no unresolved threads.
Summary
Chat-core RFC P2, batch C of #9570 — the last two hand-rolled dashboard senders move onto the chat-core transport
sendTurn, andapi.steerChatis deleted (no caller left).Stacked on #9576 (base
refactor/chat-core-p2-app-seeds) so the two batches do not collide on the RFC §4.2 table; GitHub retargets this PR tomainwhen #9576 merges.hooks/useSceneInteraction.tsx(scene agent popover composer)The running/idle fork —
api.steerChatmid-turn,api.sendChat+ a localreadSendReceiptotherwise — becomes one call:sendTurn({ message, slot, steer: !!src?.running }).steeris a flag of the same endpoint (#8689), not a different receipt shape.receipt.statusdispatched/queuedsenttick, mini-thread echo (as before)refusedfailed+ retry, payload appended back (as before)transport-errorrefused(as before, via the outercatch)unknownidle, nothing claimed, payload not restored (as before)response-latepages.chatPage.delivery_unconfirmedcopy shown unwrapped as a warn status line (lucideAlertTriangleglyph, the popover's own dark-safe#fb0— the popover is fixed dark chrome in every theme, so theme tokens are not legible there) and the Send button kept neutral (no red Retry — the copy says to check the transcript first) — not anErrorNotice, because an unconfirmed delivery is a warning, not an error (errors-use-error-noticesays warnings must not be dressed as errors; ChatPage draws the same distinction with itsTwo things change on the steer branch and both are receipt-defect fixes the RFC names: a refused steer used to surface only through the outer
catch(steerChatparsed viaj, which throws on a non-2xx) — now it is arefusedreceipt with the same on-screen result; and a{ok:false}steer inside a 200, whichjpassed through silently as success, is now reported on the composer.App.tsxfeature-request sendrefused→ error row with the server's reason;transport-error→ error row;unknown/response-late→ silent (the request was or may have been accepted; the row is the pill's only signal and claiming a failure it cannot prove tells the user to resend a request that already went out).Failed-send line →
ErrorNoticeThe composer's failure line (
Send failed: <reason>under the Retry button) was a hand-writtenrole="status"div. This PR touches its condition (response-latenow feeds it), so pererrors-use-error-noticeit migrates toErrorNotice variant="inline"with the same string;askAgentstays off with aNo hand-offcomment naming the restored draft the composer holds (GPT, round 2).api/client.tssteerChatdeleted;sendChat's comment now describes thesteerflag it carries as the transport's wire.sendChatstill hands the raw response back (the transport reads the receipt; a 4xx must resolve) but now runs the same auth recovery everyj-parsed call has —sendResponseAuthRecovery: the pre-body 403X-Auth-Requiredhook (silent refresh / banner), the body-borne 401 stale-owner code, read off a clone so the receipt stays readable, and the 2xx banner-clear so a send that succeeds after auth was restored elsewhere dismisses a stale banner. The deletedsteerChatwent throughjand had both; this keeps them for the steer path and extends them to everysendTurncaller on the dashboard wire (GPT r1, r3).Tests
UseSceneInteractionCoverage.test.tsxmocks the transport's wire (api.sendChat), so the realsendTurnclassifier runs. Assertssteeris forwardedtruefrom a running agent andfalseidle; adds a refused-steer case and a deadline (response-late) case driven by the transport's abort signal under fake timers, asserting the text comes back with a retry. Every existing assertion's intent is kept.ApiClient.coverage.test.tsx:sendChaton a 403X-Auth-Requiredresolves with the raw response and triggers the silent refresh; on a 401 stale-session body it raises the stale-owner prompt whilejson()still reads. A 2xx clears an already-shown session-expired banner.App.featureRequestFailure.test.tsx(and the existingApp.test.tsxfeature-request assertion now matchessendTurn's six-argument wire call): header updated; the accepted case now also pins that the wire is handed the deadline signal.steerChatstubs removed fromApiClient.coverage.test.tsx(itssteerChatitdeleted),ChatPage.steerQueuedReceipt.test.tsx,ChatPage.steerWithSubagents.test.tsx,SideSlashCommand.steer.test.tsx.Tested
npx tsc --noEmit -p .— clean (before and after the rebase onto refactor(chat-core): route issue-radar and auto-improvement seeds through sendTurn #9576).npx eslinton the nine changed source/test files — clean.node scripts/check-i18n-strings.mjsandnpm run i18n:check— clean (no new literals).Why no screenshot: no layout change; the styling deltas are the scene composer's failed-send line moving from a hand-written 10px red div to the shared
ErrorNoticeinline variant at its stock size (icon, same string, same position under the Retry button; colour pinned to the popover's dark-safe#f88because the chrome is dark in every theme), and the new unconfirmed state, atext-warnstatus line with a lucide warn glyph in the same slot (Send button stays neutral). The other deltas are existing states appearing where they were silent (failed/retry on a refused steer or a late receipt).Refs #9570 (batches A #9576 and B #9587 carry the other senders).
Closes #9570