fix(image): detect Windows local image refs - #34374
Open
zapabob wants to merge 1 commit into
Open
Conversation
zapabob
force-pushed
the
codex/windows-image-refs
branch
from
May 29, 2026 04:51
466d1c2 to
8a109a1
Compare
This was referenced Jul 9, 2026
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the focused Windows parity fix. The premise is confirmed on current main: agent/image_routing.py:68-70 still recognizes only POSIX / and ~/ paths, while the kanban worker calls extract_image_refs() on task bodies at cli.py:16065-16090. The gateway already uses the intended drive-letter grammar at gateway/platforms/base.py:3748-3754.
Problems
- This PR changes only
agent/image_routing.py; it adds no regression coverage. The existing extractor tests attests/agent/test_image_routing.py:523-639cover POSIX paths and URL guarding but not either Windows drive-letter separator form.
Suggested changes
- Add focused tests for
C:\\...\\shot.pngandC:/.../shot.png, along withC:relative.pngnon-matching and the existing URL-fragment guard. Matcher-level cases can run cross-platform; add a native-Windows filesystem case if needed for path validation.
Automated hermes-sweeper review.
| # Absolute / home-relative local image path. Matches the same shape gateway's | ||
| # extract_local_files() uses: anchors to ``~/`` or ``/``, ignores matches inside | ||
| # URLs (the ``(?<![/:\w.])`` lookbehind), and case-insensitive on the extension. | ||
| # extract_local_files() uses, plus native Windows drive paths. The lookbehind |
Contributor
There was a problem hiding this comment.
Please add regression coverage for both C:\\...\\image.png and C:/.../image.png, plus a relative-drive and URL-fragment negative case. Current extractor tests cover only POSIX-shaped paths.
This was referenced Aug 3, 2026
Draft
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
extract_image_refs().https://...URLs.~/...usingHOMEwhen present so tests and Windows shell environments behave predictably.Why
The v0.15.1 kanban worker image-ref tests exercise local image attachments from task bodies. On Windows, absolute paths such as
C:\Users\...\screenshot.pngwere not matched because the local path regex only handled POSIX/...and~/...shapes. That caused local image paths to be dropped while URL images still attached.I searched the upstream issue tracker for
Windows extract_image_refs,kanban image Windows, andimage path Windowsand did not find an existing matching issue.Verification
PYTHONUTF8=1 PYTHONIOENCODING=utf-8 .\.venv\Scripts\python.exe scripts\run_tests_parallel.py tests\agent\test_image_routing.py tests\hermes_cli\test_kanban_worker_image_extraction.py -- --tb=short --timeout-method=thread→ 86 passed.\.venv\Scripts\python.exe -m ruff check agent\image_routing.py tests\agent\test_image_routing.py tests\hermes_cli\test_kanban_worker_image_extraction.py→ passed