Skip to content

fix(context): preserve images with duplicate basenames - #154

Open
OUAO-FRANK wants to merge 1 commit into
google-research:mainfrom
OUAO-FRANK:codex/issue-153-context-image-collisions
Open

OUAO-FRANK wants to merge 1 commit into
google-research:mainfrom
OUAO-FRANK:codex/issue-153-context-image-collisions

Conversation

@OUAO-FRANK

Copy link
Copy Markdown

Preserve image evidence when a rollout produces files such as Q1/chart.png and Q2/chart.png. The context builder currently copies both to images/chart.png, silently replacing the first. Prefix each copied image with its position in the selected image list so destinations are distinct; the existing eight-image limit is unchanged.

The regressions use different valid PNGs, the real JobBench adapter's raw-text fallback, and context.build(). They check the copied bytes for repeated basenames, distinct basenames, and source names that already contain a numeric prefix.

Validation on Linux/WSL, Python 3.12.3:

  • python3 -B -m unittest discover -s tests -v: all 8 tests pass.
  • ruff check harness2/core/context.py tests/test_context_images.py: passes.
  • ruff format --check harness2/core/context.py tests/test_context_images.py: both files formatted.
  • git diff --check: passes.
  • Mutation: restoring the original image-copy loop in memory makes both collision cases fail while the distinct-name control passes. The fixture uses no model, network, or external image library.

Native Windows validation hits the existing raw-text extraction path's backslash handling before reaching these assertions; Windows support is not claimed by this change.

Fixes #153.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Same-named images in separate output directories overwrite each other in proposer context

1 participant