Skip to content

feat(chat-core): route ChatEmbed, SideChat and the remaining app send paths through the transport wire - #8599

Closed
CrysisDeu wants to merge 1 commit into
mainfrom
feat/chat-core-p2-embed
Closed

CrysisDeu wants to merge 1 commit into
mainfrom
feat/chat-core-p2-embed

Conversation

@CrysisDeu

@CrysisDeu CrysisDeu commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #8853 (gateway: preserve the client sendId through the slot queue drain) — merged 2026-09-06 (16ec93bef); this branch is rebased on top of it. The delivery proof below matches a polled user row by identity only; #8853 is what makes a queued send's drained row carry that identity.

Problem / Motivation

ChatEmbed (the app-sdk's embeddable chat) was the third of four hand-written send paths. It posted to the bare /api/chat, which answers with an SSE stream; the scoped AppApi JSON helper buffered that stream and threw SyntaxError, and the embed's .catch called that success. A refused POST (409 slot-agent mismatch, 403 from an app that never granted /api/chat) rejected the mutation, but nothing read sendMutation.isError. Either way the composer had already been cleared, so a failed send looked sent and the text was gone.

Why it matters

The chat-core extraction RFC (P0 contract inventory) named this the worst of the four paths: it is the one that can lose a user's turn with no trace. It is also the one surface that cannot import the dashboard client, because an app's sends must stay a permission the host app grants (allowedApiPaths).

What changed (motivation → approach → change)

Transport (website/src/chat-core/transport/sendTurn.ts). sendTurn was hard-wired to the dashboard client's api.sendChat. It gains an injectable wire — the fetch seam: one POST that resolves on every HTTP status and rejects only when the request never left or the deadline signal fired. dashboardSendWire is the default, so ChatPane (#5909) is unchanged. Receipt classification (readSendReceipt, the abort deadline, the six statuses) stays in the one place.

App-sdk wire (website/src/app-sdk/appSendWire.ts, new). Re-expresses the scoped AppApi.post outcomes in the seam's shape: 2xx JSON → resolved ok; 2xx non-JSON (SyntaxError) → resolved ok whose json() rejects, i.e. unknown — the exact shape the old path swallowed; non-2xx → resolved !ok carrying the body text so the server's reason survives; a scoped-api permission denial → resolved !ok whose body carries a human sentence ("This app isn't allowed to send chat messages.", new key appSdk.chatEmbed.app_not_allowed_to_send, 12 locales + en-XA) as the refused reason — "check your connection" would be advice that can never succeed, and the raw app/path/grant detail is developer vocabulary, so it goes to the console instead — via a typed AppApiPermissionError thrown by the permission check; offline / fetch rejected → response-late, deliberately not transport-error — the scoped helper cannot tell a request that never left from one whose response was lost (a raw network rejection covers both), and the dashboard wire's transport-error invites a retry-safe resend that would run a turn twice if the POST did land; appSendWire.contract.test.ts pins this per-wire divergence ("classifies a rejected fetch as response-late, never the retry-safe transport-error"); deadline → AbortError → response-late (the scoped helper takes no signal, so the deadline is honoured at the receipt). The AbortError-as-indeterminate idiom is now part of the SendWire contract doc and spelled once as indeterminate() in chat-core/transport, which both the app-sdk wire and the side wire reject with. The POST targets /api/chat?ws=1; the scoped path check reads only the pathname, so no new permission is required from apps.

To read status and body back without parsing the API <status>: <text> message string, createScopedApi now throws the dashboard's own typed ApiError (website/src/api/apiError.ts, already imported by the app-sdk for AcceptedBodyUnreadable) with that same message and the body in .body -- one spelling for "scoped non-2xx" rather than a second class. Nothing new is re-exported from the barrel (the vendor stub mirrors the barrel value-for-value, so that would be an SDK surface change); apps keep seeing the same Error with the same message. AppApiPermissionError stays app-sdk-local: it is the one error only the scoped helper can raise.

ChatEmbed (website/src/app-sdk/ChatEmbed.tsx). Sends through sendTurn with the app-sdk wire (the agent the embed was mounted with rides on the wire, not the transport contract). Receipt policy: refused → an error row at the transcript tail (the existing registry renderer, no new component; there is no transport-error clause — the app-sdk wire never yields it, a raw rejection being indeterminate → response-late) — the server's reason framed — a composer submit through pages.chatPage.send_failed_with_error_restored ("Couldn't send this message: . Your text is back in the composer.", the reason's own sentence end folded into the template) and a chip send, which consumed no draft, through pages.chatPage.send_failed_with_error ("Send failed: ") — so a raw "slot agent mismatch" does not read as the agent erroring mid-work; a reason-less transport failure states its cause ("Couldn't send — check your connection and try again.", shared core key pages.chatPage.send_failed_connection) instead of a bare "Send failed" — and the text handed back via mergeRecoveredDraft as typed (the composer's draft, whitespace and all — the wire carries the trimmed text, the recovery gives back what the user wrote; the shared rule's paragraph-break join is flattened to one space before it reaches the field, because this composer is a single-line <input> and a browser silently drops newlines assigned to an input's value); response-late → the text handed back under a notice row ("Delivery not confirmed — …", retired only when the poll shows this message's own user row — identified by identity only: the client-minted meta.sendId the embed stamps on every send (mintSendId, now owned once by chat-core/transport — ChatPage's and ChatPane's identical inline minters are replaced by the shared one in this PR), read back off the polled slot detail either as the row's meta.sendId or as a member of a merged row's meta.sendIds. The server keeps that id on every path a send can take — a dispatched send persists it on its row directly, and a send queued behind a busy slot carries it on the queue entry so the drain writes it onto the row (#8853, which this PR depends on) — so there is no text-matching fallback: an id-less row with the same words is some other writer's (an older backend, an injection, a resend) and is never proof (isOwnUserRow) — and when the proof arrives the restored text is taken back out of the composer, unless the user has edited it since. (The record once also carried the transcript length at send time as a positional gate; nothing read it — retirement has always been by id alone — so the field is gone.) Unrelated growth (a prior turn still streaming, a cron/sub-agent injection, a same-text row with another id, an older backend that drops meta) is not proof and leaves both notice and text alone, so a late turn that did land never sits above a standing "not confirmed" with a resendable copy below it, and an undelivered one is never silently withdrawn; new i18n keys appSdk.chatEmbed.delivery_unconfirmed / delivery_unconfirmed_option in all 12 locales + en-XA) — this embed keeps no optimistic bubble, so once the composer cleared the user's text had no visible copy left, which is the one indeterminate outcome the transport contract names as recoverable (ChatPane leaves it alone only because its bubble is still on screen); unknown → nothing (a 2xx was received, restoring could duplicate a running turn); dispatched / queued → the poll renders it. An option chip's direct send never restores into the composer (it did not consume the draft — the same gate ChatPane/ChatPage keep). A host-supplied onSend rejection proves nothing about delivery (a host may have posted and lost the answer), so it is treated as unconfirmed — notice + text handed back — never as a failure that invites a duplicate-turn retry. On a follow-up-chip send the unconfirmed notice uses its own copy (delivery_unconfirmed_option: "…re-pick the option if it is missing") because the draft-clobber gate means nothing was restored. The send-tail row is folded into the top-anchored embed's new-message scroll hash, so a failure/unconfirmed row is announced rather than appended below the fold, and mirrored into a polite role="status" live region so a screen-reader user hears the outcome instead of only noticing the button re-enable. Polling, approvals, follow-up chips and the composer itself are untouched. Unmount-safe recovery (round 2 on the combined diff, GPT F1): a receipt is asynchronous, and a host can unmount the embed mid-send (switch specs, open a new one, close a drawer) or re-prop it to another slot; writing the failure/unconfirmed row and the handed-back text into the dead instance would lose the only copy of a refused send — the server never took it, so no poll will ever show it. A receipt that finds its embed gone is now parked by the app and slot the send belonged to (website/src/app-sdk/embedSendRecovery.ts, module-local; the app is part of the key because two apps can embed the same slot and one must never drain -- and render -- the other's handed-back text — the same shape SideChat gets from the store's per-slot sendStatus / sideHandBackText, kept out of the store because the app-sdk embed deliberately owns no slice) and drained by the next embed mounted for that slot; an embed already showing the slot when the receipt lands is notified and drains immediately. The buffer is a queue per slot, not one record: the in-flight guard is per instance (isPending resets on a fresh mount), so a remounted embed can send again while the first instance's send is still out, and if both come back refused each keeps its copy — the drain applies every parked receipt oldest-first, merging each handed-back text on top of the previous one (round 3, GPT F1). One applyRecovery renders the outcome on both the live and the drained path so they cannot diverge; a receipt parked for slot A is never shown by an embed for slot B, and one parked by app A is never shown by app B's embed for the same slot (embedSendRecovery.test.ts).

useChatSession seed (website/src/app-sdk/useChatSession.ts). The RFC's "four hand-written send paths" undercounted: the app-sdk session hook seeded a new slot through the same bare /api/chat POST with the same swallowed SyntaxError. It now sends the seed through sendTurn over the app-sdk wire, fire-and-forget (the slot is the deliverable; creation must not wait out the transport deadline for an answer it ignores). The receipt is deliberately not acted on — the slot exists either way, and a seed that did not go out is an empty session, not a lost user message — but the SSE-as-JSON root cause is gone from the app-sdk entirely.

