fix: preserve local image attachment metadata across vision fallback paths - #34315
Open
sunzd-1997 wants to merge 3 commits into
Open
fix: preserve local image attachment metadata across vision fallback paths#34315sunzd-1997 wants to merge 3 commits into
sunzd-1997 wants to merge 3 commits into
Conversation
Move npm install, uv sync, playwright install, and frontend build out of the Dockerfile and into a new cont-init.d/00-bootstrap-deps script that runs on the first container boot. The Docker build now only installs system tools, s6-overlay, and copies source code, completing in < 5 min instead of timing out at 20–35 min on the licloud CI platform. - Remove all COPY manifest + npm install + uv sync + frontend build layers - Add docker/cont-init.d/00-bootstrap-deps: first-boot install script with .bootstrap_done marker for fast subsequent starts - stage2-hook.sh: guard .venv/node_modules/.playwright chowns with [ -d ] since they no longer exist at build time; add .venv guard to skills_sync; remove ui-tui references (no frontend in this deployment) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…r start" This reverts commit 16fa69f.
Contributor
|
Thanks for preserving attachment context across the gateway, CLI, and TUI text-preprocessing paths. Problems
Suggested changes
Automated hermes-sweeper review. |
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?
This PR preserves deterministic local image attachment metadata across Hermes image routing paths.
Gateways such as Feishu may correctly download an image into the local Hermes cache, but the agent-visible text does not always retain stable local file metadata. When the main model does not support native vision, or when
vision_analyzefails or raises, downstream skills/tools can lose the exact local path they need to upload or reprocess the cached image.This PR adds a machine-readable attachment block for local images:
[Hermes image attachment]
local_image_path=...
size_bytes=...
mime_type=...
[/Hermes image attachment]
Models still receive native image parts when supported. Text fallback now keeps the local cached image path, byte size, and MIME type before vision analysis runs, so the metadata remains available whether vision succeeds, fails, or throws.
This is not Feishu-specific. It makes local image attachments deterministic for any gateway, CLI, TUI, skill, or tool workflow that needs to operate on the exact cached file.
Related Issue
Fixes #
Type of Change
Changes Made
agent/image_routing.pyimage_attachment_metadata(path)to collect stable local image metadata.format_image_attachment_block(image_paths)to emit machine-readable attachment blocks.image_urlparts.gateway/run.pyvision_analyze, so metadata survives success, failure, and exception paths.cli.pytui_gateway/server.pytests/agent/test_image_routing.pytests/gateway/test_image_attachment_metadata.pytests/hermes_cli/test_kanban_worker_image_extraction.pyHow to Test
Attach or send a local image through a text fallback path where the main model does not receive native vision input.
Verify the agent-visible text includes the attachment block with
local_image_path,size_bytes, andmime_type.Run the focused regression suite:
/Users/sunyusong1/.hermes/hermes-agent/venv/bin/python -m pytest tests/agent/test_image_routing.py tests/gateway/test_image_attachment_metadata.py tests/tools/test_clipboard.py::TestPreprocessImagesWithVision::test_vision_failure_includes_path tests/tools/test_clipboard.py::TestPreprocessImagesWithVision::test_vision_exception_includes_path tests/hermes_cli/test_kanban_worker_image_extraction.pyLocal result:
92 passed.Checklist
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/AScreenshots / Logs
Focused regression suite:
92 passed