Skip to content

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.

fix: Delete on a model mapping was a no-op, and a JSX escape rendered literally

richard-epsilla0f1d71bfa432
diff --git a/gateway/app.py b/gateway/app.py
index 3539dea2..4ce35b7b 100644
--- a/gateway/app.py
+++ b/gateway/app.py
@@ -1017,9 +1017,15 @@ async def _effective_image_model_map() -> dict[str, str]:
serve is dropped, not honoured — same rule as chat, for the same reason."""
integrations = await _integrations_doc()
servable = {str(i.get("name") or ""): _integration_image_models(i) for i in integrations}
- mm = {k: v for k, v in (await _image_model_map_doc()).items() if k in servable.get(v, {})}
+ stored = await _image_model_map_doc()
+ # An explicit empty value is "off": the operator removed this row, and auto-claiming must not
+ # undo that. Without this the Delete button reports success and changes nothing.
+ off = {k for k, v in stored.items() if not str(v).strip()}
+ mm = {k: v for k, v in stored.items() if str(v).strip() and k in servable.get(v, {})}
for name, models in servable.items():
for canonical in models:
+ if canonical in off:
+ continue
mm.setdefault(canonical, name)
return mm
@@ -1069,9 +1075,15 @@ async def _effective_model_map() -> dict[str, str]:
"""
integrations = await _integrations_doc()
servable = {str(i.get("name") or ""): _integration_models(i) for i in integrations}
- mm = {k: v for k, v in (await _model_map_doc()).items() if k in servable.get(v, {})}
+ stored = await _model_map_doc()
+ # Explicit empty value = "off". Auto-claiming is what makes a new model light up without a
+ # re-save; it must not also override an operator who deliberately removed a row.
+ off = {k for k, v in stored.items() if not str(v).strip()}
+ mm = {k: v for k, v in stored.items() if str(v).strip() and k in servable.get(v, {})}
for name, models in servable.items():
for canonical in models:
+ if canonical in off:
+ continue
mm.setdefault(canonical, name)
return mm
@@ -3635,17 +3647,21 @@ async def admin_integrations_put(body: IntegrationsBody, request: Request) -> di
names = {i["name"] for i in out}
if len(names) != len(out):
raise HTTPException(400, "integration names must be unique")
+ # An EMPTY value is kept, and means "no integration serves this model". Dropping it made the
+ # console's Delete a no-op: the effective maps claim every servable model on read, so removing
+ # the explicit row simply let the claim put it back, and the write returned 200 having changed
+ # nothing visible. "Off" needs to be sayable, and this is where it is said.
mm = {str(k).strip(): str(v).strip() for k, v in (body.model_map or {}).items()
- if str(k).strip() and str(v).strip()}
+ if str(k).strip()}
for model, iname in mm.items():
- if iname not in names:
+ if iname and iname not in names:
raise HTTPException(400, f"model '{model}' maps to unknown integration '{iname}'")
imm = None
if body.image_model_map is not None:
imm = {str(k).strip(): str(v).strip() for k, v in body.image_model_map.items()
- if str(k).strip() and str(v).strip()}
+ if str(k).strip()}
for model, iname in imm.items():
- if iname not in names:
+ if iname and iname not in names:
raise HTTPException(400, f"image model '{model}' maps to unknown integration '{iname}'")
# Only EXPLICIT routes are stored. Claiming every servable model here is what froze the map:
# a model added to the source table afterwards had no entry and read as "no provider", while
diff --git a/ui/src/app/(app)/integrations/page.tsx b/ui/src/app/(app)/integrations/page.tsx
index 3616dcab..3fde67f5 100644
--- a/ui/src/app/(app)/integrations/page.tsx
+++ b/ui/src/app/(app)/integrations/page.tsx
@@ -203,7 +203,7 @@ export default function IntegrationsPage() {
<MappingTable
title="Image Model, Integration Mapping"
blurb={<>Which integration generates images. Routed separately from chat because it is
- usually a different provider \u2014 an Anthropic connection has no image API at all.{' '}
+ usually a different provider, and an Anthropic connection has no image API at all.{' '}
An image model with no integration means a Harness cannot generate images.</>}
map={doc.image_model_map || {}}
allCanonicals={allImageCanonicals}
@@ -382,12 +382,14 @@ function MappingTable({ title, blurb, map, allCanonicals, servedBy, integrations
<table className="itg-table itg-map-table">
<thead><tr><th>Model</th><th>Integration</th><th aria-label="Actions"></th></tr></thead>
<tbody>
- {Object.entries(map).map(([model, iname]) => (
+ {Object.entries(map).filter(([, iname]) => iname).map(([model, iname]) => (
<tr key={model}>
<td>
<select className="select" value={model} disabled={busy}
onChange={(e) => {
const next = { ...map };
+ // Renaming a row is not a delete: clear the old key outright rather than
+ // leaving an "off" marker that would suppress the model it moved away from.
delete next[model];
next[e.target.value] = iname;
onChange(next);
@@ -407,8 +409,13 @@ function MappingTable({ title, blurb, map, allCanonicals, servedBy, integrations
</select>
</td>
<td className="itg-row-actions">
+ {/* Writes an explicit "off" marker rather than dropping the key. The server
+ claims every model an integration can serve, so simply removing the row let
+ the claim put it straight back: the save returned 200 and the row reappeared,
+ which read as Delete being broken. An empty value is how "no integration
+ serves this" is said. */}
<button className="button danger-ghost" type="button" disabled={busy}
- onClick={() => { const next = { ...map }; delete next[model]; onChange(next); }}>Delete</button>
+ onClick={() => onChange({ ...map, [model]: '' })}>Delete</button>
</td>
</tr>
))}