CLI exits 0 when a tool call fails (task add/rm/update, project job get, agent run…)

Ouverte
#1,663 0 commentaires 0 réactions 1 personne assignée Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@lsegal y travaille déjà.

Depuis le 28/11/2026.

Évaluation

Cette issue n'a pas encore été évaluée.

Description

bug

Summary

Every CLI command that goes through dispatcher.CallTool exits 0 when the tool fails. It prints the tool's error text to stdout as if it were a normal result. Scripts and CI can't tell that aviary task add, task update, task rm, task run, project job get and the rest failed.

Steps to reproduce

Against a running server (seen on main at the time of filing):

$ aviary task add assistant weird "x" --every 0m; echo rc=$?
invalid schedule: invalid every "0m": must be at least 1s
rc=0
$ aviary task rm nosuch; echo rc=$?
task "nosuch" not found; use task_list to see tasks
rc=0
$ aviary task update nosuch --every 1h; echo rc=$?
task "nosuch" not found; use task_list to see tasks
rc=0
$ aviary task add nobody t "x" --every 1h; echo rc=$?
agent "nobody" not found; use agent_list to see available agents
rc=0
$ aviary project job get 99999; echo rc=$?
no job #99999
rc=0
$ aviary agent run nobody hi; echo rc=$?
agent "nobody" not foundrc=0        # also no trailing newline

Expected

A tool result with IsError set should make the command exit non-zero and print the message to stderr.

Cause

internal/mcp/dispatch.go Dispatcher.CallTool returns extractText(result), nil and drops result.IsError. CallToolWithProgress already reports isError, and watch.go checks it. All 15 CallTool call sites in cmd/aviary/cmd (agent, agent_resolve, project, task, tool, tool_command, upgrade) inherit the problem.

Suggested fix

Have CallTool return an error, for example ToolError{Text}, when result.IsError is set, so cobra exits 1. Error messages also mention MCP tool names (use task_list, use agent_list). In the CLI they could name aviary task list / aviary agent list instead.

Regression test

A cmd/aviary/cmd test that runs task rm nosuch and task add ... --every 0m against the in-process dispatcher and asserts a non-nil error/non-zero exit.

Created by Engine: /aviary:FC88FDCA

Langage dominant
Go
Étoiles
12
Forks
5
Merge moyen
53 min
PR mergées (30 j)
640

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de lsegal/aviary

Toutes les issues de lsegal/aviary

Issues similaires

Plus d'issues Go

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.