Hide empty vision skip summaries

Keep native vision_load results concise by omitting the skipped-images section when no inputs were skipped. Preserve skipped-path and max-embed details whenever the configured limit drops images, with focused coverage for both output forms.

Alessandro committed Aug 26, 2026 at 01:57 UTC a3be123c50601756a3c482973fc85abd85f37318
3 files changed +26 -5
tests/test_vision_load_image_refs.py
+18
@@ -169,6 +169,24 @@ def test_active_vision_model_route_prefers_main_native_vision(monkeypatch):
169 assert bool(model_config.get_vision_model_config()) is expected
170
171
172 +def test_vision_summary_only_shows_skipped_section_when_needed(monkeypatch):
173 + _install_tool_stub(monkeypatch)
174 + import tools.vision_load as vision_load_module
175 +
176 + tool = vision_load_module.VisionLoad(agent=None)
177 + tool.vision_config = {"max_embeds": 10}
178 + tool.loaded_paths = ["loaded.png"]
179 + tool.skipped_paths = []
180 +
181 + assert tool._summary() == "Loaded images (1):\nloaded.png"
182 +
183 + tool.skipped_paths = ["skipped.png"]
184 + assert tool._summary() == (
185 + "Loaded images (1):\nloaded.png\n\n"
186 + "Skipped images (1, max 10):\nskipped.png"
187 + )
188 +
189 +
190 @pytest.mark.anyio
191 async def test_vision_model_sends_multiple_images_once_and_keeps_history_text_only(
192 monkeypatch,
tools/vision_load.py
+7 -5
@@ -187,11 +187,13 @@ class VisionLoad(Tool):
187
188 def _summary(self) -> str:
189 loaded = "\n".join(self.loaded_paths) if self.loaded_paths else "none"
190 - skipped = "\n".join(self.skipped_paths) if self.skipped_paths else "none"
191 - return (
192 - f"Loaded images ({len(self.loaded_paths)}):\n{loaded}\n\n"
193 - f"Skipped images ({len(self.skipped_paths)}, max {self._get_max_embeds()}):\n{skipped}"
194 - )
190 + summary = f"Loaded images ({len(self.loaded_paths)}):\n{loaded}"
191 + if self.skipped_paths:
192 + summary += (
193 + f"\n\nSkipped images ({len(self.skipped_paths)}, max {self._get_max_embeds()}):\n"
194 + + "\n".join(self.skipped_paths)
195 + )
196 + return summary
197
198 @staticmethod
199 def _is_data_image_url(value: str) -> bool:
tools/vision_load.py.dox.md
+1
@@ -28,6 +28,7 @@
28 - In a direct parallel worker, native image content is queued for the parent and promoted immediately after the outer `parallel` result; the disposable worker never owns the only copy of model-visible pixels.
29 - Direct parallel workers inherit the parent's model override generically. This tool uses their recorded parent context only to resolve ephemeral refs and durable chat media.
30 - `max_embeds` comes from the model that actually receives the images.
31 +- Native tool-result summaries omit the skipped-images section when no images were skipped; when the limit drops inputs, the section reports the skipped paths and active maximum.
32 - Vision Model calls use the selected model's Advanced `kwargs`; this tool does not impose a separate timeout or output-token limit.
33 - An empty Vision Model response is reported as an image-analysis error instead of a successful empty capsule.
34 - Update this file whenever tool arguments, output shape, `break_loop` behavior, intervention handling, prompt instructions, or side effects change.