github / github/copilot-cli

--agent <name>  doesn't recognize custom agents loaded via  --add-dir

Offen
#4,752 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

area:agents area:configuration
Vorherrschende Sprache
Shell
Sterne
11.2k
Forks
1.9k
Ø Merge
14 Std. 16 Min.
Gemergte PRs (30 T.)
6

Beschreibung

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
  1. Create a custom agent at  /.github/agents/my-agent.agent.md  with  user-invocable: true  in its frontmatter.
  2. Run:
    copilot --add-dir <some-dir> -p "List every custom agent name available to you via the task tool." --allow-all-tools
    my-agent appears in the list, confirming --add-dir loaded it correctly.
  3. 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, das Verhalten mit --add-dir und --agent unter Verwendung einer Datei .github/agents/my-agent.agent.md zu reproduzieren, deren Frontmatter user-invocable: true setzt. Vergleiche, wie das task tool diesen Agenten entdeckt, damit, wie die Option --agent auf oberster Ebene Namen validiert. Als erledigt gilt die Aufgabe, wenn --agent my-agent denselben benutzerdefinierten Agenten ohne den Fehler „No such agent“ auswählt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Bereich
cli
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Aktiv
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
68/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.