fix(recognize_image): restore vision fallback in remote workspace mode - #24
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix(recognize_image): restore vision fallback in remote workspace mode#24cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
When a remote workspace is active, resolve_media_to_content_item blocked all local path resolution, breaking recognize_image for Feishu attachments synced via attachment_sync (daemon-local copy + remote_path in prompts). - Allow daemon-local files in remote mode when the path exists on disk - Convert media_ref paths to data URLs for vision fallback - Match unseen_media by remote_path and read remote blobs via file_blob_read Co-authored-by: Yuxuan Liu <Osc-7@users.noreply.github.com>
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.
Bug and impact
When a session uses a remote workspace and the main LLM lacks vision, Feishu image attachments synced via
attachment_syncare downgraded to text placeholders that point at.macchiato/inbox/...paths. Callingrecognize_imageto understand those images always failed becauseresolve_media_to_content_itemrejected all local path resolution whenever remote mode was active—even though attachment sync keeps a daemon-local copy specifically for vision hydrate.Impact: image understanding is completely broken for the common path of remote workspace + non-VL main model + Feishu attachments.
Root cause
resolve_media_to_content_itemhad a blanket early return for remote workspaces before checking whether the file exists locally.recognize_imageexpectedimage_urlcontent items butresolve_media_to_content_itemreturnsmedia_ref, so path-based fallback never produced a usable data URL._lookup_unseen_mediadid not matchremote_path, so models following prompt hints could not resolve synced attachments.Fix
resolve_media_path_to_data_urlhelper and use it fromrecognize_image.recognize_imageto matchremote_pathin unseen media and fall back tofile_blob_readfor remote-relative paths.Validation
uv run pytest tests/test_recognize_image_tool.py -v(10 passed)