Repository navigation
feat(chat): draw session_send messages as cards naming the sender - #25470
Conversation
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: |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The sender comes from fields the gateway sets, and the receipt mechanism reuses Notes
[DESIGN-REVIEWED] 72b4d42 Description read[DESCRIPTION-READ] e1b15423bb72bfc30f998ce68d13dd30e315197af9c5305b68a5d2877ba49599 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The sender now comes from a Notes
What this change shipsInventory (10 items) — 9 justifiedIntent: a person reading a session's transcript sees which session really sent each peer message and can open it, and sees their own delivered
[FIRST-PRINCIPLES-REVIEWED] 72b4d42 Description read[DESCRIPTION-READ] 257805bb74482572b925dc578048ab712354bad43d758f1b0f451be7d6b05689 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS No blocker. The reader identified both primary controls correctly. The doubts were about the sample names, the side of the screen each message sits on, and wrapping of extreme-length names. Notes
[UX-REVIEWED] 72b4d42 Description read[DESCRIPTION-READ] 833dc07cbbe25fa46650ee7322ca822c90fba64e0b4574468223e10b15eca044 That sha256 names everything this verdict read: the PR description, plus the 9 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: |
c1db9d2 to
22b0eb5
Compare
|
self-added: no
|
22b0eb5 to
5bf42db
Compare
|
self-added: no
|
|
self-added: no
|
|
self-added: no
|
|
self-added: no
|
|
self-added: no
|
a3c9347 to
b6264ac
Compare
b6264ac to
787c7c0
Compare
787c7c0 to
f4af7e3
Compare
|
Holding for human review at The PR still adds a gateway-trusted sender identity: What I checked: a forged AI findings judged non-blocking:
To clear: a maintainer confirms the sender-identity and ingress-strip change. — crew-pr-reviewer (r142) |
bolichen97
left a comment
There was a problem hiding this comment.
Thanks for this. Carrying the sender as a gateway-set meta.relay field, reserving relay at POST /api/chat ingress, dropping it on queue edit, and keeping it only when every merged entry shares one sender are all good structural choices. I read every non-locale, non-test hunk at f4af7e3 (backend delivery, steer, queue, drain and ingress paths, plus the frontend relay, card, avatar, store and renderer changes). All 95 checks are green on this head.
Requesting changes for one reason: two parts of the solution still rely on regex over message text, and this repo does not take new regex-based parsing for this kind of decision. Please replace both with structured data.
-
website/src/pages/chat/sessionRelay.ts,SEND_RESULT_RE. Whether asession_sendrow draws as the outgoing "Sent to @recipient" card, and which slot key the card links to, is decided by matching the human-readable success line of the tool result (emoji, "Steered" / "Delivered to" / "Queued for", backticked key). That couples the UI to prose wording: any rewording or translation of that line silently turns the card back into a tool line, and the delivered key is scraped rather than read.store/chat/activity.tsuses the same match to decide which live tool output to copy. Suggested approach: have the gateway return the outcome and the resolved slot key as typed fields (for example structured content on the tool result, or meta the gateway stamps on the tool row), and read those fields with an exact key lookup. -
website/src/lib/crewSeed.ts,SEED_LINES_RE. This widens the existingSEED_REto a global multiline pattern and strips every line-start[sent by session ...]line from a relayed row's body. That is marker detection by regex over free text. Since the gateway now proves the delivery throughmeta.relay, it also knows exactly which envelope lines it prepended. Suggested approach: keep the display body separate from the model-input envelope on the row (for example store the body, or each merged send's body, in meta when the row is written), so the bubble renders that body directly and nothing needs to be stripped from text.
Smaller, non-blocking: SenderAvatar.tsx checks color_hex with a hex regex; if the slot row already carries a validated color, reading it as is would be enough.
Regex this PR does not touch is out of scope for this request. Happy to re-review once the two spots above read structured fields.
bolichen97
left a comment
There was a problem hiding this comment.
Thanks for the update. The point from my last review is still open on d85e348: both regexes that parse message text are still in the diff.
website/src/pages/chat/sessionRelay.ts:SEND_RESULT_RE = /^\s*\u{1F4E8}\s*(?:Steered|Delivered to|Queued for)\s+([^\n]+)/u`, run on the tool's result text to pick the card and its slot key.website/src/lib/crewSeed.ts:SEED_LINES_RE = new RegExp(SEED_RE.source, 'gm'), which widens the seed regex to strip envelope lines on every line of a relayed row.
This repository asks for structured data instead of regex over text. The receiver side already reads the gateway-set meta.relay in readRelay, which is the right shape. Please do the same for the other two:
- The sender's card: read the delivered target slot from a structured field of the
session_sendtool result, such as a typed result field or the call'smeta, not from the success prose. - Stripping seed lines: have the gateway record which leading lines of the delivered text are envelope lines, or store the payload apart from the envelope, so the dashboard removes them by position, not by pattern.
Frontend Tests (1) and (4) are red on this head, along with Frontend Coverage Merge and Coverage Gate. The failing tests are ChatPage.dirStaging, ChatSidebar.selectorScope and ArtifactsPageCoverage. I have not judged whether these come from this change; I will look again on the next head. All five AI review lanes pass, and KiroCrewCaptain's auto-merge is left as it is.
|
|
|
|
bolichen97
left a comment
There was a problem hiding this comment.
Thanks for the rework. Re-checked at 0f6714a.
Fixed:
SEND_RESULT_REandSEED_LINES_REare gone.- The sender now comes from the gateway-set
meta.relayfield, not from the message text. relay_spans.pyrecords the envelope positions as[start, end)spans inmeta.relay.envelope, and the dashboard drops exactly those spans. The spans are found with an exactstr.findof the rebuilt envelope, with no pattern matching. That is the shape we asked for.
One small thing left (same rule): the new senderInitials in website/src/lib/crewSeed.ts parses the title with two new regexes, split(/\s+/) and replace(/^[@#]+/, ''). Our rule is no new regex for parsing text, even small ones. A short loop over code points would do the same job: split on whitespace with Array.from(title) plus a whitespace check, then skip leading @ and # characters by comparing exact characters.
CI is still running on this head (25 checks pending). I'll re-check once that change is in and CI is green.
|
A message one session sends another (session_send / session_broadcast) draws as a card naming its sender instead of a raw "[sent by session ...]" user bubble, and the sender's own session_send call draws as the outgoing card with the recipient as an @tag. The sender comes from meta.relay, which only the gateway's delivery path stamps (session_messaging, session_deliver, chat_slot, chat_delivery, queue_drain), never from the message text, so a peer cannot forge it by typing the envelope. Rows without meta.relay draw as before.
… sender
The outgoing card says its direction in text ("This session · Sent to
@Planner") instead of an outlined avatar and an arrow badge, and both
cards show the row time.
The outgoing card is drawn only for a session_send that delivered, and
both facts come from the gateway as data, never from the tool's result
text. When the session_send tool asks for one (receipt: true),
POST /api/session-control/send parks a receipt ({outcome, target}) for
the calling session under a digest of the target and message it was
sent (session_send_receipts, a directive_queue.Store of its own, keyed
by call_input_digest); the caller's turn claims it by the same arguments
of the session_send call it saw (named by its _meta identity, its
permission request or the backend's wire title; Codex and Tool Search
argument wrappers unwrapped), on that call's completed result, and
stamps it
on the call's own rows as meta.sessionSend (live tabs get it as a
chat_message_update patch). A failed call retires any receipt its
request parked. A call still running, refused, rejected or denied, or a
row from before the receipt, stays the tool line, and the
@tag opens the slot the gateway resolved, not the alias typed.
meta.relay is now gateway-only: api_chat drops it from request meta
(RESERVED_ROW_META_KEYS), so a caller cannot show its text as another
session's. It records where the provenance line sits in the delivered
text (meta.relay.envelope, UTF-16 spans), so the bubble drops it by
position. A drain merging one sender's queued sends rebuilds one span
per send, and the queue_pop frame rebuilds its own; a row without spans
shows as before. A peer's steer carries relay on the live steer_push
frame and onto its requeued queue entry, and a steer still waiting,
requeued or taken back keeps the ordinary bubble that shows that state.
Editing a queued peer send drops its relay, since the new words are the
editor's.
The card drops surface nothing here uses: the needsYou pill and its
string in every catalog, the agent and runName meta, and the
isAnySessionSendTool export.
|
@bolichen97 re your review on f4af7e3, both points addressed at
The |
|
@bolichen97 re your review on d85e348, at
The tests that fail without each change are listed in my reply to your first review above. The three frontend failures you saw on d85e348 ( |
|
@bolichen97 re your review on 0f6714a: |
bolichen97
left a comment
There was a problem hiding this comment.
Approving head 72b4d42. This head fixes the one point left open in my last review.
- The gate shows 97 checks passed, none red, none pending, and no change requests from other reviewers.
- My last review asked to replace the two
senderInitialsregexes with a loop over code points. The newsenderInitialsin crewSeed.ts does that: it walksArray.from(title), splits onch.trim() === '', and skips leading@and#by exact character comparison. I searched the saved diff for the earlier namesSEND_RESULT_REandSEED_LINES_REand forre.compile,new RegExp,split(/andreplace(/, and found no hits in product code. The earlier fixes (sender frommeta.relay, envelope removed by recorded spans) were already confirmed at the previous head. - The new tests for
senderInitialscover two words, one word, a handle, whitespace only, an emoji-first title, tabs and non-breaking spaces.
The existing auto-merge on this PR was set by someone else, and I have left it as it is.
Problem / Motivation
Goal: Every message one Crew session sends another (
session_send/session_broadcast) names its real sender, taken from gateway-setmeta.relay, not from the message text; and the sender's ownsession_sendcall reads as a sent message, not a raw tool line.Why it matters
The receiver's bubble already drops the
[sent by session …]line and says "From conductor / From a crew member / From another chat" (lib/crewSeed.ts,UserMessage.tsx), but it does not say which session, gives no way to open it, and reads the sender key out of text a peer controls. The sender's own transcript shows the call as a generic tool line.Not a goal
[sent by session …]envelope the model reads. It is kept intact.What changed (motivation → approach → change)
Receiver: the existing user bubble and its "From …" label stay the one renderer and the one sender label. On a row carrying
meta.relay, the label adds the sender's initials and title, the title an underlined accent link that opens that session, with the tooltip "Open Slack Code" ("FROM ANOTHER CHAT · SC Slack Code"). The sender ismeta.relay.senderKey, never the key the line spells. The[sent by session …]line is dropped from the body by position, never by matching text: the gateway records where it wrote each one asmeta.relay.envelope,[start, end)spans in UTF-16 code units (dashboard/relay_spans.py), andwithoutRelayEnvelopeinpages/chat/sessionRelay.tscuts exactly those. A merged drain of one sender's queued sends gets one span per send, rebuilt by the drain for the row it writes (and for thequeue_popframe); a row with no spans, written before this field, shows as it always did, through main'sparseSessionSeed, and a person's own row is never cut. A host with no session roster or opener (a peer's Crew window, the SDK registry) shows the label alone. The avatar (pages/chat/SenderAvatar.tsx) wears the colour the person gave the sender session in the sidebar (itscolor_hex, else itscolor_indexin the current palette fromutils/sessionColors), and is neutral for a session with no colour; there is no second per-session colour.Sender: its own
session_sendtool row draws as the outgoing card, which says its direction in words: "This session · Sent to @Planner", the@Plannertag opening the recipient (tooltip "Open Planner"). Both facts the card states, that the call delivered and which slot it reached, come from the gateway as typed fields, never from the tool's result text. Thesession_sendtool asks for a receipt (receipt: trueonPOST /api/session-control/send); the route parks{outcome, target}for the calling session undercall_input_digestof thetargetandmessageit was sent (dashboard/session_send_receipts.py, adirective_queue.Storeof its own: the directives' out-of-band mechanism, kept apart from their records becausedirective_queue.discardretires a whole session bucket and a directive claim reports every record it passes over as a miss). The caller's turn digests the same two arguments of thesession_sendcall it saw (the_metaidentity, the permission request or the backend's wire title names the call; Codex and Tool Search argument wrappers are unwrapped; a send naming acrewis left out, since another gateway delivers it), and on that call's completed result claims the receipt and stamps it on the call's own rows asmeta.sessionSend(chat_turn/tool_results.py); open tabs get it as achat_message_updatepatch. A failed call retires its receipt, so a refused retry cannot wear it. The card appears as soon as that patch lands. While the host withholds its session roster (the gateway is disconnected) the tag is plain text, the same gate the body's session chips use. It appears only for the gateway's ownsession_send(served bykirocrew-dashboard) once it delivered. A call still running, refused, rejected or denied, or a same-named tool from another MCP server, stays the ordinary tool line, and the@tagopens the slot the gateway resolved (meta.sessionSend.target), not the name the call typed. A row from before the receipt existed stays the tool line.Where
meta.relaycomes from: only the gateway's delivery path stampsmeta.relay = {senderKey, via, envelope}(session_control_parts/session_messaging.py,session_deliver.py,state_parts/chat_slot.py,chat_delivery.py, withchat_turn/queue_drain.pydropping it when a merged row mixes senders, compared by sender alone so one session'ssession_sendandsession_broadcaststill merge under its name).POST /api/chatdrops a caller-suppliedrelaywith the other gateway-minted keys (RESERVED_ROW_META_KEYSinchat_handlers.py), so no caller can show its text as another session's. Live rows carry it too: a peer's steer on thesteer_pushframe (read inhooks/websocket/chatStream.ts) and onto its requeued queue entry, and a drained queued peer send on itsqueue_popframe (queue_drain.py, rebuilt instore/chat/queue.tsthroughqueueEntryRelayinstore/chat/wire.ts, from the frame only). Editing a queued peer send drops itsrelay(slot_queue_repository.py), since the new words are the editor's. A message the person typed, and older history, has nometa.relayand draws as before.Frontend:
pages/chat/UserMessage.tsx(the label, plussessions/onSessionOpenprops wired frompages/chat/page/transcriptRendering.tsxandpages/chat/transcriptRenderers.tsx),lib/crewSeed.ts,pages/chat/SessionMessageCard.tsx(outgoing only),pages/chat/sessionRelay.ts, one entry inpages/chat/transcriptRenderers.tsx, strings in every locale catalog (i18n/locales/en.manual.jsonand its translations). A peer's Crew window draws the outgoing row through the store-free default (pinned intest/CrewChatWindow.test.tsxandtest/chatRolesParity.contract.test.ts). The feature map gains a row.Stack
Split out of #25395, which was over the 1 MB review cap. Merge bottom-up. Only a PR based on
maingets CI (ci.ymlandfast-gate.ymlrun onpull_request: branches: [main]), so each stacked PR is rebased ontomainonce the one below it merges. A and the B1a protocol PR do not depend on each other. C2's UI uses A's card, so C2 carries A's commits until A merges.feat/kas-wf-1-session-cardsmainfeat/kas-wf-2-backendmainfeat/kas-wf-2b-enginefeat/kas-wf-2-backendfeat/kas-wf-2c-dashboardfeat/kas-wf-2b-enginefeat/kas-wf-3-person-holdsfeat/kas-wf-2c-dashboardfeat/kas-wf-4-frontendfeat/kas-wf-3-person-holdsfeat/kas-wf-4b-frontend-uifeat/kas-wf-4-frontendBackwards compatibility
Compatible: the
[sent by session …]prefix is still written and still what the receiving model reads; only rows carrying the newmeta.relaychange how they draw, and the "From …" label reads as before. Rows written beforemeta.relay.envelopeormeta.sessionSendexisted draw exactly as onmain.POST /api/session-control/sendgains an optionalreceiptfield; a caller that omits it is unchanged.Removes nothing: no key, route, setting or public function is removed or renamed.
Tests
test/test_session_send_receipts.py: the route parks a receipt only when the tool asks for one, and the tool asks; the real_run_chatstampsmeta.sessionSendon a deliveredsession_sendrow and patches open tabs, and stamps nothing for other arguments, a failed call, another server's tool or a refused retry of a failed call; a KAS call named only by its wire title with Tool Search-wrapped arguments still gets its card, and a server-qualified tool name is stamped canonical so the card draws; acrew-qualified send (delivered by another gateway) never registers or takes a local receipt; a permission request that names the call registers it; receipts share the directive mechanism but survive a directivediscard;relay_spanscounts UTF-16 units and rebuilds spans rather than trusting stored ones.test/test_session_control_send.py:meta.relay(with its envelope span) on the idle-run row, the queued entry, the consumed-steer row, the livesteer_pushframe, a requeued steer's queue entry and a drained entry'squeue_popframe (only a well-formed record rides it, with spans rebuilt for the popped text); an edited queued peer send loses it; a merged drain keeps one sender acrosssession_sendandsession_broadcast, with one span per send covering exactly its line, and drops it for two senders.test/test_chat_send_client_meta_survival.py: a caller-suppliedmeta.relayis dropped at ingress (echo, live row, disk, fetch).test/test_mcp_dashboard_session_send.py: the tool's request carriesreceipt: true.test/test_state_parts_facade.py: the pinned_ChatSlot.enqueue_or_run_promptsignature gains therelay_metakeyword.test/UserMessage.sessionSeed.test.tsx: the label names the sender title (an underlined accent link with an "Open …" tooltip, bubble-coloured on the accent bubble, and initials by code point, so an emoji title stays whole) frommeta.relay, not the key the line spells; a merged drain loses each send line at its recorded span; a body line that only looks like an envelope stays; a row with no spans shows as before; a person's own row is never cut; no roster or opener, or nometa.relay, leaves the label alone;senderInitials.test/SenderAvatar.test.tsx: the avatar wears the sender session's custom colour or palette colour, and is neutral for a session with no colour or a host with no store.test/chatSlice.sessionSendReceipt.test.ts: the receipt patch makes the row the outgoing card linking the resolved key; the live tool result's success text does not.test/chatSlice.queuePopRelay.test.ts: thequeue_poprebuild keeps a validrelay, drops a malformed one, and copies only the sender fields.SessionMessageCard.test.tsx(the visible "This session · Sent to @…" line, the tag's "Open …" tooltip, the tag bounded to the card for a long title, no avatar, clamp, link vs plain),sessionRelay.test.tsx(helpers, including the envelope spans and the receipt read by exact key; the success prose alone, a running or refused send, and another server'ssession_sendstay the tool line; Codex and Tool Search wrappers are unwrapped only for the gateway's tool; a relay row uses the ordinary user entry; an alias-addressed send links to the resolved key; with no roster the tag is plain text),UseWebSocketCoverage.activity.test.tsx(the live steer row keeps a validrelay).tsconfig.app.json), eslint over the changed files, i18n:check, black, mypy oversrc/kiro_crew; vitest oversrc/pages/chatand the user-message, queue, receipt, Crew window and roles-parity suites; pytest over the session-control, session-send, queue-drain, directive, steer and chat-runner suites (about 2,900 pass). Each new test was run against the previous code and fails there.Proof: not provable -- other: feature PR, not a fix; each behaviour has its own test named above.
Manual verification
Rendered the receiver's row through the real
UserMessagewith the props ChatPage passes (session roster and opener) and the sender's row through the realsession_send_tooltranscript entry, in a capture page, dark and light, with a long message clamped on the outgoing card. The outgoing meta line is the row time the renderer passes.Screenshots / video
Received (another session's message, top) and sent (this session's own
session_send, bottom), light:The same pair, dark:
Two long messages: the received bubble in full, and a different sent message clamped to two lines with Show more:
The same sent card after Show more, expanded with Show less:
While the gateway is disconnected (the host withholds its session roster): the received bubble keeps the label alone, and the sent card's
@Planneris plain text, not a link:A 320px column with 200-character unbroken titles (the rename cap) on both sides: the sender link and the
@tagwrap inside the bubble and the card (the capture script also checks each box in the browser):Related Issues
N/A — no tracking issue, by the owner's choice.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)