Skip to content

fix(subagent): strip MessagePart::Image from transcript writes - #6310

Merged
bug-ops merged 1 commit into
mainfrom
fix/6305-subagent-image-filter
Jul 16, 2026
Merged

fix(subagent): strip MessagePart::Image from transcript writes#6310
bug-ops merged 1 commit into
mainfrom
fix/6305-subagent-image-filter

Conversation

@bug-ops

@bug-ops bug-ops commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • TranscriptWriter::append serialized the full Message verbatim to the sub-agent's <task_id>.jsonl transcript with no filtering. Sub-agents never call Agent::persist_message, so their transcripts bypassed the MessagePart::Image strip landed in fix(core): strip ephemeral Image parts before persistence writes #6307 for spec-072 §4 C1 entirely — a defense-in-depth gap, not currently exploitable, but reachable once Implement: P2 MediaSanitizer decode/validate/attach + vision-tier routing for MCP image passthrough #6240 (MCP image emission in tool-result processing) lands.
  • Extracted the strip logic into a shared MessagePart::strip_images helper on zeph-llm's MessagePart (avoids duplicating the filter and avoids a circular dependency, since zeph-common cannot host it while zeph-llm already depends on zeph-common). Both Agent::persist_message and TranscriptWriter::append now call this shared helper.
  • The caller's in-memory Message is unaffected; TranscriptWriter::append strips a clone before serializing.

Closes #6305

Test plan

  • cargo +nightly fmt --check
  • cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings
  • cargo nextest run --config-file .github/nextest.toml -p zeph-subagent -p zeph-llm -p zeph-core --lib --bins (3381 passed)
  • cargo test --doc -p zeph-llm (25 passed, including the extended strip_images doctest)
  • RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"
  • gitleaks protect --staged --no-banner --redact — no leaks
  • New tests: image parts stripped from written/read-back transcript, non-image parts pass through unchanged, empty-parts messages unaffected, mixed Text+Image case
  • Adversarial critique (impl-critic) and independent code review both completed — approved

TranscriptWriter::append serialized the full Message verbatim to the
sub-agent's JSONL transcript with no filtering. Sub-agents never call
Agent::persist_message, so their transcripts bypassed the
MessagePart::Image strip landed in #6307 for spec-072 C1 entirely.

Extract the strip logic into a shared MessagePart::strip_images helper
in zeph-llm and call it from both Agent::persist_message and
TranscriptWriter::append, closing the defense-in-depth gap before #6240
(MCP image emission in tool-result processing) can make it reachable.

Closes #6305
@github-actions github-actions Bot added documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) rust Rust code changes core zeph-core crate bug Something isn't working size/M Medium PR (51-200 lines) labels Jul 16, 2026
@bug-ops
bug-ops enabled auto-merge (squash) July 16, 2026 16:02
@bug-ops
bug-ops merged commit 9192e82 into main Jul 16, 2026
43 checks passed
@bug-ops
bug-ops deleted the fix/6305-subagent-image-filter branch July 16, 2026 16:12
bug-ops added a commit that referenced this pull request Jul 16, 2026
…ce in spec-072

Sub-agent transcripts (TranscriptWriter::append) were added as a fourth
MessagePart::Image strip site by PR #6310, but spec-072 section 4 (C1,
FR-008, AC-5, threat model) still only listed three persistence surfaces.
bug-ops added a commit that referenced this pull request Jul 16, 2026
…ce in spec-072 (#6316)

Sub-agent transcripts (TranscriptWriter::append) were added as a fourth
MessagePart::Image strip site by PR #6310, but spec-072 section 4 (C1,
FR-008, AC-5, threat model) still only listed three persistence surfaces.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core zeph-core crate documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zeph-subagent: TranscriptWriter::append has no MessagePart::Image filter (defense-in-depth gap for spec-072 C1)

1 participant