Repository navigation
feat(dashboard): label cross-chat messages "From <chat>" - #22236
kyleseaman wants to merge 2 commits into
Conversation
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Two parts go beyond the frozen Goal ("shows who sent it"): the legacy text-parse fallback and the broadcast count. One existing badge is removed with no named user failing. Notes
What this change shipsInventory (10 items) — 6 justifiedIntent: let a reader see at a glance which chat sent a cross-chat message into this chat. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 4196b92 Description read[DESCRIPTION-READ] 0392045d102b49eceaf34630339abbaaa0b5b0b08d52478067e62870b539745c That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the gateway stamps the sender record where the message is delivered, keeps it off composer meta, and drops it from mixed-sender merges, edited entries and restored queues. Old rows fall back to reading the envelope text. Notes
[DESIGN-REVIEWED] 4196b92 Description read[DESCRIPTION-READ] e5417aaabcae725eef65304ebc44a6cd09109e1d9993b81c6dfff9a8eba3723e That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS No blocker: the blind reader identified the "From " label and the link to the sender correctly in every variant. The remaining issues are wording and overlap. Notes
[UX-REVIEWED] 4196b92 Description read[DESCRIPTION-READ] 67d0a70d0fa89d2385966a7a26d0e11033fa4c16e5631ac44af33e265f300988 That sha256 names everything this verdict read: the PR description, plus the 8 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
a244bbd to
2695c8a
Compare
2695c8a to
3f24d4c
Compare
|
Evidence for head 3f24d4c (UX review round 1: "interrupted the reply", visible "(closed)", solid underline, empty-body state). Built SPA on an isolated dev gateway. |
c191a30 to
743e3a1
Compare
|
Evidence for head 743e3a1 (label text now "From ", per Kyle). Built SPA on an isolated dev gateway. |
6074cef to
7139c7a
Compare
7139c7a to
4929ac0
Compare
4929ac0 to
639cb20
Compare
639cb20 to
4eac8ca
Compare
|
Evidence for head 4eac8ca: a broadcast now reads "From · addressed to N chats" (N counts the existing sessions it named, not the ones it reached). Built SPA on an isolated dev gateway, Chromium, 1280px; the labels on the page were read and asserted before each capture. |
4eac8ca to
268c3ee
Compare
A message another chat delivered (session_send / session_broadcast) rendered
as an ordinary user bubble opening with the raw "[sent by session … via …]"
envelope. The bubble now hides that line and a muted, text-only label sits
directly above it: "From <chat> · queued", "· interrupted
the reply" for a steer, "· addressed to N chats" for a broadcast.
Backend: the delivery path stamps meta.sendProvenance {from, title, via,
mode, count} on the row it writes, on every arm (idle run, queue entry and
its drained row, steered row and steer_push frame, requeued steer, orphaned
steer fallback, broadcast). The key is reserved on composer client meta, and
a merged drain row that mixes senders drops it. The text envelope the target
model reads is unchanged.
Frontend: readSendProvenance reads the record, and falls back to parsing the
exact envelope on legacy rows. A row the gateway marks as human- or
app-typed, or a client-minted bubble, is never labelled; a merged row with
two envelopes and the neutralized "[quoted: …" form are not either. The
sender opens its chat when open; a closed one reads "<key> (closed)".
The pinned-prompt banner shows the body without the envelope too.
|
Closing as superseded by #25470, which already labels a session_send message with its sender using the gateway-set |












Problem / Motivation
Goal: A message another chat sent into this chat shows who sent it, as a quiet label above the bubble, instead of a raw
[sent by session … via …]line inside it.session_send/session_broadcastdeliver a peer's message as a user row whose text opens with[sent by session chat-316-1792176321 via session_send]. The dashboard draws it as an ordinary user bubble with that line as its first line: it reads like something the person typed, and the sender is a bare slot key.Why it matters
Conductor/worker setups send many of these. Without a clear label a reader cannot tell at a glance which bubbles an agent wrote, which chat it came from, or that a steer interrupted the turn.
Not a goal
What changed (motivation → approach → change)
Approach: structured provenance written by the one path that delivers, instead of the frontend regex-scraping text (typed text could then pose as a peer).
send_to_targetstampsmeta.sendProvenance = {from, title, via, mode, count?}(send_provenance_meta) on every arm that writes the row: idle run (started), queue entry → drained row (queued), steered row +steer_pushframe (steered, set inchat_delivery), requeued / orphaned-fallback steer (queued). A broadcast addscount: how many existing sessions it named (a name that resolves to no session is not counted). It is not a delivered count, since each row is written as its own delivery lands.enqueue_or_run_promptgainsrow_meta(applied on both arms). The key is added toRESERVED_ROW_META_KEYSso composer meta cannot carry it. The drain drops it from a merged row whose entries name different senders, andqueue_edit_by_iddrops it when a person edits a queued delivery (the words are then theirs). Title is the sender's at send time, sanitized and capped at 200 chars. A peer steer still pending after its RPC (written) holds only its sender record in_steer_admissionsfor the turn-end requeue, so the row that runs still readsFrom <chat> · queued; the rest of the admission (its containment snapshot) is still not held, so that requeue keeps the drain's fail-closed containment floor as before._settle_consumed_steersreleases the record once the echo lands.readSendProvenancereads the record; for legacy rows it parses the exact envelope once. Never labelled: rows markedhuman/turnActor, client-minted bubbles (optimistic,sendId(s),clientTs), a legacy merged row with two envelopes, and the neutralized[quoted: sent by session …form.UserMessagestrips the envelope from what it shows, copies and edits; a same-sender merged row drops each entry's envelope under its[N queued messages merged]header. It drawsSendProvenanceLabelabove the bubble:From <chat>+· queued/· interrupted the reply/· addressed to N chats(plural keys in all 12 locales).· interrupted the replyshows only on a steer the backend confirmed (steerState: consumed); a written or requeued steer names the sender alone. Text only, muted theme colours, no icon or glyph. The sender (solid underline) opens its chat when open; a closed one readschat-316 (closed)with its old title as a tooltip. A delivery with nothing after the envelope shows a muted "No message text". On a peer's confirmed steer the label replaces the "Steered into the running turn" badge, so the interruption is stated once. The pinned-prompt banner shows the stripped body too.quotedPeerText), so another chat's words never arrive as an unattributed earlier message of the user's. The quote card names the sender (author) and leaves the envelope out of its excerpt. The optionalauthorargument ridesonQuoteMessage/quoteMessageFor/useMessageQuote.quoteMessageand is passed only when set, so existing callers' call shape is unchanged.Backwards compatibility
Compatible: one optional meta key, one optional kwarg and one optional trailing quote argument are added; old rows still render (legacy fallback), and the model input of a delivery is byte-identical.
Removes nothing: the envelope text stays in stored rows and model input; only its on-screen rendering changes.
Tests
test/test_send_provenance_meta.py: every arm's row/entry record, steer mode +steer_pushframe, broadcast count (including a broadcast naming one real and one nonexistent target), merged-row drop (mixed vs same sender, with merging on), an edited queued delivery drains with no sender, composer cannot supply the key (revert-checked: removing the reservation or the merge rule fails a test), title bound/sanitize, closed/unknown sender, restored queue drops the record, a written peer steer that is requeued keeps its sender on the row that runs (and holds no containment snapshot), a consumed one releases the held record.test/test_session_broadcast.py::test_a_budget_cancel_does_not_strand_the_steer_bookkeepingasserted_steer_admissions == {}after the shielded delivery's tail. It now asserts that only the still-pending steer's sender record remains, keyed by a text that is still in_pending_steers, so it strands nothing_pending_steersdoes not.website/src/test/sendProvenance.test.ts,UserMessage.sendProvenance.test.tsx,usePinnedPrompt.test.tsx,chatSlice.queuePopSendProvenance.test.ts,useWebSocket.steerPushSendProvenance.test.ts: label variants, plurals, live vs closed vs unknown sender, legacy row, empty body, multi-line body, same-sender merged row, unconfirmed (written / requeued) steer shows no interruption, copy without envelope, quoting a peer message carries its envelope into the outgoing quote, typed-envelope spoof gets no label. Each fix of the review rounds has a test that fails without it.tsc -p tsconfig.app.json, eslint,i18n:check(PASS vs origin/main), focused vitest includingsrc/i18n.Manual verification
Built SPA served by an isolated dev gateway (fresh data home seeded with rows in the exact persisted shape). Checked in Chromium, light + dark, 1280px and 320px: queued, steered, broadcast(3), legacy-closed and empty-body rows show the right label; no
[sent by sessiontext visible except in the human-typed row; clicking the sender openedRelease conductor; no overflow at 320px (the sentence wraps instead of cutting the mode). Re-captured at 4eac8ca for theaddressed to N chatswording, with the on-page labels asserted before each capture.Screenshots / video
Queued, steered and broadcast labels (light / dark):
Legacy row from a closed chat, a typed envelope (no label), and an empty body:
320px wide
Related Issues
no linked issue: requested directly by the maintainer.
Checklist
Contribution License Agreement
Contributed under the project's Apache-2.0 license.