Skip to content

feat(dashboard): label cross-chat messages "From <chat>" - #22236

Closed
kyleseaman wants to merge 2 commits into
mainfrom
feat/cross-chat-from-label
Closed

kyleseaman wants to merge 2 commits into
mainfrom
feat/cross-chat-from-label

Conversation

@kyleseaman

@kyleseaman kyleseaman commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

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_broadcast deliver 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

  • The queue card's text for a queued peer message (it still shows the envelope while waiting).
  • Changing what the target MODEL reads: the text envelope (the safety signal) is unchanged.
  • Any new send path or change to delivery semantics.

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).

  • Backend. send_to_target stamps meta.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_push frame (steered, set in chat_delivery), requeued / orphaned-fallback steer (queued). A broadcast adds count: 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_prompt gains row_meta (applied on both arms). The key is added to RESERVED_ROW_META_KEYS so composer meta cannot carry it. The drain drops it from a merged row whose entries name different senders, and queue_edit_by_id drops 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_admissions for the turn-end requeue, so the row that runs still reads From <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_steers releases the record once the echo lands.
  • Frontend. readSendProvenance reads the record; for legacy rows it parses the exact envelope once. Never labelled: rows marked human / turnActor, client-minted bubbles (optimistic, sendId(s), clientTs), a legacy merged row with two envelopes, and the neutralized [quoted: sent by session … form. UserMessage strips 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 draws SendProvenanceLabel above the bubble: From <chat> + · queued / · interrupted the reply / · addressed to N chats (plural keys in all 12 locales). · interrupted the reply shows 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 reads chat-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.
  • Quote. Quoting a peer's message keeps its envelope in the quote the MODEL reads (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 optional author argument rides onQuoteMessage / quoteMessageFor / useMessageQuote.quoteMessage and is passed only when set, so existing callers' call shape is unchanged.
  • No Sensitive Change Review path is touched.

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_push frame, 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.
  • Existing pin changed: test/test_session_broadcast.py::test_a_budget_cancel_does_not_strand_the_steer_bookkeeping asserted _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_steers does 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.
  • Scoped runs: related pytest (~1,900), mypy on the touched modules, black/isort/flake8, tsc -p tsconfig.app.json, eslint, i18n:check (PASS vs origin/main), focused vitest including src/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 session text visible except in the human-typed row; clicking the sender opened Release conductor; no overflow at 320px (the sentence wraps instead of cutting the mode). Re-captured at 4eac8ca for the addressed to N chats wording, with the on-page labels asserted before each capture.

Screenshots / video

Queued, steered and broadcast labels (light / dark):

queued, steered, broadcast - light
queued, steered, broadcast - dark

Legacy row from a closed chat, a typed envelope (no label), and an empty body:

legacy closed, typed envelope, empty body - light
legacy closed, typed envelope, empty body - dark

320px wide

320px dark

Related Issues

no linked issue: requested directly by the maintainer.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributed under the project's Apache-2.0 license.

@kyleseaman
kyleseaman requested review from a team and KiroCrewCaptain as code owners October 19, 2026 17:04
@kyleseaman
kyleseaman requested a review from CrysisDeu October 19, 2026 17:04
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 19, 2026
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 4196b9258d95d618fc539fc83367c5ee5716e8e8 — 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 does not.

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

  • Item 6 — oversized: today, without this item, pre-release rows keep showing the envelope line. To hide that line on old rows only, the change adds a parser that has to stay spoof-proof: LEGACY_ENVELOPE_RE, the mid and turnProvenanceRestored gates, and a hardcoded LEGACY_CUTOFF = Date.UTC(2026, 9, 20). Subtraction: delete the legacy branch of readSendProvenance (everything after the if (record) return). Keep the regex only for withoutLeadingEnvelope. Clears when: the mechanism is removed, or a human amends the Goal.
  • Item 3 — oversized: the Goal's job is the sender's name. "Addressed to N chats" adds the _broadcast_count kwarg, an addressed counter in broadcast_to_targets, the count field, plural and from_broadcast_unknown keys in all 12 locales, and a pluralKeys.json row. Subtraction: delete count and _broadcast_count, so a broadcast reads From <chat>. Clears when: the mechanism is removed, or a human amends the Goal.
  • Item 5 — unjustified move: the only support for hiding "Steered into the running turn" is "(UX review)". No user is named who was confused by seeing it twice. Subtraction: delete the sentProvenance?.mode !== 'steered' guard and keep the badge.

What this change ships

Inventory (10 items) — 6 justified

Intent: let a reader see at a glance which chat sent a cross-chat message into this chat. ADDITION.

  1. A muted "From " line above a peer's bubble — justified
  2. The [sent by session … via …] line is hidden from the bubble, copy, edit and the pinned banner — justified
  3. A mode suffix: · queued / · interrupted the reply / · addressed to N chats — oversized (the count goes beyond the Goal)
  4. The sender name opens its chat; a closed sender reads chat-316 (closed) with its old title as a tooltip — justified
  5. A peer's confirmed steer loses the "Steered into the running turn" badge — unjustified move
  6. Legacy rows are labelled by parsing their text envelope, bounded by a cutoff date — oversized
  7. Quoting a peer message keeps the envelope for the model, and the quote card names the sender — justified
  8. Composer meta can't supply the key; restored or edited queue entries and mixed-sender merges drop it — justified
  9. A written-but-unconsumed peer steer keeps its sender record for the requeued row — justified
  10. An empty delivery shows "No message text" — undeclared

[FIRST-PRINCIPLES-REVIEWED] 4196b92

Description read

[DESCRIPTION-READ] 0392045d102b49eceaf34630339abbaaa0b5b0b08d52478067e62870b539745c

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 4196b9258d95d618fc539fc83367c5ee5716e8e8 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • LEGACY_CUTOFF = Date.UTC(2026, 9, 20) is set before this change has merged or shipped. Any peer row written after 2026-10-20 by a gateway running an older release has no record and fails the cutoff test, so it shows the raw [sent by session …] line and no label. That hits every operator who upgrades later. The fallback stays spoof-safe, but you could tie the cutoff to the release that ships this, or to a marker the gateway writes, rather than a calendar date picked now.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 4196b9258d95d618fc539fc83367c5ee5716e8e8 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • The scroll-to-bottom button sits over the sender link at 320px (shot-05). The reader said: "I'd hesitate, because I might hit the arrow instead." Give the label row clearance from that button, or check that the button can never land on top of the label.
  • from_broadcast_* and closed_sender_name say "chat", but the sidebar the reader saw is headed "Sessions". The reader said: "They seem to mean the same thing under different names." Use the term the sidebar uses.
  • empty_body "No message text" is "very faint" in dark (shot-04), and the reader could not tell "is it an error, or just empty?" Use plain body contrast and a clearer string, such as "Sent with no text".

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 4196b9258d95d618fc539fc83367c5ee5716e8e8 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 4196b92

Verdict parsed from the review's SHA-scoped output markers for commit 4196b9258d95d618fc539fc83367c5ee5716e8e8.

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

@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 Oct 19, 2026
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 4196b9258d95d618fc539fc83367c5ee5716e8e8 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 4196b92

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

@kyleseaman
kyleseaman force-pushed the feat/cross-chat-from-label branch from a244bbd to 2695c8a Compare October 19, 2026 17:18
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 19, 2026
@kyleseaman
kyleseaman force-pushed the feat/cross-chat-from-label branch from 2695c8a to 3f24d4c Compare October 19, 2026 17:45
@kyleseaman

Copy link
Copy Markdown
Contributor Author

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.

queued, steered, broadcast - light
queued, steered, broadcast - dark
legacy closed, typed envelope, empty body - light
legacy closed, typed envelope, empty body - dark
320px dark

@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 Oct 19, 2026
@kyleseaman
kyleseaman force-pushed the feat/cross-chat-from-label branch 2 times, most recently from c191a30 to 743e3a1 Compare October 19, 2026 18:41
@kyleseaman

Copy link
Copy Markdown
Contributor Author

Evidence for head 743e3a1 (label text now "From ", per Kyle). Built SPA on an isolated dev gateway.

queued, steered, broadcast - light
queued, steered, broadcast - dark
legacy closed, typed envelope, empty body - light
legacy closed, typed envelope, empty body - dark
320px dark

@kyleseaman kyleseaman changed the title feat(dashboard): label cross-chat messages "Agent message from <chat>" feat(dashboard): label cross-chat messages "From <chat>" Oct 19, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Oct 19, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 21, 2026
@kyleseaman
kyleseaman force-pushed the feat/cross-chat-from-label branch from 6074cef to 7139c7a Compare October 22, 2026 01:25
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 22, 2026
@kyleseaman
kyleseaman force-pushed the feat/cross-chat-from-label branch from 7139c7a to 4929ac0 Compare October 22, 2026 01:55
@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 Oct 22, 2026
@kyleseaman
kyleseaman force-pushed the feat/cross-chat-from-label branch from 4929ac0 to 639cb20 Compare October 22, 2026 02:32
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 22, 2026
@kyleseaman
kyleseaman force-pushed the feat/cross-chat-from-label branch from 639cb20 to 4eac8ca Compare October 22, 2026 03:10
@kyleseaman

Copy link
Copy Markdown
Contributor Author

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.

broadcast label - light
broadcast label - dark

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 22, 2026
@kyleseaman
kyleseaman force-pushed the feat/cross-chat-from-label branch from 4eac8ca to 268c3ee Compare October 22, 2026 03:59
@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 Oct 22, 2026
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.
@kyleseaman

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #25470, which already labels a session_send message with its sender using the gateway-set meta.relay. Reopen if anything here is still needed.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants