Repository navigation
fix(skills): 按分支名记录的 git skill 更新时检出远端最新提交 - #2618
Merged
Merged
Conversation
缓存的源仓库里 `git checkout <分支>` 切到的是首次安装时建的本地分支,fetch 不会移动它,之后每次更新都装回首次安装时的提交。分支名现在按 fetch 后的 origin 远端跟踪分支检出(detached),tag / 提交照旧原样检出。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 30, 2026 14:55
This was referenced Oct 30, 2026
Owner
Author
|
#2622(根治 test (2/4) 那条偶发)已合入 |
Owner
Author
|
合码回执:已合入 master |
This was referenced Oct 30, 2026
|
@deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。 这次运行覆盖 54b28df…887309883(7 个提交),同批合入的还有 #2543 #2622 #2582 #2620 #2607 #2625,失败不一定由本 PR 引起。
|
This was referenced Oct 30, 2026
Owner
Author
|
合后核验:第一轮跑完且包含本 PR 的 master CI 是 |
|
🚀 Released in v3.56.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
Botmux 交流群的用户反馈:skill 远端仓库更新了,Dashboard /
botmux skill update显示更新成功,本地拿到的却还是旧内容。10-29 已复现:skill 源记录的ref是分支名时,更新永远停在首次安装时的提交。原因:
checkoutGitSource/checkoutGitSourceAsync在缓存的源仓库(~/.botmux/skills/sources/<id>)里执行git checkout <分支>。第一次检出会从远端跟踪分支建一个同名本地分支,之后的fetch --tags --prune只更新origin/<分支>,不会移动这个本地分支;再次checkout <分支>切到的还是本地旧分支,于是每次「更新」都把首次安装时的内容装回去。ref为HEAD(默认)的源走fetch origin HEAD+checkout FETCH_HEAD,不受影响。改了什么
src/services/skill-registry-store.ts的同步、异步两处检出:ref是 origin 上的分支时,按 fetch 后的refs/remotes/origin/<分支>检出;否则(tag、提交 SHA、origin/<x>这类写法)照原样检出。两种情况都用--detach,不再新建或复用本地分支。已经有本地旧分支的老缓存不用迁移:新逻辑不再看本地分支,下一次更新就会拿到远端最新提交。
checkoutTemporaryGitSource*(发现候选用的一次性临时克隆)每次都是全新 clone,本地分支就是远端当前位置,主 bug 不涉及它,未改;同名 tag/分支歧义角落的例外见「影响面」。影响面
ref记录为分支名的 git skill:更新时从「停在旧提交」变为「拿到远端最新提交」,这是修 bug 本来应有的行为(3.2 b)。ref为HEAD、提交 SHA 的源行为不变;tag 也基本不变,唯一例外是同一个名字同时作为远端分支名和 tag 名、且两者指向不同提交(git 自身视为歧义的罕见配置):安装/更新检出现在以远端分支为准并 detach,旧逻辑按 git 默认选 tag。checkoutTemporaryGitSource*仍按 git 默认解析(选 tag),与安装路径不一致:同名 tag/分支指向不同提交时,预览与安装可能看到不同内容;极端情况下预览列出的目录在安装侧已被分支侧删除,按名安装会落到ENOENT。follow-up:#2626(让临时克隆复用同一套 ref 解析,统一预览与安装)。source.ref仍记录用户写的分支名,source.commit记录实际检出的提交。/restart或新开会话才用到新内容(与之前一致)。验证
skill-git-install、skill-registry-store、skill-source-parity、skill-sources、skill-agentbuddy-install、skill-cli-commands→ 6 files / 135 passed。bunx tsc --noEmit本 PR 改动的文件无报错。本机 canonicalnode_modules缺 master 新加的@base-ui/react(searchable-group-picker.tsx报找不到模块),与本 PR 无关,交 CI 完整构建。release安装 → 在缓存里把本地release固定在首次提交(模拟老版本留下的缓存)→ 远端release前进一个提交 → 更新后 description 与source.commit都是远端新提交;同步、异步(Dashboard 任务)各一条;另一条确认按 tag 记录的源更新后仍停在 tag 指向的提交。变异验证:
git checkout <ref>git checkout <ref>--detach、不解析远端分支🤖 Generated with Claude Code