Repository navigation
fix(push): guard stale self-mode skill directories - #1333
Conversation
|
No confident findings in the specified PR diff. The PR description documents sufficient testing, including representative real built-CLI E2E runs for stale-copy rejection and safe-copy publishing. Additional provider/agent coverage is explicitly deferred and is not blocking. Review was read-only; no PR code was run, built, or installed. |
There was a problem hiding this comment.
This was generated by AI during triage.
@nateEc Thanks, approving. This fixes the skill case of #1326. The two agent-format cases stay open, as the body says.
We built this head, its merge-base 6c57c3b7 and main 83f6d1db, and ran #1326's repro with the real CLI: a teammate appends to a skill's SKILL.md on main, the member edits the same skill in a self-mode checkout behind main and runs teamai push --all.
- base and main: exit 1 after pushing a branch whose
SKILL.mddrops the teammate's line. - this head: exit 2 with "
.teamai/skills/demochanged both here and on origin/main ... Nothing was pushed", and no branch. - a teammate-only change still pushes without listing the skill, on both builds.
self-mode-push-behind.test.ts passes 13/13 here, and the four new refusal cases fail on base. tsc, lint and the push unit tests pass.
Suggestions:
[P2 non-blocking]The tests only cover an edited file. We checked by hand that a teammate adding or deleting a file inside the skill also stops the push here (base drops or resurrects the file). A test for one of them would pin it.[P3 nit]The "Broad validation" paragraph describes a combined snapshot of several branches, not this diff. The stop message could also name the file that changed on main.
CI review: it reported no confident findings and accepted the testing record. We agree; our runs above back it.
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
@nateEc CI is red at the approved head f100a6d2, so this review supersedes the approval until the regression checks are resolved.
- [P1 blocking] E2E shard 1/3 fails both stale-skill-copy cases in
src/__tests__/e2e/push-sync-followups-823.test.ts, including the genuine-local-edit case. Both fail again on retry, and the aggregate E2E job fails. Please reconcile these tests with the intended stale-copy refusal while preserving their assertions about local edits and deleted branch files, then get CI green. This CI run does not establish whether the base also fails.
The earlier review verified the intended stale-copy behavior through the built CLI, but did not cover these regression cases. CI review reported no confident findings and accepted the real-CLI testing record. The record is sufficient; the failing regression jobs still block merge.
- Compare default-branch changed blobs below both skill source and destination directories, including reference files and deletions. - Stop selected edited skills with exit 2 before publication when their local files would replace an upstream change; keep accepting copies that already contain the upstream blobs. - Update the English and Chinese sharing guidance and the member contribution reference to describe the whole-directory guard. - Verify four failing-before-fix real-CLI scenarios, the 12-case self-mode E2E suite, a safe-copy E2E case, 25 focused tests, type checking, lint, and a production build.
- 将双方改动的技能用例对齐到明确拒绝推送的新契约,断言退出码 2 和未推送提示。 - 保留对成员真实编辑和本地删除文件的检查,确保安全拒绝不会丢失编辑或复活已删除文件。 - 原先失败的两个回归用例现已通过,所在真实 CLI 文件 19 个用例全部通过;类型检查和 lint 通过。
f100a6d to
877b95f
Compare
|
Addressed the review follow-up at
The PR description contains the updated verification record. Ready for another review. |
|
No confident findings in the specified PR diff. The earlier pass raised no findings requiring resolution. The PR description documents sufficient testing, including representative built-CLI E2E runs for stale-copy rejection and safe-copy publishing. Additional provider/agent coverage is explicitly deferred and is not blocking. Review was read-only; no PR code was run, built, or installed. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
@nateEc Thanks, approving at 877b95f. The red E2E shard is fixed. The two stale-skill-copy cases in push-sync-followups-823.test.ts now assert the refusal and keep their checks on the local edit and the deleted branch file. The change since the last review is test-only. Both PR e2e files pass, 13/13 and 19/19, also with a symlinked TMPDIR. With the built CLI and #1326's reproduction, main pushes over the teammate's line, and this head stops with exit 2 and pushes nothing. Build, tsc, lint and the unit files pass.
This covers #1326's skill case. The two agent-format cases in that issue are #1339's, and the two PRs merge cleanly.
- [P2 non-blocking] No guard test covers a teammate adding or deleting a file inside a skill. The per-file classification should catch both, going by the code, but nothing runs it.
- [P3 nit] The stop message names the skill but not the file that changed on
main. The body's "Broad validation" paragraph describes an older combined snapshot.
The CI review reports no findings. We agree that nothing blocks now. At the previous head it also reported none while E2E shard 1/3 was red. All CI jobs pass, and the GitHub-provider job is skipped.
* fix(push): guard stale self-mode skill directories - Compare default-branch changed blobs below both skill source and destination directories, including reference files and deletions. - Stop selected edited skills with exit 2 before publication when their local files would replace an upstream change; keep accepting copies that already contain the upstream blobs. - Update the English and Chinese sharing guidance and the member contribution reference to describe the whole-directory guard. - Verify four failing-before-fix real-CLI scenarios, the 12-case self-mode E2E suite, a safe-copy E2E case, 25 focused tests, type checking, lint, and a production build. * test(push): 验证过期技能冲突时保留本地改动 - 将双方改动的技能用例对齐到明确拒绝推送的新契约,断言退出码 2 和未推送提示。 - 保留对成员真实编辑和本地删除文件的检查,确保安全拒绝不会丢失编辑或复活已删除文件。 - 原先失败的两个回归用例现已通过,所在真实 CLI 文件 19 个用例全部通过;类型检查和 lint 通过。
Summary
A self-mode checkout behind the default branch could push an edited skill over a teammate's newer files because the guard only matched file paths. Check changed blobs below the skill's source and destination directories and stop with exit 2 before publishing a stale copy. A copy that already includes the upstream changes can still be pushed.
Type of Change
Test Plan
npx tsc --noEmitpassesnpm run lintpassesnpx vitest runpasses entirely (known baseline failures documented below)Added/updated tests for the change
npm run buildpassesnpx vitest run src/__tests__/self-mode-push-scan.test.ts src/__tests__/push-namespaces.test.ts: 25 passed.Real built CLI:
self-mode-push-behind.test.tsthrough the E2E config: 12 passed, then the added safe-copy case passed separately. Four new cases failed on unmodified main and now stop with exit 2, push no branch, and preserve the teammate's SKILL.md/reference file. The cases include a local deletion and edits to different files. The safe-copy case publishes both the upstream reference and the author's edit.Broad validation: combined type check, lint, build, and 10 critical real-CLI E2E cases passed. The full five-branch unit run took 614.07s: 499 files; 12,244 passed, 36 skipped, 7 failed. Five failures came from the recall acceptance harness reading the old OpenCode argv position; a one-line test-only adapter fix preserves the attribution assertions. All 221 OpenCode/recall tests pass on the final combined snapshot after that correction; runtime source did not change.
The remaining two failures are independently reproduced on clean
6c57c3b7with Apple Git 2.50.1:submodule-checkout.test.tscannot readhook.teamai-post-checkout.commandafter preserving empty legacy Claude/Codex settings (24 passed, 2 failed on clean main). The full-suite checkbox stays unchecked for these baseline failures.Local verification used macOS, Node 22.22.1, and local Git fixtures. GitLab/GitHub provider runs and additional live agent/Windows coverage were not run locally; remote CI cases may skip without credentials.
Related Issues
Related #1326: fixes the skill-directory overwrite reproduction. The separate agent-format cases in that issue remain for follow-up, so this PR does not close the whole issue.
Notes for Reviewers
Skills are published as directories, so an edit in one file cannot authorize replacing a stale upstream file elsewhere in the same skill. The guard still applies only to selected outgoing items. English/Chinese sharing docs and the member contribution reference describe the retry.
Follow-up verification (2026-10-25)
Nothing was pushed, and still assert the member's edit remains and a locally deleted branch file stays absent. Existing stale-but-unedited cases still pass.push-sync-followups-823.test.ts: 19 passed (the two old expectations failed before adjustment). Build, type checking and lint passed.Updated head:
877b95f75077590054fcb62096eb380f7e2f4251. Rebased onto main6ebb31ce.