RFC placement. Chat-core extraction P2 (transport), second and third slices. After #5909 (ChatPane), #8689 (ChatPage's send and steer, merged 2026-09-05) and this PR (ChatEmbed + SideChat), all 4 user-facing send paths plus the app-sdk seed send are on sendTurn. Corrected inventory — the RFC's "four paths" undercounted. Batch B (#9587, stacked on this branch and merged into it 2026-09-09) is folded in here: apps/mochi/panel/panelBridge.ts (echoed the user bubble before the POST and never read the receipt — now sends through sendTurn, rejects on refused / transport-error / response-late with the outcome flagged by Error.name — SEND_REFUSED carries the server's reason, SEND_UNCONFIRMED a late receipt — and echoes only on a confirmed acceptance; the vendored ChatPanel restores the text on rejection, merging it with any draft typed meanwhile), apps/design-tweak/api.ts (resolved a non-JSON 2xx as {ok: true} — now sendTurn with the same flagged rejection) and apps/design-critique/api.ts (the identical .catch(SyntaxError) swallow on the SSE endpoint — same conversion; its own bare-fetch wire rejects with indeterminate() on a raw fetch failure, so a connection reset after the gateway took the POST resolves as response-late for the poll to settle instead of a retry-safe failure that would run the critique twice; because the follow-up thread shares one slot, its poll now accepts only an assistant row appended after the pre-send row count -- a send that resolved indeterminate but never landed times out instead of persisting the previous answer under the new question, pinned in DesignCritiquePage.coverage.test.tsx). Batch A (apps/issue-radar/agentSession.ts, apps/auto-improvement/agentSession.ts) landed on main as #9576. Still off sendTurn after this PR (batch C, #9570): hooks/useSceneInteraction.tsx (re-implements readSendReceipt classification without the deadline) and App.tsx (the feedback send). SideChat was #8655 (stacked on this branch; a second receipt adapter for the /side/* reject-semantics endpoint) and is now merged into this branch — see the third-slice section below. Rebased onto main after #8689: SendWirePayload now also carries steer / colorTheme so the default dashboard wire forwards ChatPage's flags unchanged; the app-sdk wire ignores them (the server refuses app-authenticated steers). The reason-less transport-failure copy and the delivery-unconfirmed notices now live under shared pages.chatPage.* keys (see the SideChat section), so ChatEmbed, ChatPane and SideChat state the same outcome in the same words.

