skills-init: commit-SHA skill refs never start (git checkout -- <sha> reads the SHA as a pathspec)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 84/100
调研方向
阅读 go/core/internal/skillsinit/git.go,重点关注 CloneGit 和 Full refs 的 checkout 路径。issue 提供了一个仅使用 Git 的最小复现;确认 checkout 参数是如何传递的,然后检查附近与此行为相关的测试。当提交 SHA refs 能在 0.10 系列上成功 checkout,且 branch 和 tag refs 仍能正常工作时,即为完成。
由索引模型根据 Issue 内容生成。
描述
What happens
An agent whose skills pin a commit SHA never leaves Init. skills-init fails with:
error: pathspec '<sha>' did not match any file(s) known to git
skills-init: clone <url>: exit status 1
Agents that pin a branch or tag are fine.
Why
CloneGit in go/core/internal/skillsinit/git.go takes the Full path for a commit SHA and runs:
if err := runGitIn(ref.Dest, "checkout", "--", ref.Ref); err != nil {
With the -- separator, git treats everything after it as a pathspec, not a revision. So the SHA is looked up as a file name and the checkout fails. The commit is present in the clone; only the argument parsing is wrong.
The comment above the call says the separator is there so "a ref starting with -" cannot be parsed as a flag, and notes that refs are already validated as 40-char hex when Full is true. That validation is real — the controller sets Full from isCommitSHA, which is ^[0-9a-fA-F]{40}$ — so a 40-character hex string can never be an option and the separator protects nothing.
Minimal reproduction
No kagent needed; this is plain git:
git clone https://github.com/<any>/<repo>.git /tmp/r
cd /tmp/r
git checkout -- "$(git rev-parse HEAD)" # error: pathspec ... did not match any file(s) known to git
git checkout "$(git rev-parse HEAD)" # works
Fix
Drop the separator:
if err := runGitIn(ref.Dest, "checkout", ref.Ref); err != nil {
git checkout <sha> -- (separator last) also works, but the plain form is what the surrounding comment already describes.
Versions
Present in v0.10.4, v0.10.5 and v0.10.6 — the same line in all three.
Already fixed on main / v1.0.0-rc3, where CloneGit was rewritten to git fetch --depth 1 origin <commit> followed by git checkout --detach FETCH_HEAD. So this only affects the 0.10 line.
Impact
Any agent using skills.gitRefs with a commit SHA — which is the recommended way to pin skills — cannot start on 0.10.x. Branch and tag refs are unaffected.
- 主要语言
- Go
- 星标
- 4.1k
- 派生
- 871
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 183
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
kagent-dev/kagent 的其他 Issue
-
Gemini catalogs omit gemini-4-argon and gemini-3.8-flash可能已有人在做 @jayunit100 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
kagent-dev/kagent#3524 · 1 条评论 ·
维护者通常 1 天内回复
-
Don't add the provider's public host to egress when a ModelConfig sets baseUrl可能已有人在做 @lakshyab20 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 81/100
kagent-dev/kagent#3507 · 1 条评论 ·
维护者通常 1 天内回复
-
[BUG] OpenAI and Ollama adapters send an empty tool message when a tool returns a dict可能已有人在做 @helloxjade 于 6 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
kagent-dev/kagent#3462 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
kagent-dev/kagent#3428 · 1 条评论 ·
维护者通常 1 天内回复
-
[BUG]可能已有人在做 @helloxjade 于 10 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 65/100
kagent-dev/kagent#3385 · 1 条评论 ·
维护者通常 1 天内回复
查看 kagent-dev/kagent 的全部 Issue
相似的 Issue
-
agent-butler-finding chore
难度 1/5 1 小时以内 新手友好度 88/100
jordansmall/spindrift#6695 ·
维护者通常 1 天内回复
-
book-layout.spec fails when the similar-books rail holds other projects' books可能已有人在做 @praetorianer777 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
praetorianer777/GoTome#373 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 80/100
-
/shutdown/ready can fail to return an HTTP response when readiness takes longer than the server write timeout可能已有人在做 @floriankoch 今天认领。 未关闭triage
难度 2/5 1-3 小时 新手友好度 76/100
envoyproxy/gateway#10562 ·
维护者通常 1 天内回复
-
Adding an LDAP group reports every search failure as "LDAP Group DN is not found"可能已有人在做 @Daksha1611 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复