Repository navigation
feat(pull): opt-in git submodule population on pull (teamai.yaml submodules) - #501
Conversation
|
@flowjzh This branch conflicts with Also: |
65cd565 to
7be5b56
Compare
|
Rebased onto current main (the conflict was our two knobs landing on adjacent Fair catch on the rev cache — the failure mode you describe (failed submodule update still persists the new rev → every later pull takes the unchanged-rev fast path → tool dirs stay empty forever) is real. Fixed: The failure semantics are now documented in the usage guide (en + zh-CN): warn + revision held back → next pull re-syncs and retries. |
|
Reviewed the diff against the surrounding code, checked out the head, ran 🔴 Blocking —
|
Teams that distribute skills as git submodules get an empty directory after
clone/fetch - the submodules are never populated, so every resource deploy
silently misses their content.
Add a teamai.yaml knob (off by default):
submodules: true
After each repo refresh (and before the resource deploy step, so freshly
checked-out content is what gets deployed), pull runs
`git submodule update --init`. Deliberately not shallow: submodules are
pinned to exact SHAs, and a shallow fetch only brings the remote tip, so
checking out any older pin fails with "reference is not a tree" - the full
history guarantees the pinned commit is always present.
A failed submodule update does not abort the pull (best-effort warn), but it
also must not persist the new rev: the parent-repo SHA is the
incremental-sync cache key, and caching it while the tree is incomplete
would let the unchanged-rev fast path suppress the retry on every later
pull - tool directories would stay empty forever. refreshTeamRepo therefore
reports submodulesFailed and pullForScope skips the rev persistence for that
run, so the next pull re-runs a full sync and retries the update.
Documented in docs/usage-guide (en + zh-CN), including the auth caveat for
private submodules on token-injecting hosts. Unit tests cover the
submodulesFailed -> rev-not-persisted invariant.
7be5b56 to
90efd43
Compare
|
Rebased onto current main, and the Dropped Kept the rev hold-back. With the deterministic Also addressed the non-blocking items:
(The third |
…526) `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
Tencent#501) Teams that distribute skills as git submodules get an empty directory after clone/fetch - the submodules are never populated, so every resource deploy silently misses their content. Add a teamai.yaml knob (off by default): submodules: true After each repo refresh (and before the resource deploy step, so freshly checked-out content is what gets deployed), pull runs `git submodule update --init`. Deliberately not shallow: submodules are pinned to exact SHAs, and a shallow fetch only brings the remote tip, so checking out any older pin fails with "reference is not a tree" - the full history guarantees the pinned commit is always present. A failed submodule update does not abort the pull (best-effort warn), but it also must not persist the new rev: the parent-repo SHA is the incremental-sync cache key, and caching it while the tree is incomplete would let the unchanged-rev fast path suppress the retry on every later pull - tool directories would stay empty forever. refreshTeamRepo therefore reports submodulesFailed and pullForScope skips the rev persistence for that run, so the next pull re-runs a full sync and retries the update. Documented in docs/usage-guide (en + zh-CN), including the auth caveat for private submodules on token-injecting hosts. Unit tests cover the submodulesFailed -> rev-not-persisted invariant. Co-authored-by: flowjzh <[email protected]>
…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
Summary
Teams that distribute skills as git submodules currently get an empty directory after clone/fetch - the submodules are never populated, so every resource deploy from the team repo silently misses their content. This PR adds a
teamai.yamlknob:After each repo refresh (and before the resource deploy step, so the freshly checked-out content is what gets deployed), pull runs
git submodule update --init --depth 1. Off by default; gated on the knob being exactlytrue. Documented in docs/usage-guide (en + zh-CN).Type of Change
Test Plan
npx tsc --noEmitpassesnpx vitest runpasses on macOS (full suite) and Windows (no new failures vs. the pre-existing Windows platform failures)git submodule updatecall behind two config gates; happy to add a mocked test if reviewers want one.Verified end-to-end in a 20-member production fleet (submodule-distributed skill, populated on every member machine via session-start sync).
Notes for Reviewers
refreshTeamRepo; a follow-up could move it next topullRepoinsrc/utils/git.tsso other clone-tree consumers get populated submodules too. Did not do that here to keep the diff additive.loadTeamConfigre-parses the yaml once per refresh for the knob; the file was just written by the pull seconds earlier, so caching felt premature.