Independent review follow-up: - The shared resizer is best-effort: its 64 px short-edge floor keeps a 60000x64 image at 60000 px, and the MCP path checked only bytes, so an over-limit part could enter history (providers reject >8000 px per turn and the reactive shrink cannot fix it). The attach path now refuses any image whose output long edge is still above 1568 px; the result stays the MEDIA: text. - A resized screenshot lost its coordinate mapping. The MCP path now passes scale_out and lists `_build_scale_note` per MEDIA: path, as vision_analyze does, so a cua-driver-over-MCP click lands on the screen pixel the model saw. - computer_use cached its route per (home, provider, model) for the process, so editing `image_input_mode` (or the aux backend) never reached the next capture. The cache is gone: the decision reads the signature-cached `load_config_readonly` per capture. Pre-existing on main (12ad13ddca7), fixed here because this PR claims every image tool honours the setting; the perf test that pinned the stale cache becomes the "config change applies without restart" invariant.
20 lines
1.1 KiB
Python
20 lines
1.1 KiB
Python
"""Behavior contracts for computer_use latency knobs."""
|
|
|
|
|
|
from tools.computer_use import tool as cu_tool
|
|
|
|
|
|
def test_aux_vision_route_follows_a_config_change_without_restart(monkeypatch):
|
|
"""The capture route reads the signature-cached config on every capture, so an ``image_input_mode`` edit
|
|
(or /model, or a profile switch) applies to the next screenshot instead of a per-process verdict."""
|
|
cfg = {"agent": {"image_input_mode": "native"}}
|
|
monkeypatch.setattr("agent.auxiliary_client._read_main_provider", lambda: "anthropic")
|
|
monkeypatch.setattr("agent.auxiliary_client._read_main_model", lambda: "claude-opus-4-5")
|
|
monkeypatch.setattr("hermes_cli.config.load_config_readonly", lambda: cfg)
|
|
monkeypatch.setattr("agent.image_routing._lookup_supports_vision", lambda *a, **k: True)
|
|
monkeypatch.setattr("tools.vision_tools._profile_rejects_tool_media", lambda *a, **k: False)
|
|
|
|
assert cu_tool._should_route_through_aux_vision() is False
|
|
cfg["agent"]["image_input_mode"] = "text"
|
|
assert cu_tool._should_route_through_aux_vision() is True
|