Agent chat: centralize agent-message bodies and recorded sends

Merged
TE
8d ago
+1379-67

Bash sends whose message came from an earlier recorded file write expand to that message as Markdown, with Raw below it. Sent and received messages share the same Markdown renderer.

Leo: "we need to have these more centralized ... account for cases where formatting gets a bit fucked up by agent messages sent back and forth" and "we don't need to see all this shit with the whole ... sending messages back and forth".

The viewer never reads a host file. It accepts immutable bytes only from a preceding, successfully completed quoted heredoc captured in this turn. Mutation, overlap, failed/unended writers, remote path boundaries, unsafe redirects and ambiguous execution invalidate those bytes. Repeated read-only sends can use the same captured producer. Observational tools, including structurally parsed MCP read/list/search calls, retain it. A parsed mutating MCP name always invalidates the body, even when its generic ACP kind incorrectly says read, search or fetch.

Wrapper scripts are parsed structurally: a quoted mention of acpmux send is text, while executable sends share one bounded scan. Unresolved nested substitutions propagate ambiguity through wrapper returns. A WeakMap caches parses by immutable tool identity and command revision; unchanged turn replay adds no parsing.

Before / after

Public gallery agent-pane.sent-message-rows, recorded-file, 760×760:

BeforeAfter
Before darkAfter dark
Before lightAfter light

Captures are base 37d1da2ad8683f and earlier rendering head 2280210c529b2d5fa180617b6c64663d19a9fda1; subsequent parser repairs have no new visual surface. No private user images are published.

Verification

Frozen source: 724e5d6f08ea8697882850005a285bf56db059ac, tree 4a93c24bbaed849677670a1a612e83289a04e37a.

Review (codex gpt-6-astra xhigh): SHIP at 724e5d6f08ea8697882850005a285bf56db059ac. Primary inspection confirms that parsed MCP mutations override misleading generic kinds, while genuine reads retain immutable recorded bodies. Earlier review receipts apply only to their recorded heads.

Exact-head fleet run 40667206376 is SUCCESS: the new misleading-MCP-kind regression fails against the old production file, then the final source passes 56 tests / 599 assertions, full web check, web lint, and the prepush gate against actual published history. The runner verifies the source tree and restores its captured HEAD before completion. Receipt: 3004ccac8b354c6fbd8e111f2edbe503 (32 CPUs).

The regression covers read, search and fetch kinds crossed with parsed and structured MCP metadata: write_file, read_and_write and delete_file discard stale content; read_file preserves it. The earlier wrapper red-to-green is recorded in run 40661256705.
The old head’s cmux-next checks fail in tests/test_ios_internal_notes.py and native namespace-type rules in WorkspaceHibernationActionStrings.swift and CloudWorkspaceSetupLocalization.swift; this PR touches none of those files. Release-notary and gallery-health failures are also being reconciled against base. The coordinator confirmed there is no broad web hold: this web-only PR lands once its own four react-apps-check shards pass and remaining reds are base reds. The Swift-only hold on #26809 does not apply to these files.

No native app build was run for this web parser repair.

Changelog

Changed: render captured agent sends as Markdown and preserve recorded bodies through observational tools and safe wrappers.

Agent session: agent session