Third slice — SideChat (#8655, merged into this branch 2026-09-07). Reviewed and converged as its own stacked PR (all five lanes, human-approved) and squash-merged here so the whole P2 user-facing set lands as one commit. SideChat is the one surface on a different endpoint family (/side/open + /side/turn) with the opposite receipt semantics — the client helpers resolve JSON on 2xx and reject with an ApiError on non-2xx. A per-surface side wire (website/src/pages/chat/sideTurnWire.ts, new) performs the two-call sequence the panel has always made and re-expresses the helpers' outcomes in the fetch seam's shape, so sendTurn classifies the side panel's send by the same rule as every other surface (deadline, refused vs unreadable vs transport failure) while the acceptance body (run_id, queue_id, steer_id, pending, demoted, still_queued) passes through untouched and its handling is byte-for-byte the previous onSuccess. A post-2xx body-read failure from /side/turn is tagged AcceptedBodyUnreadable (api/apiError.ts, human message api.client.accepted_body_unreadable, 12 locales + en-XA) via a phase-preserving jAccepted, so a stream cut mid-body reads as unknown (never a duplicate-inviting failure) — the same tagging is applied in the app-sdk's jsonFetch, so ChatEmbed's wire maps it to unknown too, and the /side slash interceptor in ChatInput.tsx treats it as accepted; the abort race (settleUnderSignal) now lives once in chat-core/transport and both wires use it. SideChat.tsx's mutationFn becomes one sendTurn call; receipt policy: refused / transport-error roll back the optimistic bubble and hand the text back merged with the server's reason framed through pages.chatPage.send_failed_with_error (or the connection copy); response-late hands the text back under a standing unconfirmed notice on every send — an idle send's optimistic bubble is rolled back first, because this panel has no slot poll that could ever clear a pending the server never confirmed (a kept bubble stranded the panel busy: refresh disabled, thinking indicator forever, the next send demoted behind a phantom turn) — and uses the "re-pick the option" copy for a chip send; unknown does nothing. Every hand-back is addressed to the originating slot: the text through restoreDraftTo into the per-slot Side Chat draft store (#8947's sideChatDrafts, which the composer is controlled by), the status that explains it through the per-slot SideState.sendStatus — so a receipt landing after a slot switch or panel unmount is neither lost nor merged into another slot's draft. Catalogs: the three receipt strings this surface shares with ChatEmbed (send_failed_connection, delivery_unconfirmed, delivery_unconfirmed_option) live under pages.chatPage.* (the #4240 precedent; the first two already landed via #8689) — the retired appSdk.chatEmbed.* copies are deleted from every locale and sendFailedSharedKey.test.ts guards both invariants. Every existing SideChat test passes unmodified. Full history in #8655.

Rebase onto main (2026-09-06). One gate-only adjustment, no behaviour change: pages.chatPage.dismiss_upload_error was dropped from all 13 catalogs — main's ErrorNotice sweep had already removed its only call site and the key, and this branch's catalogs carried it back in through the rebase, so it registered as the 30th dead key against the deadKeys.test.ts baseline of 29; the branch's dead-key count now equals main's. The eager i18n all chunk had also tripped the Bundle Size Gate by 1.1 KB on the previous head (a pristine main build measured 10,737 KB, 4.8 KB under the 10,490 KB ceiling, and this PR's 13-locale receipt/refusal copy adds ~6 KB); main has since re-measured CHUNK_BUDGETS.all to 10,975 KB itself, so this PR no longer touches scripts/check-bundle-size.mjs and builds the chunk at 10,491 KB inside main's ceiling.

Review round 2026-09-15 (two product fixes, no new surface).

  • unknown receipts on the poll-less surfaces. SideChat and Mochi treated a 2xx whose body could not be read (unknown) as "the server has it, do nothing" — SideChat kept its optimistic bubble pending, Mochi echoed the bubble and stayed waiting. Neither surface has a slot poll; the only thing that ever clears SideChat's pending (besides an explicit rollback) is the terminal SSE frame, and reconnect refetches slots, not side state — so the outage that cut the body could also swallow that frame and leave the panel "thinking" for good with refresh disabled (GPT finding). Both now take the response-late recovery: bubble rolled back, text handed back under the standing "delivery not confirmed" notice (never an error — the server probably has it, so no "try again"). SEND_UNCONFIRMED now covers unknown as well; sendTurn.ts doc updated.
  • Mochi's strips were styled with utility classes the panel window does not load. panel.html + applyTheme() give the pet's window only the core theme variables — no Tailwind — so the ErrorNotice strip and the role=status line would have rendered as bare text in the shipped window. Restyled the way the rest of the vendored panel is: inline styles on the strip containers, and a scoped .mochi-send-strip rule block in ChatPanel's existing <style> supplying the few layout rules the ErrorNotice utility classes would have (flex/gap/danger colour/dismiss button). ErrorNotice itself is unchanged and keeps the alert semantics the errors-use-error-notice rule asks for. Found by making the capture harness faithful to the shipped window (below).
  • Chip-send notice copy. delivery_unconfirmed_option said "re-pick the option"; blind readers did not know what "the option" referred to. Now uses the chips' visible vocabulary — "tap the suggestion again" — in all 13 locales (en-XA regenerated).
  • Mochi's pet no longer strands in thinking on a send that never became a turn. panelBridge.sendMessage reports user_input (pet → thinking) before the POST, and only a turn's own lifecycle frames ever move the pet on — thinking has no timeout. A refused / transport-failed / unconfirmed send threw without a terminal event, so the pet stayed thinking indefinitely (GPT finding). The send now reports its own terminal pet event before rejecting: error for a definite failure (auto-recovers to idle), task_complete (→ idle) for an unconfirmed one — if that turn did land, its frames drive the pet from idle exactly as they would have.
  • /side slash sends with an unreadable receipt no longer clear the composer. interceptSlashCommand treated a 2xx-with-unreadable-body from api.sideTurn as success: the composer was cleared and nothing reported, while the outage that cut the body can also swallow the WS row that would show the question in the panel — so the question could vanish from the UI (GPT finding). Now it is UNCONFIRMED, the SideChat policy for the same receipt: the command stays in the composer (nothing lost), no error is reported (a retry could run the turn twice), and the side panel — which the command opened — stands its "delivery not confirmed" notice. sideSendStatus now creates the panel's state when a first send has none yet, so that notice cannot be dropped on the very send with no row to fall back on. A later /side submit clears the previous one's standing notice before it sends (the rule SideChat's own submit applies), so an accepted second question never sits under the first one's "not confirmed" (Opus finding).
  • Post-dispatch raw rejections are unconfirmed, not retry-safe failures (Mochi, /side). A connection reset after an accepted POST /api/chat cannot be told from a request that never left, and both surfaces had just completed a POST on the same link (ensureSlot, /side/open) — so Mochi's transport-error and the slash path's raw api.sideTurn rejection were "Send failed, try again" invitations to run the turn twice (GPT finding). Mochi now flags every non-refusal SEND_UNCONFIRMED (only ensureSlot's own failure keeps the connection copy); /side <message> now sends through sideTurnWire + sendTurn — the same wire SideChat's composer uses — so a refusal (ApiError), an unreadable 2xx, a raw post-dispatch rejection and the transport deadline classify by the one shared rule, and the last three keep the composer under the panel's "delivery not confirmed" notice.
  • One spelling of the receipt copy. ChatEmbed and SideChat had grown the same framed-failure construction independently (restored-vs-chip key split, trailing-stop strip, connection fallback, and the unconfirmed pair). Both now call chat-core/transport/receiptCopy.ts (sendFailureCopy, deliveryUnconfirmedCopy), so the surfaces cannot drift (first-principles finding).

Tests

  • chatCoreTransport.contract.test.ts (+3): an injected wire receives {message, slot, meta} plus an AbortSignal and the dashboard fetch is not touched; its resolved non-2xx is refused and its rejection transport-error; the deadline fires through it as response-late. 14 pass.
  • appSendWire.contract.test.ts (new, 9): agent + JSON-receipt path on the wire; queued ≠ dispatched; ApiError → refused with server reason (and with a non-JSON HTML 500 body); SyntaxError on 2xx → unknown (the old swallowed shape); permission denial → refused with a human sentence that names the app as the user knows it (AppApiProvider.appDisplayName, which AppHost fills from the manifest; the id is the fallback) and says where its grant lives + console detail; a non-JSON refusal body (a proxy 502 page, a bodyless 413) → refused with the status as the reason (server_refused_with_status) instead of a reason-less receipt; rejected fetch → response-late, never the retry-safe transport-error; deadline → response-late without a signal; a settlement after the deadline does not flip the receipt.
  • ChatEmbed.sendReceipt.test.tsx (new, 24; chip-notice assertion follows the new copy): refused → error row with server reason + text handed back; transport failure → generic copy + handed back; merge with text typed mid-flight; unreadable 2xx → no row, no restore; deadline → notice row + text handed back; dispatched → nothing; next send clears the row; option-chip send does not clobber the draft; onSend rejection → notice + handed back, no error row; timed-out chip send says "re-pick the option", not "text is back"; a failure row in a top-anchored embed triggers the new-message scroll; proven delivery (own user row by meta.sendId) retires the notice and takes back an untouched restore, leaves an edited draft alone, a send the poll showed before the deadline leaves nothing behind, unrelated transcript growth keeps both notice and text, a same-text row with another sendId is not proof, a same-text row with no sendId is not proof either (no text fallback), a merged queued row naming this send in meta.sendIds is proof, a permission denial shows the human sentence, a transport failure names the connection, a refused send hands back the draft as typed (leading/trailing whitespace kept) while the wire carried the trimmed text, an Enter mid-flight pulses the spinner and announces "Sending…" without a second request, and an error row stays whatever arrives.
  • ChatEmbed.test.tsx: send-path expectations updated to /api/chat?ws=1; default receipt {ok: true}. 35 pass.
  • useChatSession.test.ts: seed expectations updated to the JSON-receipt path; a refused seed still yields a ready session.
  • i18n catalog suite (parity, dead keys, key reference, English identity, changed-value QA) passes with the new key.
  • npm run typecheck, changed-file ESLint, and the i18n added-lines gate (0 untranslated) are clean.
  • Unmount-safe recovery (ChatEmbed.sendReceipt.test.tsx, +4): a refusal landing after the embed unmounted is shown, text and all, by the next embed for that slot; a receipt parked for slot A is not shown by an embed for slot B; a late send whose embed remounted before the deadline still gets its notice and text on the mounted embed; two overlapping sends that both fail after their embeds unmounted each get their text back (first\n\nsecond), nothing overwrites.
  • SideSlashCommand.test.tsx / .steer.test.tsx: refusals are ApiErrors (as j() throws them); +1 case pinning that a raw post-dispatch rejection is unconfirmed (composer kept, panel notice, no error); the unreadable-2xx case pins failed + unconfirmed, the side panel's standing notice, no error, panel opened.
  • MochiPanelBridgeCoverage.test.tsx: the rejecting-POST case now pins send-unconfirmed + task_complete (no error); the unknown-echoes case now pins the unconfirmed rejection + task_complete pet event (no error); +1 case pinning that a refused send reports the pet error event after user_input.
  • SideChat.refresh.test.tsx (1 assertion updated, not weakened): its "sendMutation rejects" case mocked api.sideTurn with a bare Error. Under the side wire a bare rejection after /side/turn was dispatched is indeterminate (response-late — the request may have been taken and only the answer lost; pinned by SideChat.sendReceipt.test.tsx), so the test now rejects with the ApiError a real server refusal is, and asserts the same rollback + hand-back it always did. feat(chat-core): route SideChat's send through the transport over a side wire #8655's "every SideChat test passes unmodified" was true on its stacked base, where ci.yml never ran on the final head; this was the one pre-existing SideChat test that encoded the old "any rejection = refusal" semantics.
  • SideChat slice: SideChat.sendReceipt.test.tsx (new, 14 — refusal/rollback + framed reason, never-left vs post-dispatch TypeError, late steer/chip/idle policies, deadline during /side/open never dispatches /side/turn, AcceptedBodyUnreadable → the unconfirmed recovery: bubble rolled back, text handed back under the notice, pending clear, no alert — updated 2026-09-15 from the earlier "do nothing" pin; per-slot hand-back across slot switch and unmount); sendFailedSharedKey.test.ts (+3, shared keys in every locale, retired surface keys absent from catalogs and source); SideSlashCommand.test.tsx (+1); appSdkScopedApi.test.tsx (+3) / appSendWire.contract.test.ts (+1, tagged stream cut → unknown); ApiClient.coverage.test.tsx (+3, api.sideTurn receipt phases). Compatibility evidence: every pre-existing SideChat suite (steerQueue 73, refresh, multiturn, close, imeEnter, oversizeQuestion, planExclusion, thinking, SideSlashCommand.steer) passes on the new path unmodified.

Manual verification

Screenshot harnesses: website/capture/chat-embed-send-receipt.* (real ChatEmbed under the real AppApiProvider, fetch stubbed to refuse the send; asserts the error row and the restored composer before capturing — and now waits for the row's animate-scale-in entrance to finish before the frame is taken, since a first-frame capture showed an empty gap where the row was) website/capture/side-chat-send-receipt.* (real SideChat with api.sideTurn stubbed to refuse, or to never answer for the response-late frame) and website/capture/mochi-send-receipt.* (real Mochi ChatPanel over the real mochiApi → panelBridge.sendMessage → chat-core sendTurn path; fetch stubbed so the slot bind succeeds and POST /api/chat answers 409 or never; the bridge's dashboard socket is stubbed open so the panel reads online). The Mochi harness is faithful to the shipped window: it mirrors panel.html (reset + font, no utility stylesheet), writes ?theme to the mc-theme / mc-color-theme keys the panel reads, and calls the panel's own applyTheme() — the same filtered variable injection the pet's window gets. It asserts the light frames differ from the dark ones byte-for-byte (the earlier harness applied a fixed palette and photographed dark twice). website/capture/design-tweak-send-receipt.* (the REAL Design Tweak page over the real api.ts → sendChatMessage → sendTurn path; fetch stubbed to serve one project and one draft request, seal it on /send, adopt the slot, and refuse the turn with a 409). Every harness asserts the strip text, the composer contents and — for Mochi — that no bubble was painted for a send the server never took, before the frame is written; the Design Tweak one also asserts the request keeps its Send control after the refusal.

Screenshots / video

Frames are of this head's surface — ChatEmbed's own single-line <input> composer (this PR does not change the composer; the ChatInput swap lands separately as its own PR) — captured with the repository harness (website/capture/chat-embed-send-receipt.*: real ChatEmbed under the real AppApiProvider, transport stubbed to refuse / deny / never answer; the harness asserts the row text and the restored composer before taking each frame). PNGs are committed in this head's tree under temp-screenshots/chat-embed-send-receipt/, temp-screenshots/side-chat-send-receipt/, temp-screenshots/mochi-send-receipt/ and temp-screenshots/design-tweak-send-receipt/, pinned to 44cc28be730b3af189aaa7e59c8f88284950d25e.

ChatEmbed idle (dark) ChatEmbed refused (dark): framed reason + text handed back
idle dark refused dark
ChatEmbed late (dark): notice row, text handed back ChatEmbed permission denial (dark): refused receipt naming the app
late dark denied dark
ChatEmbed light theme (idle / refused / late / denied)

idle light
refused light
late light
denied light

Chip send (delivery_unconfirmed_option). A send that originates from a follow-up chip's "send now" segment never consumed the draft, so its unconfirmed notice says to tap the suggestion again instead of claiming a restore — and the half-typed draft is left exactly as it was. Same harness, ?chips=1&refuse=late: the transcript ends in an [OPTIONS: …] footer, the user has typed Also cap the per-, and sends Add a per-IP fallback from the chip. Asserted: the row is the chip variant and the composer still holds the draft.

ChatEmbed chip send, late (dark) ChatEmbed chip send, late (light)
chip late dark chip late light

SideChat slice (#8655). A composer-submit refusal rolls the optimistic bubble back, hands the text back, and says so in the framed _restored row (Couldn't send this message: <reason>. Your text is back in the composer.); a chip send keeps the bare Send failed: <reason> framing because it never consumed the draft. Harness: website/capture/side-chat-send-receipt.*.

SideChat refused (dark) SideChat refused (light)
side refused dark side refused light

SideChat response-late (?refuse=late): /side/turn never answers, the transport deadline fires, the optimistic bubble rolls back, the question is handed back, and a STANDING role=status notice (held until the next submit, not auto-dismissed) says delivery is unconfirmed — this panel has no slot poll that could ever clear a pending bubble, so a turn the server may never have received cannot be left "thinking" forever.

SideChat late (dark) SideChat late (light)
side late dark side late light

SideChat over-limit hint (ride-along, mandated by the errors-use-error-notice rule: validation is not a failed operation): a question past MAX_QUESTION_BYTES is not sent and the panel says how far to cut, as a role=status line at body weight — no longer the red ErrorNotice — cleared on edit. Same harness; client-side only.

SideChat over-limit (dark) SideChat over-limit (light)
side overlimit dark side overlimit light

Mochi ChatPanel. The user bubble appears only after the server accepts. A refused send restores the text under an ErrorNotice (role=alert) framed as Send failed: <server reason>; a send with no usable receipt (response-late or unknown) restores it under a role=status "delivery not confirmed" line — not an error, because the send MAY have landed and "try again" would invite a duplicate. Frames are from the faithful harness (website/capture/mochi-send-receipt.*: the panel's own applyTheme(), no utility stylesheet — what the pet's window actually renders); asserted per frame: the strip text, the restored composer at the panel's --text colour (#dcdadf on dark, #4a464f on light — the same core variable the whole dashboard reads its body text from), and that no bubble was painted.

Mochi refused (dark) Mochi late (dark)
mochi refused dark mochi late dark
Mochi light theme (refused / late)

mochi refused light
mochi late light

Design Tweak. A request is marked delivered only on a CONFIRMED acceptance. A refused dispatch (here the host's 409) is a SEND_REFUSED rejection rendered through the page's existing bridgeError ErrorNotice as Send failed: <server reason>, and the sealed request stays actionable in the rail for a resend — before this branch a {ok:false} refusal inside a 200 (or any non-JSON 2xx) was marked delivered and the sealed edits were lost. Harness: website/capture/design-tweak-send-receipt.*; asserted per frame: the alert text and that the request still has its Send control.

Design Tweak refused (dark) Design Tweak refused (light)
design tweak refused dark design tweak refused light

Related Issues

Chat-core extraction RFC, phase P2 (transport). Builds on #5909 and #8689. Depends on #8853 (gateway-side sendId through the queue drain; opened from this PR's GPT finding — merged). Includes #8655 (SideChat slice, merged into this branch). Downstream rebase point: #6825. no linked issue: RFC phase work tracked in the RFC, not an issue.

Checklist

Contribution License Agreement

N/A — repository placeholder only; no OSPO CLA text has been supplied.

@CrysisDeu
CrysisDeu requested review from a team and krishdhasmana September 5, 2026 00:07
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 5, 2026
@github-actions

github-actions Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 7cc67a6d226e27383e920fb0059740cd41543730 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify the dashboard wire's transport-error exemption still matches ChatPane/ChatPage post-#8689 — its duplicate-turn safety rests on their optimistic-bubble resend UX, pinned only in a comment.

[DESIGN-REVIEWED] 7cc67a6

@github-actions

github-actions Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — 🟡 CONCERNS

UX-level review of 6603be07bc4d9393ee89f52dd1ed6439d13d344e — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: CONCERNS

Refusal errors surface raw backend vocabulary — "slot agent mismatch", "declare chat access in its permissions" — the blind reader could extract nothing actionable from.

Watch

  • send_failed_with_error interpolates the server's reason verbatim, so users read "slot agent mismatch" on three surfaces (shots 09, 11, 15). Blind reader: "I have no idea what a 'slot' or this mismatch is, and the message gives me nothing to fix." Rare per send but every refusal, at the exact moment of failure. Fix: map the known gateway refusal reasons to human copy (the treatment the permission denial already got) or append one next step to the framed template.
  • appSdk.chatEmbed.app_not_allowed_to_send_named's second clause ("it doesn't declare chat access in its permissions") is developer vocabulary; reader (shot-03): "no idea what 'capture' is… or what I could possibly do about it." The PR already routes app/path/grant detail to the console — send this clause there too and keep only "{{app}} isn't allowed to send chat messages." in the UI.

Suggestions

  • Mochi frames (shots 13–16) show a green status dot beside a "Mochi · Offline" header — pre-existing chrome, but the contradiction is now framed by this PR's new strips; worth a follow-up.

[UX-REVIEWED] 6603be0

@github-actions

github-actions Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — 🔴 changes requested (blocking)

GPT 5.6 found at least one blocking issue that must be resolved before merging 7cc67a6d226e27383e920fb0059740cd41543730. 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

This comment is updated in place on each push.

BLOCKING -- website/src/app-sdk/appSendWire.ts:99 -- Login redirects discard the embed’s only message copy
if (err instanceof AcceptedBodyUnreadable) return { ok: true, json: () => Promise.reject(err.reason) }
200 HTML login response -> scoped parse error -> provenance discarded -> unknown receipt leaves the cleared composer empty
Anchor: residual/crash-data-loss-corruption
Fix: Preserve and forward the accepted response’s headers, redirect flag, and final URL.
[BLOCK-MERGE] 7cc67a6
[GPT-REVIEWED] 7cc67a6

Adjudication (Opus 5) — is blocking on each finding proportionate?

F1 — HIGH (a single unsent composer draft, not stored data; no server state corrupted).

Conditions confirmed: appSendWire.ts:99 is reached only via AcceptedBodyUnreadable, which scopedApi.ts:168-175 raises exclusively for a 2xx non-empty non-JSON body — every non-2xx, including an auth denial, becomes ScopedApiError extends ApiError (scopedApi.ts:53, 143) and takes the refused arm at appSendWire.ts:83, which ChatEmbed.tsx:505 hands the text back on. This gateway cannot emit the required response: the SPA shell is refused to any non-GET/HEAD (token_auth.py:687-688), and its session signals are a 403 (sessionExpirySignal.ts:15) or a 401 (staleOwnerSignal.ts:63). A cross-origin login redirect rejects the fetch at scopedApi.ts:134 and lands on indeterminate() (appSendWire.ts:114) → response-late → ChatEmbed.tsx:506 restores the draft under the unconfirmed notice. So the response shape needed is a same-origin, operator-installed proxy answering a POST with 200 HTML. Loss is then real: draft cleared at ChatEmbed.tsx:526-528, and unknown has no branch at ChatEmbed.tsx:501-506. Recovery: none for the text — but no optimistic row exists (ChatEmbed.tsx:455-456) and onSettled refetch (:508) renders nothing, so the user sees the turn never landed and retypes.

Real fix cost: the scoped helper is deliberately a parsed-JSON seam (scopedApi.ts:148-176); forwarding headers/redirected/final URL means a new metadata contract on its rejection path plus a login-detection branch in the wire, existing only for this one response shape.

[ADJUDICATION] 7cc67a6 total=0 uphold=0 downgrade=0
[GPT-ADJUDICATED] 7cc67a6

[ADJUDICATION-FENCED] 7cc67a6 fenced=1 flagged=1
FLAG F1 website/src/app-sdk/appSendWire.ts:99 -- Silent loss needs a same-origin 200 HTML answer to a POST, a shape this gateway's own writer cannot produce (SPA shell is GET/HEAD-only at token_auth.py:687, auth denials are 403/401 and take the text-restoring refused arm, and a cross-origin login redirect takes the indeterminate arm that restores the draft); the residual is one unsent draft the user must retype, with the missing transcript row making the non-delivery visible.
[GPT-ADJUDICATED-FENCED] 7cc67a6

🏷️ Fenced finding(s) machine-flagged as likely edge case

The security fence keeps these findings blocking regardless of adjudication; the only clearance path is a human override. The annotate-only pass judged the condition combination each one requires extreme, and pre-drafted the override rationale below. A repository writer must independently verify a rationale before posting it — it is machine-authored, and a wrong override on a security-class finding ships exactly the class the fence exists to stop.

  • F1 website/src/app-sdk/appSendWire.ts:99 — Silent loss needs a same-origin 200 HTML answer to a POST, a shape this gateway's own writer cannot produce (SPA shell is GET/HEAD-only at token_auth.py:687, auth denials are 403/401 and take the text-restoring refused arm, and a cross-origin login redirect takes the indeterminate arm that restores the draft); the residual is one unsent draft the user must retype, with the missing transcript row making the non-delivery visible.

    /ai-review override gpt 7cc67a6d226e27383e920fb0059740cd41543730: Silent loss needs a same-origin 200 HTML answer to a POST, a shape this gateway's own writer cannot produce (SPA shell is GET/HEAD-only at token_auth.py:687, auth denials are 403/401 and take the text-restoring refused arm, and a cross-origin login redirect takes the indeterminate arm that restores the draft); the residual is one unsent draft the user must retype, with the missing transcript row making the non-delivery visible.
    

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 7cc67a6d226e27383e920fb0059740cd41543730: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — 🔴 BLOCK

Premise-level review of 7cc67a6d226e27383e920fb0059740cd41543730 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: BLOCK

22 binary screenshots ride into gitignored temp-screenshots/ — a channel #12322 already closed repo-wide; the fix is complete without them.

Not justified as shipped

  • Item 10 — rides along, zero option costs nothing: 22 PNGs added under temp-screenshots/, a path .gitignore:114 pins with "uploaded as a GitHub attachment with gh pr create|edit --attach, never committed" — force-added past that rule, unmentioned in the visible description.
    Subtraction: delete all 22 temp-screenshots/**/*.png; the committed capture scripts regenerate them locally and the attachment channel carries the evidence.
    Clears when: the PNGs are removed from the branch (evidence attached via gh --attach instead).

What this change ships

Inventory (10 items) — 9 justified

Intent: FIX — a refused or unconfirmed chat send on ChatEmbed, SideChat and the app surfaces no longer looks sent while the typed text is silently lost; every send path reads the shared transport receipt. Defect provenance is checkable: the new receipt tests fail on base, and the RFC (rfc-chat-core-extraction.md, partial on base) names this PR in its P2 rows.

  1. ChatEmbed shows a refused send as an error row with the server's reason and puts the text back in the composer — justified
  2. ChatEmbed shows an unconfirmed send as a standing notice, retired only when the poll proves delivery by sendId (backend carries sendIds, verified at chat_runner.py:7902) — justified
  3. SideChat and /side get the same receipt policy: framed refusal, standing unconfirmed notice, bubble rollback, per-slot recovery — justified
  4. Mochi's user bubble now appears only after the server accepts; failures restore the text with an error/notice strip — justified
  5. Design Tweak no longer marks a {ok:false}-inside-200 dispatch delivered; the request stays resendable — justified
  6. Design Critique rejects refusals and no longer records the previous answer under an unlanded follow-up — justified
  7. Scoped app API throws typed errors (ApiError, AcceptedBodyUnreadable, permission denial naming the app via new appDisplayName prop, 1 counted consumer with an id fallback) — justified
  8. Shared send-receipt copy added to all 13 locale catalogs, surface-local copies retired and pinned — justified
  9. Four capture entries + scripts (matches the 615-script website/capture convention; the gitignore comment licenses the scripts, not the output) — rides along
  10. 22 binary screenshots committed under gitignored temp-screenshots/ — rides along, zero option costs nothing, reverses the recorded decision in chore: remove committed temp-screenshots evidence #12322

Blockers

Committed screenshot binaries reverse a recorded repo decision and the fix ships without them. Trigger (b), all four parts read off the diff: lens 1 calls this a FIX; the PNGs ride along; their zero option costs nobody anything (the capture scripts under website/scripts/ regenerate them locally, and product, tests and CI never read them); items 1–8 remove the reported defect on their own. The channel they duplicate is named: .gitignore:114 ignores temp-screenshots/ with the comment "PR review evidence (screenshots, GIFs, recordings) is uploaded as a GitHub attachment … never committed", and commit 85b5362e3 (#12322, 2026-09-20) deleted the 145 leftovers, so landing these re-opens exactly what that commit closed — this time as permanent history bloat. Count: 22 PNGs, pattern ^diff --git a/temp-screenshots/ over the patch.
Subtraction: remove temp-screenshots/ from the branch entirely.
Clears when: the branch carries no temp-screenshots/ files and the frames travel as PR attachments.

[FIRST-PRINCIPLES-REVIEWED] 7cc67a6

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 5, 2026
@github-actions

github-actions Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed 6603be07bc4d9393ee89f52dd1ed6439d13d344e — this comment is updated in place on each push.

Review details

No blocking issues; one advisory finding.

FINDING — website/src/pages/chat/SideChat.tsx:798 — the over-limit hint is gated behind !displayError ({!displayError && validationHint && …}), but displayError folds in the new persistent sendStatus?.error; after an earlier refused/transport-error send on the slot (e.g. a 429 "side queue is full") that error stays set (only onMutate line 340 or recoverFor clears it, and the over-limit branch returns before the mutation fires so onMutate never runs; the restoredDraftSeen effect clears only notice), so pressing Send on too-long text shows the stale unrelated error while the actual block reason (validationHint) is suppressed and the submit silently does nothing → Fix: dispatch sideSendStatus({ slot, error: null, notice: null }) in the over-limit branch (line 700) before setValidationHint, or render validationHint ahead of displayError since it is the reason this submit was blocked.

[OPUS-REVIEWED] 6603be0

Verdict parsed from the review's SHA-scoped output markers for commit 6603be07bc4d9393ee89f52dd1ed6439d13d344e.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 6603be07bc4d9393ee89f52dd1ed6439d13d344e: <one-sentence reason>

@CrysisDeu
CrysisDeu force-pushed the feat/chat-core-p2-embed branch from 45b35ec to d40a771 Compare September 5, 2026 00:23
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 5, 2026
@CrysisDeu
CrysisDeu force-pushed the feat/chat-core-p2-embed branch from d40a771 to 4aead39 Compare September 5, 2026 00:24
@CrysisDeu

CrysisDeu commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor Author

GPT 5.6 — disposition for 45b35ecc7 → fixed in 4aead39c4

  • BLOCKING · ChatEmbed.tsx:216 · timed-out send can lose the only copy — Accepted, fixed. The finding is right for this surface: ChatPane may leave response-late alone because its optimistic bubble is still on screen, but ChatEmbed keeps no bubble, so once the composer cleared the user's text had no visible copy — exactly the indeterminate outcome sendTurn's contract names as recoverable by such a caller. Now: response-late hands the text back via mergeRecoveredDraft and appends a notice row (not an error — the turn may well be running) with new copy appSdk.chatEmbed.delivery_unconfirmed ("Delivery not confirmed — … check the transcript before sending it again."), added to all 12 locales + en-XA. unknown (a 2xx was received) still does nothing, since restoring there invites a duplicate. Pinned by the rewritten deadline test in ChatEmbed.sendReceipt.test.tsx; screenshot late-dark.png added to the body.

@CrysisDeu

CrysisDeu commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor Author

First Principles — disposition for 45b35ecc7 → 4aead39c4

  • Subtraction · drop export from dashboardSendWire — Applied. Module-private now; sendTurn is its only consumer.
  • Subtraction · drop export from APP_SEND_PATH — Applied. Module-private; the contract test asserts the literal /api/chat?ws=1 instead of importing the constant.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 5, 2026
@CrysisDeu
CrysisDeu force-pushed the feat/chat-core-p2-embed branch from 4aead39 to 33a10cb Compare September 5, 2026 00:35
@CrysisDeu

CrysisDeu commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor Author

UX — disposition for 4aead39c4 → fixed in 33a10cbdd

  • Watch · delivery_unconfirmed misstates composer state on option sends — Implemented. The unconfirmed branch now picks copy by send kind: a composer submit keeps "Your text is back in the composer; check the transcript before sending it again"; a follow-up-chip send gets new appSdk.chatEmbed.delivery_unconfirmed_option — "Delivery not confirmed — the server has not acknowledged this message yet. Check the transcript, then re-pick the option if it is missing." (12 locales + en-XA). Pinned by a new test: a timed-out chip send shows the re-pick copy, never the "back in the composer" sentence, and leaves the user's own draft untouched.

@CrysisDeu

CrysisDeu commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor Author

GPT 5.6 — disposition for 4aead39c4 → 33a10cbdd

  • BLOCKING · appSendWire.ts:84 / onSend catch · rejection does not prove non-delivery — Half accepted, fixed for the half that holds.
    • onSend (host endpoint): accepted. A host may have posted and lost the answer; its rejection is opaque. It now takes the unconfirmed path (notice + text handed back, no error row) — never a failure that invites a duplicate. Test updated to pin it.
    • Wire reject(err) → transport-error: disputed, override posted. This branch is reached only when the scoped AppApi rejected with something other than AppApiError (an HTTP status) or SyntaxError (a 2xx body) — i.e. the permission check threw before any request left, or fetch itself rejected. That is exactly the dashboard wire's contract merged in feat(chat-core): extract transport sendTurn and adopt it in ChatPane #5909 (sendTurn.ts catch → transport-error, "the send never left"); a received-then-dropped response is a fetch that resolves, which the adapter routes to unknown/refused, not here. Diverging the app wire from the dashboard wire on the same event would re-fork the receipt contract this PR exists to unify.

@CrysisDeu

CrysisDeu commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor Author

First Principles — disposition for 4aead39c4 → 33a10cbdd

  • Subtraction · drop AppSendWireOptions — Applied. appApiSendWire(api, agent?: string); the interface is gone.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt 33a10cb: the wire's reject→transport-error branch fires only when the scoped api threw before any request left (permission check) or fetch itself rejected — a received-but-dropped response resolves and is classified unknown/refused; this mirrors the dashboard wire contract merged in #5909, and the onSend half of the finding was accepted and fixed in this SHA.

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Human judgment recorded

@CrysisDeu marked the gpt AI finding as false positive, not applicable, or explicitly accepted for 33a10cbddd6a43895ca04cfd8ed7de52c217190c.

the wire's reject→transport-error branch fires only when the scoped api threw before any request left (permission check) or fetch itself rejected — a received-but-dropped response resolves and is classified unknown/refused; this mirrors the dashboard wire contract merged in #5909, and the onSend half of the finding was accepted and fixed in this SHA.

This decision applies only to this commit. A new push requires a new judgment.

@CrysisDeu
CrysisDeu force-pushed the feat/chat-core-p2-embed branch from 33a10cb to 21ba33a Compare September 5, 2026 00:46
@CrysisDeu

CrysisDeu commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor Author

UX — disposition for 33a10cbdd → fixed in 21ba33afa

  • Watch · top-anchored embeds can append the failure row below the fold unannounced — Implemented. The send-tail row is now folded into the non-startAtBottom new-message scroll hash (msgHash includes sendTail.role + content.length), so a refused or unconfirmed send triggers the same scrollIntoView a new reply does; startAtBottom embeds were already re-pinned by the ResizeObserver. Pinned by a new test: with scrollIntoView spied, a refused send in a top-anchored embed adds a scroll call.

@CrysisDeu

CrysisDeu commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor Author

First Principles — disposition for 33a10cbdd → 21ba33afa

  • Watch · useChatSession.ts:113 is a fifth bare /api/chat sibling with the same SSE-swallow — Accepted, converted in this PR. The seed now goes through sendTurn over the app-sdk wire (JSON receipt). Receipt deliberately not acted on — the slot exists either way and a missing seed is an empty session, not lost user text — but the swallowed-SyntaxError root cause is gone from the app-sdk. Body's path count corrected ("plus the app-sdk seed send"); useChatSession.test.ts updated.
  • Subtraction · drop AppApiError.status — Applied. Only bodyText is read back; the constructor keeps the status parameter for the message text.

@CrysisDeu
CrysisDeu force-pushed the feat/chat-core-p2-embed branch 2 times, most recently from 85d0b9f to e0be365 Compare September 5, 2026 00:58
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Item 8 — rides along: SideChat's over-limit hint re-rendered as plain status text (was a red ErrorNotice) and auto-cleared on edit (span=7fd7b8231200)

Disposition: rebutted — the relabel is not an inference from the rule: the GPT lane BLOCKED head 8c1ea3b for rendering the over-limit hint in ErrorNotice, citing AUTOSDE errors-use-error-notice ("validation is not a failed operation"), after this lane and UX had asked for the ErrorNotice form on the head before. The role=status hint at body weight is the shape that satisfies the blocking lane; it stays inventoried in the description as a ride-along (as the lane's own inventory notes), and this head adds the frame the UX lane asked for (side-chat-send-receipt/overlimit-*.png).

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

self-added: no

  • send_failed_with_error renders the server's reason verbatim ("slot agent mismatch") on three surfaces (span=f36a06ee3ee2)

Disposition: rebutted (this theme's nineteenth round, each under a new span id; reported to the author as a standing item) — the reason is the server's own sentence and every surface on main frames it the same way (ChatPane / ChatPage / App.tsx interpolate the same body into the same send_failed_with_error* keys); the server sends no machine code the client could key a mapping on (chat_handlers.py answers {"error": "slot agent mismatch"}; the HTTP status alone is not a reason), so a per-surface table would make the surfaces disagree on identical failures. The framing is now spelled once for all of them (receiptCopy.ts), which is where such a table would go if the server ever emits codes. Humanising the reasons where they originate is the server-side follow-up to this transport slice.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

self-added: no

  • app_not_allowed_to_send_named's second clause is app-developer vocabulary (span=6669409da899)

Disposition: needs-a-decision (the standing UX-vs-first-principles conflict on this key, reported to the author each round) — an earlier UX round asked for exactly this clause ("name the app and point to the permission", span 6758577b7692); the last four UX rounds ask for its removal, and the first-principles lane asks to drop the display-name prop the key exists for (span 19d4f822b0f3). The head keeps the current copy until the author decides; nothing is flipped here.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Shared delivery_unconfirmed copy ("check the conversation above") renders in Side Chat above an empty panel; a side-panel variant (span=ebf1085f646a)

Disposition: accept-and-defer — the clause points at where the reply WILL appear if the turn landed (the /side SSE stream appends the row), so it is meaningful even when the panel is empty when the notice lands; but a side-panel variant is a fair ask. It is a revision of the shared pages.chatPage.delivery_unconfirmed key (or a new sibling) across 13 locales and four surfaces, recorded for that key's revision together with the earlier rounds' asks (auto-retire wording, "message box", neutral-about-what-is-there), so all surfaces change once rather than this PR forking the copy (same ruling as spans bc43f4fd06d8 / 7c9ef92176b9).

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Design Tweak's bare Send failed: <reason> banner says nothing about the sealed request staying resendable (span=afbb27866573)

Disposition: accept-and-defer — the affordance is on screen: the rail keeps the request's Send control beside the banner (the harness asserts it, design-tweak-send-receipt/refused-*.png), so the loop the reader guessed at is closed by the control rather than by copy. A clause naming it is a new Design Tweak string in 13 locales; recorded for the app's copy pass rather than added to a transport slice whose one Design Tweak change is the receipt gate.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

self-added: no

  • The "a wire MUST reject with indeterminate() unless it can prove never-left" rule is enforced only by doc + per-wire contract tests; batch C's wires should copy an existing wire's contract test wholesale (span=40bfaa82fb17)

Disposition: acknowledged — agreed, and that is the intended path: appSendWire.contract.test.ts and sideTurnWire's cases in SideChat.sendReceipt.test.tsx are written as the template (never-left vs post-dispatch rejection, indeterminate() on the latter), and the SendWire doc in sendTurn.ts names them as the contract a new wire copies. Noted for the batch C PR.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

self-added: no

  • sendFailureCopy(receipt.reason, …) interpolates the server body untranslated ("slot agent mismatch") in ChatEmbed, Design Tweak and Mochi (span=5c0c59086f47)

Disposition: rebutted (this theme's twentieth round, each under a new span id; reported to the author as a standing item) — the reason is the server's own sentence and every surface on main frames it the same way (ChatPane / ChatPage / App.tsx interpolate the same body into the same send_failed_with_error* keys); the server sends no machine code the client could key a mapping on (chat_handlers.py answers {"error": "slot agent mismatch"}; the HTTP status alone is not a reason), so a per-surface table would make the surfaces disagree on identical failures. The framing now lives in one place (receiptCopy.ts), which is where such a table would go if the server ever emits codes. Humanising the reasons where they originate is the server-side follow-up to this transport slice.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

self-added: no

  • delivery_unconfirmed says "check the conversation above" while SideChat's first-question case and Mochi show an empty transcript (span=a1ee8ffe6884)

Disposition: accept-and-defer — the clause points at where the reply WILL appear if the turn landed (SideChat's /side SSE stream appends the row; Mochi's chat:message frames render the reply), so it is meaningful even when the pane is empty when the notice lands; but the lane is right that it reads oddly over nothing. Making the shared pages.chatPage.delivery_unconfirmed key neutral about what is already there (or adding a first-send sibling) is a revision of a key ChatPane, ChatPage, SideChat and ChatEmbed render in 13 locales, recorded for that key's revision together with the earlier rounds' asks (auto-retire wording, "message box"), so all surfaces change once rather than this PR forking the copy (same ruling as spans bc43f4fd06d8 / 7c9ef92176b9 / ebf1085f646a).

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

self-added: no

  • app_not_allowed_to_send_named: drop the clause "— it doesn't declare chat access in its permissions" (span=aed5c3c82487)

Disposition: needs-a-decision (the standing UX-vs-first-principles conflict on this key, reported to the author each round) — an earlier UX round asked for exactly this clause ("name the app and point to the permission", span 6758577b7692); the last five UX rounds ask for its removal, and the first-principles lane asks to drop the display-name prop the key exists for (span 19d4f822b0f3). The head keeps the current copy until the author decides; nothing is flipped here.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Item 3 — oversized: retireSendTail's before/after chain replay through a caller-supplied RestoreMerge only matters for a remount-within-10s-then-resend-then-both-go-late compound (span=abd71e79d5f0)

Disposition: needs-a-decision (eighth round on this item; reported to the author as a standing question: delete the later-restore replay or keep it) — the replay exists so that retiring the FIRST of two restored unconfirmed sends does not silently drop the second's restored text from the composer; the lane's point that the compound is rare is taken. Deleting it is a behaviour change on the recovery path the author asked to keep until decided; the head keeps it until the author decides. Clears the moment the author picks either way.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Item 5 — rides along: the over-limit hint's move from ErrorNotice to a role=status line is derived from AUTOSDE's errors-use-error-notice rule, nothing to act on (span=92d9dc89bc3e)

Disposition: acknowledged — agreed on both counts (rides along; derived from the rule the GPT lane BLOCKED head 8c1ea3b on); it stays inventoried in the description as a ride-along, with the over-limit frame the UX lane asked for.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

self-added: no

Disposition: acknowledged — agreed; the shared cases (post-dispatch rejection → indeterminate(), late settlement never flips a receipt, refusal carries the server reason) exist today in appSendWire.contract.test.ts and sideTurnWire's cases in SideChat.sendReceipt.test.tsx, and lifting them into a wireConformance(name, makeWire) helper is the first change of the batch C PR, where the third wire makes the duplication visible. Not folded into this slice so the two existing wires' tests stay readable as the reference (same ruling as span 40bfaa82fb17).

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Refusal reasons pass through verbatim: send_failed_with_error interpolates the server's sentence ("Send failed: slot agent mismatch") on four surfaces (span=2718fd89e08c)

Disposition: rebutted (this theme's twenty-first round, each under a new span id; reported to the author as a standing item) — the reason is the server's own sentence and every surface on main frames it the same way (ChatPane / ChatPage / App.tsx interpolate the same body into the same send_failed_with_error* keys); the server sends no machine code the client could key a mapping on (chat_handlers.py answers {"error": "slot agent mismatch"}; the HTTP status alone is not a reason), so a per-surface table would make the surfaces disagree on identical failures. The framing now lives in one place (receiptCopy.ts), which is where such a table would go if the server ever emits codes. Humanising the reasons where they originate is the server-side follow-up to this transport slice.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

self-added: no

  • app_not_allowed_to_send_named: cut "— it doesn't declare chat access in its permissions" (span=730f8a745880)

Disposition: needs-a-decision (the standing UX-vs-first-principles conflict on this key, reported to the author each round with a recommendation: keep the display name, cut this clause) — an earlier UX round asked for exactly this clause (span 6758577b7692); the last six UX rounds ask for its removal, and the first-principles lane asks to drop the display-name prop the key exists for (span 0e7b8eaa2b5f). The head keeps the current copy until the author decides; nothing is flipped here.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

self-added: no

  • After a permission-denial refused receipt in ChatEmbed, disable or annotate the send button — the denial is permanent (span=ee1fdfce2f6a)

Disposition: accept-and-defer — agreed the denial is permanent for that mount (the grant is the host's manifest, not something the user changes from the row), so a send control that looks live is a fair catch. The app-sdk wire deliberately collapses every refusal into refused + reason so the four surfaces classify by one rule; telling the permission denial apart again in ChatEmbed to disable the composer means carrying the AppApiPermissionError class through the receipt, which is a small transport-contract change of its own rather than a copy fix, and is recorded for the app-sdk follow-up alongside the display-name decision (spans 730f8a745880 / 0e7b8eaa2b5f) it depends on.

… paths through the transport wire

ChatEmbed (the app-sdk's embeddable chat) posted to the bare /api/chat, read
its SSE stream as JSON, and called the resulting SyntaxError success; a
refused POST rejected the mutation nothing read. Either way the composer had
already been cleared, so a failed send looked sent and the text was gone.

sendTurn gains an injectable wire (the fetch seam: one POST that resolves on
every HTTP status and rejects only when the request never left or the
deadline fired); dashboardSendWire is the default, so ChatPane and ChatPage
are unchanged. appSendWire re-expresses the scoped AppApi outcomes in that
shape (2xx JSON -> ok; 2xx non-JSON -> unknown; non-2xx -> refused with the
server's reason via the dashboard's typed ApiError; permission denial -> refused with a
human sentence; rejected fetch -> transport-error; deadline -> response-late).

ChatEmbed sends through sendTurn over that wire. refused / transport-error
render an error row and hand the draft back as typed; response-late renders
a "Delivery not confirmed" notice and hands the draft back, retired only when
the poll shows THIS send's own user row past the send-start point -- by
identity only (meta.sendId, or membership in a merged row's meta.sendIds),
never by text. The server keeps the id on every path a send can take: a
dispatched send persists it on its row, and a send queued behind a busy slot
carries it through the queue entry onto the drained row (#8853), so there is
no text-matching fallback to false-retire on. unknown does nothing;
dispatched / queued let the poll render. mintSendId now lives once in
chat-core/transport; ChatPane's and ChatPage's inline minters use it.

useChatSession's seed send moves off the bare SSE endpoint onto the same
wire (fire-and-forget; the slot is the deliverable).

SideChat (#8655, merged into this branch): the one surface on a different
endpoint family (/side/open + /side/turn) with the opposite receipt
semantics -- the client helpers resolve JSON on 2xx and reject with an
ApiError on non-2xx. A per-surface side wire re-expresses that in the fetch
seam's shape, so sendTurn classifies the side panel's send by the same rule
as every other surface (deadline, refused vs unreadable vs transport
failure) while the acceptance body (run_id, queue_id, steer_id, pending,
demoted, still_queued) passes through untouched and its handling is
unchanged. Receipt policy: refused / transport-error roll back the
optimistic bubble and hand the text back merged, with the server's reason
when there is one; response-late hands the text back under an unconfirmed
notice only when no bubble holds a copy (steer / queue), and leaves an idle
send's bubble alone; unknown does nothing. The delivery-unconfirmed and
reason-less transport-failure copy moves from appSdk.chatEmbed to shared
pages.chatPage keys so ChatEmbed, ChatPane and SideChat state the same
outcome in the same words. Every existing SideChat test passes unmodified.

Folds stacked PR #9587 (design-critique, design-tweak and mochi sends through sendTurn), which merged into this branch. Error.name markers spelled as machine tokens (send-refused / send-unconfirmed) to satisfy the i18n all-caps-const check main added.

Review round 1: an override (follow-up chip) send no longer clears the send tails, so a late-accepted send's notice can still be retired by proof and its restored text taken back (GPT F1, test-pinned). Mochi bridge tests mock the chat POST with an `ok: true` receipt body, which sendTurn requires.

Review round 2 (GPT): mochi ChatPanel's failed-send restore merges the submitted text with any draft typed while the send was in flight (mergeRecoveredDraft) instead of keeping one and dropping the other (test-pinned).

Review round 3 (GPT): sideHandBackText creates the slot's side record when absent, so a draft typed into a FRESH side panel survives an unmount; the closed-side frame guards key on the tombstone itself (not the record's absence) so the parked record cannot let a closed run's late frames in (both test-pinned).

Review round 4 (GPT): the recovery-drain subscriber re-checks at call time that this instance is mounted and still shows the slot it subscribed for, so a receipt landing between an A->B re-prop and the effect cleanup cannot drain slot A's only copy into slot B.

Rebased over #9593 (batch C) and #8947 (Quote / Ask, persisted per-slot Side Chat drafts): SideChat's recovery now hands text back through main's `restoreDraftTo` (the per-slot draft store) for the originating slot, so the unmount park and the `sideHandBackText` reducer this PR added are gone; `acceptOrThrow` keeps main's `sendResponseAuthRecovery` beside it.

Fix-up: SelectToAsk's wrong-slot restore test rejects with an ApiError (a refusal, which hands text back) rather than a raw Error after dispatch (delivery unconfirmed, bubble kept).

UX round: a composer submit's refused row uses the `_restored` framing (says the text is back; trailing sentence end stripped from the reason so a sentence-shaped reason does not close twice), a chip send keeps the plain framing; `delivery_unconfirmed_option` says "the conversation above" like its sibling (en + en-XA regenerated; other locales already did).

UX round (head 0c12193): SideChat composer-submit refusals use the `_restored` framing like ChatEmbed (a pre-filled box with no word about it read as the user's own typing); the scoped-api permission denial names the app and where the grant lives (`AppApiPermissionError.appName`, `app_not_allowed_to_send_named`, 12 catalogs); captures re-taken.

Scope (reviewer decision, option (a)): this PR is the transport-wire change only. The ChatInput composer swap (#8631) that was folded into this branch on 2026-09-05 is removed again -- ChatEmbed keeps its own single-line `<input>` composer, the shared recovery join is flattened to a space for it, and the chat-settings `useChatConfig` consolidation that rode along with the swap is dropped too. #8631 lands as its own PR. Screenshots re-captured on this head (temp-screenshots/chat-embed-send-receipt/, side-chat-send-receipt/).

Review round on 754a423: `retireSendTail` replays later restores with the caller's merge (ChatEmbed's flattens the paragraph break for its single-line input; the replay used the raw rule and wrote the newline back -- GPT/Opus finding). The AbortError-as-indeterminate idiom is documented on `SendWire` and spelled once as `indeterminate()`; `AppApiPermissionError.appName` is required and the unreachable nameless key/branch are gone; ChatEmbed's dead `transport-error` clause is dropped; SideChat's over-limit hint stays on main's ErrorNotice path (the relabel was a rider).

Review round on 06f4a08: `retireSendTail` takes the merge as a required parameter (one caller); `AppApiProvider` gains `appDisplayName` (AppHost passes the manifest display name) so the permission-denied row names the app as the user knows it, not by id; a non-JSON refusal body (proxy 502 page, bodyless 413) yields a reason carrying the status (`server_refused_with_status`, 13 catalogs) instead of falling through to "check your connection" (Opus); ChatEmbed's live region announces only the newest tail; SideChat's standing unconfirmed notice reads at body weight.

Review round on 8c1ea3b: SideChat's over-limit hint is back in its own plain-text state (AUTOSDE `errors-use-error-notice` -- GPT blocked the ErrorNotice revert the previous UX/FP round asked for), rendered at body weight; the `SendWire` doc names the dashboard wire's exemption from the indeterminate rule and why; the non-JSON refusal copy ends with an action.

Review round on 254bb42: an idle SideChat send whose receipt is `response-late` now rolls its optimistic bubble back and hands the text back under the standing unconfirmed notice, like every other late send -- the panel has no slot poll that could ever clear a `pending` the server never confirmed, so keeping the bubble left it busy for good (GPT). Tests mock `api.kirocrewConfig` now that SideChat's footer (#9609) loads it.

Review round on 5d66d30: design-critique's bare-fetch wire rejects with `indeterminate()` on a raw fetch failure (a reset after the gateway took the POST must not become a retry-safe `transport-error` that runs the critique twice -- Opus); the poll settles it.

Review round on 1516c1b: the RFC status table no longer says #8599 carries #8631 (split back out 2026-09-10; #8631 re-lands as its own PR); `server_refused_with_status` no longer restates the row's frame ("The server rejected it (HTTP <status>) — try again in a moment.").

Review round on 78d5006: `SendTail.seenCount` (and `PendingEmbedRecovery.tail.seenCount`) had three writers and no reader -- retirement matches `meta.sendId` alone -- so the field, its `messageCountRef` feeder and the stale positional-gate comments are deleted (first-principles). `designCritiqueApi.send` no longer tests `transport-error`: `critiqueSendWire` converts every rejection to `indeterminate()`, so that status had no producer there. Two tests updated for main's P5-e virtualized transcript (`scrollToBottom` through the list ref, not a `scrollIntoView` sentinel) and for `mintSendId` living in `chat-core/transport` (module mock spreads `importOriginal`).

Review round on dcacaf6: ChatPane's `doSteer` still minted its sendId inline; it now calls the shared `mintSendId()` like every other send path (first-principles), so the description's "one minter" claim holds.

Review round on 5b9615a: the embed hand-back buffer is keyed by app AND slot (GPT, security-fenced) -- two apps can embed one slot, and a receipt parked by one carried that app's user's text into the other's composer while deleting the only copy. `useAppInfo().name` supplies the app; `embedSendRecovery.test.ts` pins the isolation.

Review round on 1a0c25e: design-critique's follow-up poll accepted the slot's latest assistant row, which on a shared thread slot is the PREVIOUS answer -- so a send the wire reports as indeterminate (rejected before headers, never landed) was "answered" by it and persisted under the new question (GPT, data-corruption class). `pollForText` now takes the pre-send row count and accepts only a row appended after it; a send that never landed runs to the existing timeout. Pinned in the coverage test.

Review round on 883d44a: mochi's ChatPanel rendered an UNCONFIRMED send in ErrorNotice (GPT; errors-use-error-notice) -- it now goes to a role=status line the next send clears, like SideChat's. `AppApiError` was a second spelling of `ApiError` (status + body text, same message); the scoped helper now throws `ApiError` and the wire reads `.body` (first-principles).

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rebased onto main fddab6f8 on the author's behalf (maintainer rebase, commits and authorship preserved; still one commit, head 7cc67a6d22).

Conflicts resolved in:

  • website/src/pages/chat/SideChat.tsx — main's over-limit lengthHint (warn strip, data-testid, question_too_long_with_paste, cleared in onDraftChange) replaces this branch's equivalent validationHint; the per-slot sendStatus standing notice is layered on top of it.
  • website/src/components/ChatPane.tsx — kept main's paste-token expansion in the steer path; only the inline sendId minter became mintSendId().
  • website/src/app-sdk/useChatSession.ts — import merge (main's ensureChatFolder + the wire imports).
  • docs/feature-map/README.md — kept main's new Crew log row, applied the sideTurnWire.ts note to the Side chat row.
  • 13 locale catalogs (en.manual.json, en-XA, bn, de, es, fr, hi, it, ja, ko, pt, ru, zh-CN) — main's value for paste_token_url_or_raw_token and its new model_auto_jev_description kept; accepted_body_unreadable stays in alphabetical position in api.client, delivery_unconfirmed_option appended at the end of pages.chatPage.

Semantic fixes:

  • SendWirePayload.steer widened to boolean | 'auto' to match main's api.sendChat / SendTurnOptions.steer (typecheck failure otherwise).
  • SideChat's receipt hand-back (refused / response-late / unknown) now restores a collapsed paste as its token + block via restoreSideChatDraft, the rule main's onError already applied, instead of the expanded text (SideChat.pasteSidecar.test.tsx red otherwise).

Verified locally: npm run typecheck clean; vitest on every test file this PR touches plus the whole src/i18n suite: 69 files / 2126 tests pass; supplementary run of the SideChat / ChatPane / ChatPage steer / Mochi / AppHost / design-tweak / chatSlice suites covering the touched modules: 43 files / 510 tests pass (the two paste-sidecar cases fixed above included).

Shared files with sibling PRs being rebased in the same wave: website/src/api/client.ts, docs/feature-map/README.md, en.manual.json + the 13 locale catalogs (with #11092, #9367, #12787) — kept additions self-contained per file ordering.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes: the scoped App SDK JSON helpers change their public error types

The receipt work is fine. The problem is createScopedApi, the client behind useAppApi(). Installed apps get the same client, because website/src/app-sdk/shared-modules.ts hands them the host's live @kirocrew/app-sdk. Its JSON helpers now wrap every failure that happens after a 2xx:

website/src/app-sdk/scopedApi.ts:162-175

try { text = await res.text() } catch (e) { throw new AcceptedBodyUnreadable(e) }
...
try { return JSON.parse(text) as T } catch (e) { throw new AcceptedBodyUnreadable(e) }

That goes against the published contract, and the PR does not update it:

  • docs/app-kit/api-reference.md:85-86: "Network, abort and successful-response JSON parsing failures retain their original error types."
  • The AppApiError type doc at scopedApi.ts:43 is unchanged: "Network, abort and JSON parsing errors retain their original types."

AcceptedBodyUnreadable is not exported from app-sdk/index.ts or from public/vendor/kirocrew-app-sdk.mjs, so an app cannot catch it by type.

Failure scenario. docs/app-kit/migration-guide.md:97 still tells authors to write api.post('/api/chat', {message, slot}). That bare endpoint answers with SSE, so on main the helper throws SyntaxError. The natural way to handle that is the pattern ChatEmbed and design-critique use on main:

.catch(err => { if (err instanceof SyntaxError) return; throw err })

With this PR, every successful send from an app written this way rejects with AcceptedBodyUnreadable ("The server accepted the request, but its reply could not be read."). A turn that was delivered is then reported as an error or becomes an unhandled rejection, and the user is likely to resend. A narrower case: code that filters on e.name === 'AbortError' now gets the wrapper when its signal aborts while a 2xx body is being read.

Who is affected. Installed App Kit apps that check for SyntaxError, TypeError or AbortError from a JSON helper after a 2xx. The PR converts every in-tree caller, and appSdkScopedApi.test.tsx:215-219 pins the new type. Apps that do no type check already got an error on main and still get one.

Smallest fix. Keep the tagging inside the send wire, which is its only scoped-API consumer. For example, appSendWire.ts can call api.raw(APP_SEND_PATH, …) and wrap its own body read and parse, which leaves jsonFetch identical to main. Another option is to rethrow the original error with a marker so it keeps its type. If the new type is meant to be public, export it from the barrel and the vendor stub, and update api-reference.md:85-86, scopedApi.ts:43 and docs/system-specs/modules/app-kit-platform.md:27-29 in this PR.

From a full open-PR audit against origin/main c66f95b (2026-09-25); findings were checked by independent reviewers reading the code. Reply here if this is wrong.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Open-PR triage (origin/main af1eb612da, head 7cc67a6d22): REBASE + CONTINUE-DEVELOPMENT, not superseded

  • Main still has the bug. On main, website/src/app-sdk/ChatEmbed.tsx:231-234 still posts to bare /api/chat and treats SyntaxError as success. useChatSession.ts:109 still seeds over bare /api/chat. sendTurn.ts has no SendWire, and none of appSendWire.ts, sideTurnWire.ts, receiptCopy.ts, embedSendRecovery.ts or embedSendTails.ts exist on main. #8631, #8655 and #9587 show as "merged", but they were merged into this PR's branch (feat/chat-core-p2-embed), not into main. Only #9576 (issue-radar/auto-improvement seeds) reached main, and it does not touch these files.
  • Stale. The branch is 1,713 commits behind main. git merge-tree reports 24 conflicting files: api/client.ts, store/chatSlice.ts, components/ChatPane.tsx, pages/chat/ChatPageMessageContent.tsx, the Mochi panel/bridge and its tests, docs/feature-map/README.md and all 13 locale catalogs. Please rebase.
  • Still blocking on this head: @bolichen97's 2026-09-25 CHANGES_REQUESTED. The scoped jsonFetch change (scopedApi.ts:162-175, AcceptedBodyUnreadable) changes the public App SDK error types. docs/app-kit/api-reference.md:85 and scopedApi.ts:41 on main still promise the original types. I agree this is a breaking change. I'm not filing a duplicate review.
  • Overlaps to coordinate (complementary, not duplicates):
    • #10876 rewrites the same ChatEmbed composer block (<input> → auto-grow <textarea>), while this PR rewrites the send path in the same component.
    • #15720 edits createScopedApi's fetch line (relocateRequestUrl) and design-critique/api.ts, design-tweak/api.ts and mochi/panel/panelBridge.ts, which this PR also changes.
    • Agree on a landing order with those authors to avoid a third rebase.
  • First-principles BLOCK still applies: 22 PNGs force-added under temp-screenshots/, which is gitignored at .gitignore:120, a channel #12322 removed repo-wide. Please drop them from the commit and attach them to the PR instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge conflict Branch has merge conflicts with its base — author must resolve before merge needs-author-decision PR blocked on author input

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants