HarnessRouter Community Edition: the self-hosted, Apache-2.0 edition of the unified interface for agent harnesses. Run Codex, Claude Code, Hermes, PI, DSH, and more through one API, with sessions, streaming, files, cancellation, and failure handling. Implements the Unified Harness Protocol (UHP), an open standard. Your keys, your infrastructure.
Python agent-apiagent-frameworkagent-harnessai-agentsai-infrastructurecoding-agentconformance-testingdeepseek-harnessharness-engineeringhermesllmopen-protocolopen-sourceopen-standardpi-coding-agentself-hosteduhpunified-apiunified-harness-protocolunified-interface
The built-in image skill does not stand in front of the media tools (#409)
github-actions[bot]8f2d7dce589e
diff --git a/docs/support-matrix-notes.md b/docs/support-matrix-notes.mdindex a0b6464d..7ed9c4c1 100644--- a/docs/support-matrix-notes.md+++ b/docs/support-matrix-notes.md@@ -3068,3 +3068,28 @@ Candidate `0.31.2-rc.1` in a side container on the test VM, on a copy of an inst| The Default Workspace's key, a harness made before workspaces | completed |Through the console itself (Playwright): a harness created and run on pi, with its skill, script and tool policy. Claude Code tasks complete, and all plugin checks pass on Claude Code, Codex and pi, each of which makes its own harness and runs it.++## The built-in image skill in front of the media tools (2026-10-06, 0.31.3)++The built-in `imagegen` skill works only through a turn's image credential. With none its script+refuses: "image generation is not configured for this Harness. An operator needs to add an integration+that serves an image model". On the hosted service a pi agent whose harness also carried the media+tools read the skill first, took the sentence as final and told the person images were unavailable,+two runs of three, with `media_generate_image` one call away. This tree has the same skill, mounted by+default, and the same two ways to make an image, resolved from different tables: the skill's credential+from the image model map, the media tools' providers from the integrations by kind. So a turn can have+the second without the first: image models switched off, or broker trust without `HR_BROKER_IMAGES`.++On such a turn the built-in is now dropped and suppressed. Where the turn has no other way to make an+image the skill stays, which is where this tree differs from the hosted one: here the person asking is+the operator, and the refusal is what says what to add.++Candidate `0.31.3-rc.1` in a side container on the test VM, on a copy of an instance whose Videos kit harness carries the media tools. One request each ("make one image, then say MADE or CANNOT"):++| The turn | The image skill in the session | What the agent did |+|---|---|---|+| Media tools, an image credential (Claude Code) | present | made the image with the media tool |+| Media tools, no image credential (Claude Code) | absent | made the image with the media tool |+| No media tools, no image credential (pi) | present | ran the skill and answered "CANNOT image generation not configured" |++The image credential was removed by switching the instance's image models off on the Integrations document. Not reproduced here: the agent giving up in front of a working media tool. That was seen on the hosted service with a pi agent; Claude Code on this harness chose the media tool either way. What is shown here is that the skill is no longer offered in that state. Claude Code tasks complete, and all plugin checks pass on Claude Code, Codex and pi (the skill checks among them).diff --git a/gateway/app.py b/gateway/app.pyindex ad24191f..f91befdc 100644--- a/gateway/app.py+++ b/gateway/app.py@@ -7756,6 +7756,9 @@ async def _resp_execute(translator: _RespTranslator, *, org: str, member: str, sawait _vertex_upsert(sid, {"models_seen": ",".join(seen + [model_req])})# Independent of which chat connection wins below: images are usually a different provider.image_auth = await _image_auth(sid, backend)+ skills, skills_suppressed = _without_shadowing_image_skill(skills, skills_suppressed, image_auth, mcp_servers)+ if "plugins" in rec: # the record says what the turn was given, so after that change+ rec["plugins"].update(skills=[s_.get("name") for s_ in skills], skills_off=skills_suppressed)vision_auth = await _vision_auth(sid, backend) if backend == "hermes" else Nonefor name, pre in candidates:conn, src = (pre, "integration") if pre is not None else await _get_connection(org, name)@@ -15524,6 +15527,33 @@ def _base_takes_skills(base_id: str) -> bool:return bool((_BASE_CATALOG.get(str(base_id or "")) or {}).get("skills", True))+_IMAGE_SKILL = "imagegen"+++def _without_shadowing_image_skill(skills: list[dict], suppressed: list[str], image_auth: dict | None,+ mcp_servers: list[dict]) -> tuple[list[dict], list[str]]:+ """The built-in image skill works only through the turn's image credential (HR_IMAGE_*); with+ none its script refuses, "image generation is not configured for this Harness". On a harness+ that also carries the media tools, an agent read the skill first, took that sentence as final+ and told the person images were unavailable, with media_generate_image one call away (found on+ the hosted service, a pi agent, two runs of three, 2026-10-06). So on such a turn the built-in+ is dropped and suppressed: a path that cannot work must not stand in front of one that can.++ Where the turn has no other way to make an image the skill stays, which is where this differs+ from the hosted service: on a self-hosted instance the person asking is the operator, and the+ skill's refusal is what says to add an integration that serves an image model. A harness's own+ skill of that name (files of its own, or a plugin's) is the harness's and stays."""+ builtin = (_builtin_skills().get(_IMAGE_SKILL) or {}).get("files")+ media = _HOSTED_MCP_PREFIX + _MEDIA_SERVER+ if image_auth or not builtin or not any(+ str(s.get("url") or "").split("?", 1)[0].rstrip("/").endswith(media) for s in mcp_servers or []):+ return skills, suppressed+ if any(s.get("name") == _IMAGE_SKILL and (s.get("plugin") or s.get("files") != builtin) for s in skills):+ return skills, suppressed+ kept = [s for s in skills if s.get("name") != _IMAGE_SKILL]+ return kept, (suppressed if _IMAGE_SKILL in suppressed else [*suppressed, _IMAGE_SKILL])++def _builtin_default_skills(seen: set[str] | None = None) -> list[dict]:"""Built-ins that are on by default, minus any the harness has its own entry for.diff --git a/gateway/tests/test_image_skill_mount.py b/gateway/tests/test_image_skill_mount.pynew file mode 100644index 00000000..04b10c2b--- /dev/null+++ b/gateway/tests/test_image_skill_mount.py@@ -0,0 +1,66 @@+"""The built-in image skill does not stand in front of an image tool that works.++It works through the turn's image credential alone; without one its script refuses, and an agent took+the refusal as final although its harness had the media tools (found on the hosted service,+2026-10-06). Here the skill is dropped only where the turn carries the media tools: with no other+way to make an image, its refusal is what tells a self-hosting operator what to add.+"""+import sys+from pathlib import Path++sys.path.insert(0, str(Path(__file__).resolve().parents[1]))+import app as gw # noqa: E402+import pytest # noqa: E402++BUILTIN = {"name": "imagegen", "files": [{"path": "SKILL.md", "content": "x"}], "content": None}+DOCX = {"name": "docx", "files": [{"path": "SKILL.md", "content": "y"}], "content": None}+MEDIA = [{"name": "media", "url": "http://127.0.0.1:3000/api/harness/v1/mcp/media"}]+OTHER = [{"name": "deepwiki", "url": "https://mcp.deepwiki.com/mcp"}, {"name": "db", "url": "http://127.0.0.1:3000/api/harness/v1/mcp/database"}]+CRED = {"base_url": "https://b", "api_key": "sk-x"}++[email protected](autouse=True)+def image_built_in(monkeypatch):+ monkeypatch.setattr(gw, "_builtin_skills", lambda: {"imagegen": {"files": BUILTIN["files"]}, "docx": {"files": DOCX["files"]}})+++def test_with_the_media_tools_and_no_image_credential_the_builtin_is_dropped_and_suppressed():+ skills, off = gw._without_shadowing_image_skill([BUILTIN, DOCX], [], None, MEDIA)+ assert [s["name"] for s in skills] == ["docx"] and off == ["imagegen"]+ skills, off = gw._without_shadowing_image_skill([DOCX], ["pptx"], None, MEDIA + OTHER) # never mentioned: still suppressed+ assert [s["name"] for s in skills] == ["docx"] and off == ["pptx", "imagegen"]+ assert gw._without_shadowing_image_skill([BUILTIN], ["imagegen"], None, MEDIA) == ([], ["imagegen"])+++def test_with_no_other_way_to_make_an_image_the_skill_stays_to_say_what_is_missing():+ for servers in ([], OTHER, None):+ assert gw._without_shadowing_image_skill([BUILTIN, DOCX], [], None, servers) == ([BUILTIN, DOCX], [])+++def test_with_an_image_credential_nothing_changes():+ assert gw._without_shadowing_image_skill([BUILTIN, DOCX], [], CRED, MEDIA) == ([BUILTIN, DOCX], [])+++def test_a_harnesses_own_image_skill_stays():+ own = {"name": "imagegen", "files": [{"path": "SKILL.md", "content": "my own"}], "content": None}+ from_plugin = {"name": "imagegen", "files": BUILTIN["files"], "plugin": "studio"}+ assert gw._without_shadowing_image_skill([own, DOCX], [], None, MEDIA) == ([own, DOCX], [])+ assert gw._without_shadowing_image_skill([from_plugin], [], None, MEDIA) == ([from_plugin], [])+++def test_an_image_built_without_the_skill_changes_nothing(monkeypatch):+ monkeypatch.setattr(gw, "_builtin_skills", lambda: {})+ assert gw._without_shadowing_image_skill([DOCX], [], None, MEDIA) == ([DOCX], [])+++def test_the_media_server_is_known_by_its_own_path_whatever_it_was_named():+ renamed = [{"name": "studio tools", "url": "https://my.host/api/harness/v1/mcp/media/"}]+ assert gw._without_shadowing_image_skill([BUILTIN], [], None, renamed) == ([], ["imagegen"])+ lookalike = [{"name": "media", "url": "https://elsewhere.example/v1/mcp/mediaplayer"}]+ assert gw._without_shadowing_image_skill([BUILTIN], [], None, lookalike) == ([BUILTIN], [])+++def test_the_turn_applies_it_right_after_its_image_credential_is_read():+ src = (Path(__file__).resolve().parents[1] / "app.py").read_text()+ assert (" image_auth = await _image_auth(sid, backend)\n"+ " skills, skills_suppressed = _without_shadowing_image_skill(skills, skills_suppressed, image_auth, mcp_servers)\n") in src