fix(media-understanding): strip repeated placeholders#96431
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 24, 2026, 9:11 AM ET / 13:11 UTC. Summary PR surface: Source +1, Tests +30. Total +31 across 2 files. Reproducibility: yes. Source inspection on current main shows only one leading media placeholder is stripped, so Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Keep this PR open until a linked canonical PR proves it covers this PR's unique work, or a maintainer confirms closure. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection on current main shows only one leading media placeholder is stripped, so Is this the best way to solve the issue? Yes. The shared formatter is the narrowest maintainable fix location because both command-text preservation and model-visible body formatting already flow through AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7844b0844568. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1, Tests +30. Total +31 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Merged via squash.
Thanks @lin-hongkuan! |
Merged via squash. Prepared head SHA: 4b00486 Co-authored-by: lin-hongkuan <[email protected]> Co-authored-by: vincentkoc <[email protected]> Reviewed-by: @vincentkoc
Merged via squash. Prepared head SHA: 4b00486 Co-authored-by: lin-hongkuan <[email protected]> Co-authored-by: vincentkoc <[email protected]> Reviewed-by: @vincentkoc
What Problem This Solves
Media-understanding bodies can contain synthetic placeholders for each attachment, such as
<media:image> <media:audio> caption here.extractMediaUserTextonly stripped one leading placeholder, so the second synthetic placeholder was treated as user-authored text and sent back to the model.Placeholder-only multi-attachment bodies were also treated as meaningful user text instead of being suppressed.
Why This Change Was Made
Synthetic media placeholders are transport markers, not user text. The placeholder matcher now accepts and strips repeated leading placeholder tokens while preserving the remaining caption text.
User Impact
Multi-attachment media-understanding prompts no longer leak extra
<media:...>markers into the formatted model-visible body.Evidence
Live behavior proof from this branch:
Focused validation:
git diff --checkproduced no output.AI-assisted: OpenAI Codex helped inspect the media-understanding formatter and add focused regression coverage.