--agent <name> doesn't recognize custom agents loaded via --add-dir
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Shell
- Estrellas
- 11.2k
- Forks
- 1.9k
- Merge medio
- 14 h 16 min
- PR fusionados (30 d)
- 6
Descripción
Describe the bug
Custom agents loaded from a directory passed via --add-dir are correctly discovered for task-tool delegation (they appear in the model's list of available sub-agents, and can be invoked by mentioning them by name in a prompt), but the top-level --agent flag does not recognize them. Passing --agent for an agent that only exists under an --add-dir -added directory's .github/agents/ fails with "No such agent", even when that agent's frontmatter sets user-invocable: true .
Affected version
GitHub Copilot CLI 1.0.83
Steps to reproduce the behavior
- Create a custom agent at /.github/agents/my-agent.agent.md with user-invocable: true in its frontmatter.
- Run:
copilot --add-dir <some-dir> -p "List every custom agent name available to you via the task tool." --allow-all-tools
→my-agentappears in the list, confirming--add-dirloaded it correctly. - Run:
copilot --add-dir <some-dir> --agent my-agent -p "hello" --allow-all-tools
→ Fails with:
No such agent: my-agent, available: <only agents registered through other mechanisms, e.g. plugins>
Expected behavior
--agent should be able to select any agent discovered via --add-dir 's .github/agents/ directory — the same set of agents already visible to/usable by the task tool in that same session — especially when the agent explicitly sets user-invocable: true .
Additional context
• Workaround: instead of --agent , invoke the agent by mentioning its name directly in the prompt, e.g. -p "use the my-agent agent to ..." . This reliably delegates to the correct agent via the task tool.
• OS: macOS
• Shell: bash
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Empieza reproduciendo el comportamiento con --add-dir y --agent usando un archivo .github/agents/my-agent.agent.md cuyo frontmatter establezca user-invocable: true. Compara cómo task tool descubre ese agente con cómo la opción --agent de nivel superior valida los nombres. Se considera terminado cuando --agent my-agent selecciona el mismo agente personalizado sin el error «No such agent».
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Área
- cli
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Activo
- Claridad
- Bien especificado
- Aptitud para principiantes
- 68/100