Desktop app: custom agents from .github/agents missing in fresh worktree sessions — config discovery runs before the deferred checkout populates the tree and agents are never re-scanned
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- git, github, shell
调研方向
Inspect the session.create config-discovery entry point and the app's post-attach extensibility refresh; the payload names no source files or tests. Run the deterministic CLI-only repro with deferred checkout, then verify that a fresh session exposes custom .github/agents entries after checkout, not only after resume.
由索引模型根据 Issue 内容生成。
描述
Summary
In the desktop app, a new worktree session frequently ends up with only the 7 built-in task agent types (explore, task, general-purpose, rubber-duck, code-review, research, security-review). The repo's custom agents in .github/agents/*.agent.md are missing for the life of the session, even though glob/ls in the same session see the files.
Root cause is a race between two things:
- App: the worktree is created with
deferred_checkout=true(returns in ~30 ms with an empty tree) andsession.create(enable_config_discovery=true) is issued 7–600 ms later, while the file populate takes 3–5 s. - CLI: custom agents are discovered **exactly once, during
session.create**, and never re-scanned. If.github/agents/isn't on disk at that instant, the session never gets them.
The app's post-attach "extensibility live-session refresh" reconciles plugins / mcp / extensions / skills — there is no agents dimension — which is why skills and project extensions survive the deferred checkout but custom agents don't.
Environment
- GitHub Copilot desktop app 1.1.23 (commit
d1a29ed), macOS arm64, bundling CLI 1.0.87-0 - CLI-only repro also reproduces on 1.0.83-5 and 1.0.84-5 (cached binaries from earlier app versions) — the one-shot discovery is long-standing; the deferred checkout has been on since app 1.1.14
- Repo: private Azure DevOps repo with 25 agents in
.github/agents/
App timeline (from ~/.copilot/logs/github-app.<pid>.log)
Session that lost the race (task enum = built-ins only):
10:10:53.540 github_app_git::worktree create worktree completed ... existing_branch=false sparse=false deferred_checkout=true elapsed_ms=31
10:10:53.566 github_app::session::core creating session session_id="7085…" ... enable_config_discovery=true
10:10:57.101 workspace::handlers::init deferred worktree checkout complete ... populate_ms=3540
10:11:24.329 github_app::session::core CLI session created ... create_session_rpc_ms=30762 enable_config_discovery=true
Session that happened to win it (tool-created; session.create started ~0.9 s into the populate, and .github/ is checked out first alphabetically) got all 25 custom agents. Same app, same repo, same CLI — the outcome depends on milliseconds.
Extensibility refresh (only runs for resumed sessions, and has no agents field):
extensibility live-session refresh completed session_id=… plugins_stale=false mcp_stale=false extensions_stale=true skills_stale=true extensions_reconciliation_needed=true … target_session_skills=0 duration_ms=46
Deterministic CLI-only repro (no app involved)
# empty worktree, populated 3 s after the session starts
git worktree add --no-checkout /tmp/wt-empty -b probe origin/dev
cd /tmp/wt-empty
( sleep 3; git reset -q --hard ) &
copilot -s -p 'Step 1: run bash `sleep 20; ls .github/agents | wc -l`. Step 2: print verbatim, as a JSON array, every value in the enum of the agent_type parameter of your task tool. Step 3: run glob `.github/agents/*.agent.md` and report the count.' --allow-tool shell --allow-tool glob
Result (1.0.87-0, also 1.0.83-5 and 1.0.84-5):
Step 1: 25
Step 2: ["explore","task","general-purpose","rubber-duck","code-review","research","security-review"]
Step 3: 25 matches
Control — same worktree, already populated, fresh session → 32 values (7 built-ins + 25 custom).
copilot --resume <the broken session> in the populated worktree → 32 values. Resume re-discovers; nothing else does.
Impact
Any workflow that dispatches task agent_type: <custom> fails in these sessions with Unknown agent_type: <name> (first seen here 2026-09-14 on app 1.1.20, again today), often 20–30 minutes into a run. Users read this as "custom agents randomly don't load".
Workarounds
- Close and reopen (resume) the session — or restart the app — before running anything that needs custom agents.
- Branch-type sessions (existing checkout) are unaffected.
Suggested fixes
- CLI: re-scan
.github/agents/at prompt time (or watch the directory) — the same class of fix 1.0.85 shipped for skills ("skills no longer missing when a skills load races the directory registration"). - App: await
deferred worktree checkout completebeforesession.createon kickoff; and/or add an agents dimension to the extensibility live-session refresh and run it after populate for fresh sessions.
Related but separate (same machine, fixed in 1.1.23): #4905. App and CLI process logs for the sessions above are available on request.
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 6
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/copilot-cli 的其他 Issue
-
triage
难度 2/5 1-3 小时 新手友好度 75/100
github/copilot-cli#4932 ·
-
triage
难度 2/5 1-3 小时 新手友好度 78/100
github/copilot-cli#4909 ·
-
triage
难度 2/5 1-3 小时 新手友好度 76/100
github/copilot-cli#4906 ·
-
triage
难度 2/5 1-3 小时 新手友好度 72/100
github/copilot-cli#4848 ·
-
area:agents area:mcp
难度 2/5 1-3 小时 新手友好度 72/100
github/copilot-cli#4729 ·
查看 github/copilot-cli 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
elastic/gradle-plugins#156 ·
-
Priority/High ready-for-agent Severity/Major Type/Bug
难度 2/5 1-3 小时 新手友好度 75/100
-
comp/cli P3 type/docs
难度 2/5 1-3 小时 新手友好度 75/100
NousResearch/hermes-agent#119756 · 1 条评论 ·
-
comp: build/pipeline type: bug version: current (v17+)
难度 2/5 1-3 小时 新手友好度 74/100
angular/angularfire#3766 ·
-
out-of-date
难度 2/5 1-3 小时 新手友好度 70/100
CachyOS/CachyOS-PKGBUILDS#1903 ·