github / github/app

Custom-agent session creation races deferred worktree checkout and fails with “Custom agent not found”

Aperta
#3,776 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

triage
Lingua principale
Nessun dato sulla lingua
Stelle
2.1k
Fork
157
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Short summary

Custom-agent session creation races deferred worktree checkout and fails with “Custom agent not found”

Affected version or release

1.1.19

Installation context
  • GitHub Copilot App: 1.1.19
  • Bundled Copilot CLI: 1.0.84-4
  • OS: Windows 11, x86_64
  • Project type: local Git repository
  • Session workspace type: worktree
What happened?

Starting a new worktree session with a repository-defined custom agent selected for the initial kickoff intermittently or consistently fails with:

Failed to create session: RPC error -32603: Request session.create failed with message: session construction failed: Custom agent 'orchestrator' not found
Repository setup

The default branch contains:

.github/
└── agents/
    └── orchestrator.agent.md

The agent is visible in the custom-agent selector before session creation.

Steps to reproduce
  1. Open a local Git repository in GitHub Copilot App.
  2. Commit a user-invocable custom agent to:
    .github/agents/orchestrator.agent.md.
  3. Create a new worktree-backed session.
  4. Select orchestrator as the custom agent.
  5. Provide an initial kickoff prompt so the session starts immediately.
  6. Create the session.

Session creation fails:

RPC error -32603: Request session.create failed with message:
session construction failed: Custom agent 'orchestrator' not found

The worktree itself is created, but its session does not start with the selected agent.

Expected behavior

The application completes checkout of the new worktree before constructing the session, or resolves the selected repository agent from the project's existing checkout.

The worktree session starts using the selected orchestrator agent.

Additional context
Impact

Repository custom agents cannot reliably be selected when creating worktree-backed sessions with an initial prompt.

Suspected cause

Worktree creation and session construction are running concurrently:

  1. An incomplete worktree is exposed with deferred_checkout=true.
  2. session.create performs repository configuration discovery.
  3. .github/agents/ has not been populated yet.
  4. Validation of the selected agent fails.
  5. Deferred checkout completes afterward.
Log evidence

The relevant sequence is:

12:02:07.979  create worktree completed
                 deferred_checkout=true

12:02:08.327  kickoff: creating session

12:02:08.334  session.create begins with
                 enable_config_discovery=true

12:02:08.621  session creation failed:
                 Custom agent 'orchestrator' not found

12:02:10.864  deferred worktree checkout complete
Suggested fixes
  1. Make agent-dependent session.create wait for deferred checkout completion.
  2. Resolve the selected repository custom agent from the project's fully populated main checkout while the worktree is being initialized.
  3. Preload the selected agent profile before beginning deferred checkout.
  4. Disable deferred checkout when the kickoff specifies a repository-defined custom agent.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia tracciando session.create e il checkout differito del worktree usando i passaggi di riproduzione e la sequenza di log fornita. Esamina come viene individuato .github/agents/orchestrator.agent.md prima e dopo il checkout. Il lavoro è completato quando un avvio basato su worktree inizia in modo affidabile con l’agente del repository selezionato e l’ordine del checkout e della costruzione della sessione è coperto dai test pertinenti del progetto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
git, github
Ambito
desktop, developer-experience
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
52/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.