magpie icon indicating copy to clipboard operation
magpie copied to clipboard

routing: a group's only classifier has no × to remove it (the remove button renders only with two or more)

Open Niko-Wu opened this issue 4 days ago • 1 comments

What happens

A routing group's classifier (the decision model under Effort → "Picked per turn", i.e. effort=auto) cannot be removed once it is the only one. Its chip has no ×; only the "+" to add another classifier is shown. When that model stops working — e.g. an OpenCode Zen decision model answering 403 This model is not available in your country — the user can only swap it for another model or rebuild the group; there is no way to clear it and go back to the agent's own effort.

Why

internal/gui/assets/plugins/routing/client.js, in chip() (the classifier chip):

if (list.length < 2) return b;   // one classifier: returns before the remove button is built
...
const rm = el("button", "rt-cx");          // Remove {name} from the classifiers
rm.onclick = (e) => { ... setCls(d, clsOf(d).filter((_, j) => j !== k)) ... };

The remove button is only attached when there are two or more classifiers, so the single-classifier case — the one that matters when it is broken — is exactly the case with no remove.

Reproduced on v0.1.5273; the same line exists in v0.1.5336 (list.length < 2 at the same place), so this is still current.

Suggested fix

Show the × for a lone classifier too; only the empty placeholder chip ("choose a model", no id) should return early:

-        if (list.length < 2) return b;
+        if (!id) return b;

Removing the last classifier must also drop effort back to the agent's, because SaveGroup rejects effort=auto with no classifier ("effort picked per turn needs the group's classifier") and the picker ignores empty picks (if (!v) return), so nothing else would clear it:

rm.onclick = (e) => {
  e.stopPropagation();
  setCls(d, clsOf(d).filter((_, j) => j !== k));
  if (!d.classifier && d.effort === "auto") { d.effort = ""; drawEffort(); }
  drawClassifier();
  cls.querySelector(".rt-cls")?.focus({ preventScroll: true });
};

With this, the × on the last chip clears the classifier, effort flips back to Agent's, and Save succeeds. Groups that still carry intent rules keep the empty "choose a model" chip, which is right: an intent rule needs a classifier (the server says so).

I built and ran this locally against v0.1.5273 (the JS is embedded in the binary and the patched strings verified), and the flow above works in the Routing editor: × appears on a single classifier, deleting it hides the classifier row and saves as effort=agent, classifier="".

Workaround today (CLI)

magpie group set <id> effort=agent classifier= — classifier= with an empty value clears the list (SetClassifiers drops empty entries; SaveGroup then runs with effort=agent).

Niko-Wu avatar Dec 02 '26 05:12 Niko-Wu

我们接手:修复 Routing 组只有一个 classifier 时没有 × 的问题,并覆盖删除最后一个 classifier 后 effort 回到 Agent 的保存路径。

joei4cm avatar Dec 02 '26 07:12 joei4cm