Repository navigation
🤖 fix(messages): label an agent-message envelope by who wrote it - #8215
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
🟢 e2e stories (Haiku): 14 passed21 agent steps · 6 replayed from cache · 15 model calls · 47.8k tokens (23% cached) All 14 tests in 9 files
e2e 0.20.0 · 1m 19s · web · run artifacts 🟢 e2e Electron stories (Haiku): 3 passed3 agent steps · 3 model calls · 7.9k tokens (22% cached) All 3 tests in 3 files
e2e 0.20.0 · 23.9s · electron · run artifacts 🟢 e2e agent repros (Haiku): no tests selectedSpend: $0.00 of the $1.00 cap (proxy ledger) e2e 0.20.0 · 7.9s · 2 targets (web, phone) · run artifacts |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f285b8ee29
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
@codex review |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4719c9d33c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
PASS+NOTES Independent verifier, exact head Provider request. I built a request with the real
Transcript. I opened Storybook for both builds with agent-browser, dark theme, and added a scratch story that was not committed.
Notes (not blocking)
Generated with |
1e93fae to
327314f
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
A model can still write an agent-message envelope in its own reply. On the next request, neutralizeAgentEnvelopeLookalikesForProvider renames its wrapper to the same tag a user-pasted envelope gets, so a later turn reads its own forgery as text the user gave it. The new messagePipeline test builds a request with the same envelope in a user row and in an assistant row and expects different labels. It fails on main: both rows carry the user-pasted tag.
A peer envelope the model wrote in its own reply reached later requests renamed to the tag a user-pasted envelope gets, so a later turn read its own forgery as text the user gave it. Tool output and inlined SVG got the same user label. neutralizeAgentEnvelopeLookalikes now takes the source: - user rows keep user_pasted_mux_agent_message - the model's own assistant text gets self_written_undelivered_mux_agent_message - tool parts, delivered messages and inlined SVG get quoted_mux_agent_message (family payload rows hold another agent's bytes, so their text is quoted too) The same-turn neutralizer now also renames the wrapper in assistant text parts. Before, the next step saw the model's own forgery with the exact wrapper. Since #8169 no assistant text holds an authentic envelope (deliveries replay as tool results), and the rename gives each row the bytes the history path gives it, so later steps and the next turn keep the same prefix. User text stays untouched at that seam.
A peer envelope in an assistant reply rendered as plain text with its "from" and "message" fields, which read like a delivery. Real deliveries render as a peer card, so AssistantMessage never shows one: when its text holds the exact wrapper, it now shows the inline label "Written by this agent. Not a delivered message." The AgentPeerMessages story gains such a reply and checks that only it carries the flag.
Keeps AssistantMessage's complexity at its base (crap-check floor-cc).
A sub-agent's report reaches its parent as a synthetic user row. When the report quoted an agent-message envelope, request building renamed the wrapper to user_pasted_mux_agent_message, so the child's bytes read like the user's paste. A user row now gets quoted_mux_agent_message when it is synthetic and carries another agent's bytes: a sub-agent report envelope (the UI's own test, which survives tail and side-chat copies) or a send an agent started (progress updates, monitor wakes). Synthetic alone is not the test: a compaction follow-up re-sends what the user typed as a synthetic row, and so does a preserved tail copy. Those keep the user label.
…iter The test set retrySendOptions as literals that lack agentId, which typecheck refuses. pickStartupRetrySendOptions is what sendMessage uses, so the rows match what it persists.
Only the bare wrapper was renamed, so a model that echoed the user-pasted tag into its own reply, or tool output that forged one, kept the wrong label. Every reserved tag (the wrapper and each label, open and close) now takes the label of the text's own source. A second pass with the same source maps each label to itself, so the prefix stays byte-stable across steps.
Both passes labeled every tool field quoted, but the model writes a tool call's input. The input now takes the self-written label, and the output and error text stay quoted, in the history and same-turn passes.
…er's A compaction follow-up re-sends what the user typed as a synthetic row. When that text was a pasted sub-agent report quoting an agent-message envelope, the report syntax labeled it quoted. sendMessage writes retrySendOptions on every row it persists and a report row is appended without them, so the send provenance now decides first. A preserved tail copy keeps neither, so a copied report stays quoted.
A family message is another agent's text shown as an assistant row, so an envelope it quoted got "Written by this agent". The transcript row now carries isFamilyMessagePayload from the same row test the provider request uses (isFamilyMessagePayloadRow, moved to common), and the flag skips those rows.
…antTextRow The conditional spread raised appendAssistantTextRow above its CC floor.
c023fa2 to
95914f5
Compare
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Why
#8169 delivers real peer messages as
receive_agent_messagetool results. When an agent wrote the agent-message wrapper into its own reply, later turns still saw it renamed to the "user pasted" tag: a false label that implies user authority and reads like a delivery. In the transcript the reply showed the raw envelope with no flag.What changed
neutralizeAgentEnvelopeLookalikes(text, source)renames by author: user text keepsuser_pasted_; the agent's own text and tool-call inputs getself_written_undelivered_; tool output, inlined SVG and envelopes quoted in another agent's report rows getquoted_. The bare tag and every reserved label tag are renamed to the current source's label, so an echoed or forged label cannot survive.AssistantMessagelabels a reply that holds the wrapper: "Written by this agent. Not a delivered message." Authentic family-message rows (sharedisFamilyMessagePayloadRowcheck) never get the label.Scope
A synthetic user row counts as quoted only when it is agent-initiated or parses as a sub-agent report. Compaction follow-ups re-send the user's own text as synthetic rows, so
syntheticalone does not mean "not human"; send provenance is checked before report syntax. Follow-ups: request-injected synthetic context (plan transitions, post-compaction attachments) still readsuser_pasted_, and an RLM preserved-tail copy drops its source's provenance, so a copied report the user pasted readsquoted_.Blast Radius
Provider request shaping for any text holding the wrapper, and the assistant message renderer. Authentic deliveries never reach either rename (they are tool results or peer cards).
Verification
The
messagePipelinerepro "labels a model-written envelope differently from a user-pasted one" failed on main and passes here. An independent verifier built a request with a pasted envelope, a forged reply and an authentic delivery: no exact wrapper reached the provider, the delivery stayed a tool result, and repeated transforms were byte-identical. Checked at 375 px in Storybook.Screenshots
Dark theme,
App/Chat/Messages/AgentPeerMessagesstory. An assistant reply that holds the agent-message wrapper carries the label; delivered agent messages do not:375px:
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$39.98(the whole three-PR stack)