Fix/vision sandbox path resolution - #14990
Closed
Sihui wants to merge 3 commits into
Closed
Conversation
When terminal.backend is docker, file-discovery tools (search_files, terminal) return container-local paths like ./screenshot.png or /workspace/screenshot.png. The vision tool runs on the host where these paths do not exist, causing "Invalid image source" errors. Add _resolve_sandbox_path_to_host() which translates sandbox paths to host paths using: - TERMINAL_CWD for relative paths - docker_volumes from config.yaml for absolute container paths - /workspace -> TERMINAL_CWD when docker_mount_cwd_to_workspace is set
Cover all path translation strategies in _resolve_sandbox_path_to_host: - relative paths (./foo, ../foo, bare filenames) via TERMINAL_CWD - docker_volumes mapping (container prefix -> host prefix) - /workspace mapping via docker_mount_cwd_to_workspace - edge cases: missing config, no TERMINAL_CWD, false prefix matches, spaces in paths
This was referenced May 2, 2026
Closed
Contributor
|
Thanks for the Docker vision-path investigation. This is now implemented on
|
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.
What does this PR do?
When
terminal.backend: docker, file-discovery tools (search_files,terminal) return container-local paths like./screenshot.pngor/workspace/screenshot.png. Thevision_analyzetool runs on the host where these paths do not exist, causing "Invalid image source" errors.This adds
_resolve_sandbox_path_to_host()which translates sandbox paths to host paths before theis_file()check, using the volume mappings already defined inconfig.yaml. No impact on non-Docker setups since unmatched paths pass through unchanged.Related Issue
Type of Change
Changes Made
tools/vision_tools.py: Add_resolve_sandbox_path_to_host()function that translates container paths to host paths using three strategies:./foo,../foo, bare filenames) resolved againstTERMINAL_CWDdocker_volumesfromconfig.yaml/workspace/...mapped toTERMINAL_CWDwhendocker_mount_cwd_to_workspaceis enabledtools/vision_tools.py: Call_resolve_sandbox_path_to_host()invision_analyze_tool()before the local file checkHow to Test
terminal.backend: dockerinconfig.yamlwithdocker_mount_cwd_to_workspace: truesearch_filesat./screenshot-xxx.png, passes it tovision_analyze, which rejects it with "Invalid image source. Provide an HTTP/HTTPS URL or a valid local file path."vision_analyzeresolves./screenshot-xxx.pngto the host path and analysis succeedsChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/Avol.split(":")may mis-split Windows volume paths likeC:\Users\...:/container. Docker on Windows is not tested.Screenshots / Logs
Before fix - agent finds file via search_files but vision rejects the sandbox path:
After fix - same flow, vision resolves the path and succeeds: