mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 12:03:49 +00:00
fix(subagent): list available agents in unknown-agent error (#1414)
The invalid-params error paths already listed available agents, but the unknown-agent path in runSingleAgent just returned 'Unknown agent: claude' with no hint what exists. Now: 'Unknown agent: "claude". Available agents: "worker".' Model would guess names like "claude", "default", or skill names like "brave-search". Now it self-corrects on the next call. Tested with Opus 4.6: without fix, model gave up on subagent and ran the tool calls itself instead. With fix, 1 wasted call.
This commit is contained in:
parent
5b36cacaf3
commit
dae2eb5bfa
1 changed files with 2 additions and 1 deletions
|
|
@ -231,13 +231,14 @@ async function runSingleAgent(
|
|||
const agent = agents.find((a) => a.name === agentName);
|
||||
|
||||
if (!agent) {
|
||||
const available = agents.map((a) => `"${a.name}"`).join(", ") || "none";
|
||||
return {
|
||||
agent: agentName,
|
||||
agentSource: "unknown",
|
||||
task,
|
||||
exitCode: 1,
|
||||
messages: [],
|
||||
stderr: `Unknown agent: ${agentName}`,
|
||||
stderr: `Unknown agent: "${agentName}". Available agents: ${available}.`,
|
||||
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, contextTokens: 0, turns: 0 },
|
||||
step,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue