fix(vision): normalize CgBI image replay payloads - #38060
Open
stefanpieter wants to merge 3 commits into
Open
stefanpieter wants to merge 3 commits into
stefanpieter wants to merge 3 commits into
Conversation
stefanpieter
force-pushed
the
fix/vision-cgbi-replay-normalization
branch
from
July 8, 2026 18:28
58881b1 to
c9d14c0
Compare
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for tracing this through both new vision output and historical Codex replay. The premise remains live on current main: tools/vision_tools.py:529-539 wraps raw PNG bytes as data URLs, and agent/codex_responses_adapter.py:666-673 preserves replayed input_image URLs.
Problems
tools/vision_tools.py:625andtools/vision_tools.py:641spawnxcrun/pngcrushwithoutstdin=subprocess.DEVNULL. The existing vision rasterizer uses that guard attools/vision_tools.py:292-295; commit6c068358edocuments that a child image utility reading stdin can hang under prompt_toolkit.
Suggested changes
- Add
stdin=subprocess.DEVNULLto both new subprocess calls, particularly thepngcrushconversion call.
This is an automated hermes-sweeper review.
Author
|
Review blocker fixed on
@teknium1 please re-review the interactive-stdin finding on the current head. |
Author
|
@teknium1 fresh review requested for exact head
The PR body now records the exact head and current evidence. Reviewer-controlled clearance remains pending. |
This was referenced Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CgBIPNG bytes before embedding them as provider data URLs for vision payloads.data:image/png;base64,...image URLs on API-bound replay so older ACP/session history with CgBI PNGs does not keep poisoning future turns.input_imageitems, includingfunction_call_output.output[*].image_url.Root cause
A VS Code ACP session used
vision_analyzeon an iOS app icon. The tool result stored a raw Apple-optimized PNG containing the privateCgBIchunk as an inline data URL. On later turns, Codex Responses replayed that oldfunction_call_outputimage payload and the provider rejected the whole request with:Normalizing only newly-created vision data URLs was not enough; already-stored multimodal tool outputs also need to be normalized on the API-bound copy/preflight path.
Verification
git diff --check./venv/bin/python -m ruff check tools/vision_tools.py agent/agent_runtime_helpers.py agent/codex_responses_adapter.py tests/tools/test_vision_tools.py tests/run_agent/test_agent_guardrails.py tests/run_agent/test_run_agent_codex_responses.py./venv/bin/python -m pytest tests/tools/test_vision_tools.py tests/tools/test_vision_native_fast_path.py tests/run_agent/test_agent_guardrails.py tests/run_agent/test_run_agent_codex_responses.py -q→203 passed, 1 warninghermes acp --checkCgBIimage count was0.2026-07-14 review remediation
Remediation head at that time:
dce4d058cd6582289c87bad088c132cf86ae40f8.stdin=subprocess.DEVNULLto both CgBI helper subprocesses:xcrun -find pngcrushand thepngcrush -revert-iphone-optimizationsconversion.DEVNULL.stdin; GREEN:tests/tools/test_vision_tools.pyis91 passed.232 passed; four unrelated guardrail assertions also fail unchanged on clean currentupstream/mainbecause the local runtime concurrency setting is 3 while those tests assume 10.32failures across unrelated files; the clean-target failing-file comparison reproduced the same environment/configuration failure classes. One unrelated process-cleanup timing failure did not reproduce in three bounded clean-target repeats (3/3 passed).py_compile, Ruff on touched files,git diff --check, and added-line security scan passed.upstream/mainrebase simulation applied cleanly and reran the 91-test vision suite successfully.PASSwith no security or logic blockers.No public API or replay contract changed beyond preventing the helper processes from consuming interactive input.
2026-07-28 current-main integration
Current head:
3541ea501811c761cbf64d7832015d66ae70ca29.mainate4564586bc5dc9936d7a773eaabc42383bf7e4dewith a normal fast-forward branch update; the only conflict was additive inagent/agent_runtime_helpers.py.sanitize_api_messages.246 passed; touched-filepy_compile, Ruff,git diff --check, and added-line security scan passed.2,782 passedbefore an unrelated Copilot HOME-state failure; nine encountered failures were reproduced on the exact clean target (ACP approval/edit environment, macOS Anthropic OAuth mocking, and Copilot HOME state). No baseline exclusion touches the six-file feature diff.150c574dc0ae4888d008bcfba50e12515b071fc8:PASSwith no security or logic blockers.All required checks passgate has not started because workflow run30344646227isaction_required; the exact head has zero check-runs pending repository-admin workflow approval.