Repository navigation
fix(pull): don't skip sync when a submodule update changed the tree - #526
Merged
Merged
Conversation
`refreshTeamRepo` reports a failed submodule update so the caller holds `lastPullRev` back and retries next pull (#501). It does not cover the successful update: `getInstalledResourceTargets` only records which AI tools are installed, not which skills appeared, so filling an empty submodule leaves the parent SHA — the fast path's only cache key — untouched and the unchanged-rev fast path skips the deploy. That is the upgrade path in #525: a member pulls with a CLI that predates `submodules: true` (the unknown yaml key is stripped), so the parent SHA is cached with the submodule directories still empty. Upgrading the CLI and pulling fills the clone, then reports "Already synced at <rev>, skipping" and the tool directories stay empty until `pull --force` or an unrelated parent commit. Compare `git submodule status` before and after the update and carry the result into the fast path as `submodulesChanged`. The leading status char is `-` while uninitialized and ` `/`+` once checked out, so a changed string means the on-disk tree the deploy step reads is not what was cached. The fast path only skips when the update left the tree alone, so a submodule-using team still takes it in steady state instead of paying a full re-deploy on every pull. An unreadable status degrades to "changed": a redundant full sync is cheap and self-correcting, whereas wrongly skipping re-pins the empty tool directories this fixes. It is only the status read that degrades — an update failure still reaches the outer catch and holds the rev back. Fixes #525
88lin
force-pushed
the
fix/pull-submodule-skip-sync
branch
from
September 11, 2026 17:47
5adda20 to
770e4cc
Compare
Walternater
pushed a commit
to Walternater/teamai-cli
that referenced
this pull request
Nov 2, 2026
…encent#526) `refreshTeamRepo` reports a failed submodule update so the caller holds `lastPullRev` back and retries next pull (Tencent#501). It does not cover the successful update: `getInstalledResourceTargets` only records which AI tools are installed, not which skills appeared, so filling an empty submodule leaves the parent SHA — the fast path's only cache key — untouched and the unchanged-rev fast path skips the deploy. That is the upgrade path in Tencent#525: a member pulls with a CLI that predates `submodules: true` (the unknown yaml key is stripped), so the parent SHA is cached with the submodule directories still empty. Upgrading the CLI and pulling fills the clone, then reports "Already synced at <rev>, skipping" and the tool directories stay empty until `pull --force` or an unrelated parent commit. Compare `git submodule status` before and after the update and carry the result into the fast path as `submodulesChanged`. The leading status char is `-` while uninitialized and ` `/`+` once checked out, so a changed string means the on-disk tree the deploy step reads is not what was cached. The fast path only skips when the update left the tree alone, so a submodule-using team still takes it in steady state instead of paying a full re-deploy on every pull. An unreadable status degrades to "changed": a redundant full sync is cheap and self-correcting, whereas wrongly skipping re-pins the empty tool directories this fixes. It is only the status read that degrades — an update failure still reaches the outer catch and holds the rev back. Fixes Tencent#525
2 of 6 tasks
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.
Summary
Fixes the second half of the review note on #501: don't skip when the update succeeded and the tree changed.
refreshTeamRepoalready reports a failed submodule update so the caller holdslastPullRevback and retries (#501). The successful update was not covered.getInstalledResourceTargetsonly records which AI tools are installed, not which skills appeared, so filling an empty submodule leaves the parent SHA — the fast path's only cache key — untouched, andAlready synced at <rev>, skippingsuppresses the deploy.That is the upgrade footgun described in #525: a member pulls with a CLI that predates
submodules: true(the unknown yaml key is stripped), so the parent SHA is cached while the submodule directories are still empty. Upgrading the CLI and pulling fills the clone, reports "Already synced", and~/.claude/skills(etc.) stay empty untilteamai pull --forceor an unrelated parent commit moves HEAD.Type of Change
Test Plan
npx tsc --noEmitpassesnpx vitest runpasses for the affected suites (pull-skip-sync,pull-submodule-skip-sync: 15 passed). Full-suite runs on this Windows dev box have pre-existing failures in the suites that shell out to a corporate git host; not related to this change.Red → green, unit (
src/__tests__/pull-skip-sync.test.ts). New case: parent rev already cached,git submodule statusmoves from-(uninitialized) to(checked out). Reverting onlysrc/pull.tson unmodifiedmain:Companion case pins the steady state so the fix cannot silently become "always full sync": an update that changes nothing still takes the fast path.
Red → green, real CLI pull (
src/__tests__/pull-submodule-skip-sync.test.ts, real bare remotes + a real submodule, no simple-git mock, followingcontribute-self-learnings.test.ts). The fixture clones the team repo without--recurse-submodulesand seeds state with the current parent SHA, i.e. exactly the issue's member. Reverting onlysrc/pull.ts:With the fix,
skills/common/distributed-skill/SKILL.mdreaches~/.claude/skillson that pull. The second case asserts the fast path is still taken when the submodule was already populated.Related Issues
Fixes #525
Follow-up to #501.
Notes for Reviewers
Only a real change invalidates the fast path. The obvious fix — always bypass skip-sync when
submodules: true— would make every pull in a submodule-using team pay a full re-deploy forever. Instead this capturesgit submodule statusbefore and after the update and treats a changed string as "the tree the deploy step reads is not what was cached". The leading status char is-while uninitialized and/+(checkout behind its pin) afterwards, so both the fill-from-empty and pin-advance cases are covered. A team whose submodules are already current keeps taking the fast path.Degradation direction. An unreadable
submodule statusis treated as changed: a redundant full sync is cheap and self-correcting, whereas wrongly skipping re-pins the empty tool directories this fix exists to clear. Only the status read degrades — the update itself still fails into the existing outercatch, so thesubmodulesFailedrev hold-back from #501 is untouched.Scope. No behavior change for the HTTP and single-repo backends (both return
submodulesChanged: false), and none for repos without thesubmodulesknob.submodulesChangedonly gates this run's fast path; it is not persisted, matchingsubmodulesFailed.Verified on Windows; the submodule protocol guard (
protocol.file.allow) needed by the local-path fixture lives in a temp global config the test writes outside its own temp root, sobeforeEachcannot drop it.