Repository navigation
fix(push): remove a carry folder the copy failed before any reset left - #1916
Conversation
`carryWorkingTree` copies the team clone's uncommitted changes to `teamai-push-carry-*` and then resets. One `catch` handled a copy failure as if the reset had run: it kept the folder and warned that the copies were the only source, when the originals were still in the working tree. Every failed push left another folder, and the warning pointed at an incomplete copy. A failure before the reset now removes the folder and says nothing was reset. A failure from the reset on keeps today's warning and the copies, since the reset may already have discarded the originals. Co-Authored-By: Claude Code <[email protected]>
|
No findings in the specified diff. The change removes partial copies only before reset starts and preserves the existing recovery behavior once reset may have discarded originals. The PR description meets the testing requirement: it records a representative real-CLI run, regression tests, type checking, and lint, and explicitly discloses that the copy-failure path was verified only at unit level. Review was read-only; no PR code was run, built, or installed. |
STiFLeR7
left a comment
There was a problem hiding this comment.
Verified head 642a2b1 on native Windows with Node 24.11.0.
All 24 tests across git-carry-failure-1880, git-checkout-credentials, push-team-config, and git-env passed with retries disabled. Replacing src/utils/git.ts with the parent implementation made the copy-failure regression fail with the raw copy error and a retained carry folder. Restoring the patch returned the regression to passing.
I read the diff and branch-preparation callers. The resetStarted flag distinguishes copies that can be discarded before reset from recovery copies that must be kept after reset starts. No blocking findings from this review.
The failure-path test injects the copy error. I did not reproduce the filesystem failure through the real CLI.
|
Status check on head Not bumping for urgency — this is ready for a maintainer look whenever it reaches the front of the queue. I am holding further work in this area until it lands so the copies stay independent. |
jeff-r2026
left a comment
There was a problem hiding this comment.
Validated PR #1916 at 642a2b1 integrated with main 2a79857: npm ci --ignore-scripts, typecheck, lint, build, focused tests (src/tests/git-carry-failure-1880.test.ts, retry 0), and built CLI --version passed. Existing representative real-CLI records and review comments checked. Approved for squash as requested by jeffyxu.
Summary
Fixes the fourth of the five bugs in #1880.
carryWorkingTreecopies the team clone's uncommitted changes toteamai-push-carry-*and then resets. Onecatchhandled a copy failure as if the reset had run: it kept the folder and warned that those copies were the only source — when nothing had been reset and the originals were still in the working tree. Each failed push left another folder, and the warning pointed at an incomplete copy.A failure before the reset now removes the folder and says the changes are where they were. A failure from the reset on keeps today's warning and the copies, since the reset may already have discarded the originals.
Type of Change
What changed
src/utils/git.ts—carryWorkingTreerecords when the reset starts. Before it: remove the temp folder and throw with the copy error as the cause. From it on: the existing warning and the kept copies.src/__tests__/git-carry-failure-1880.test.ts— a real git repo, withcopyRegularTreemocked to fail, asserting both halves of the outcome.Test plan
main:npx vitest run src/__tests__/git-carry-failure-1880.test.ts→ fails; the rejection is the rawCannot copy a FIFO pipe, with no "nothing was reset" and the temp folder left behind.teamai-push-carry-*folder was added toTMPDIR.git-carry-failure-1880+git-checkout-credentials+push-team-config+git-env: 24/24.npx tsc --noEmitclean,npm run lintpasses.Real CLI, happy path (
20261116T121017-f2a987, build642a2b18): a pendingteamai.yamledit, thenteamai push --branch review/ok→✔ Pushed branch review/ok. The carry ran to completion and left nothing behind, so the new path does not fire when nothing fails.What I could not reproduce in a world. The issue's own trigger — a
TMPDIRlong enough thatmkdtempsucceeds and the copy's path exceeds the limit — cannot be built there: with the verifier's own path prefix under it,mkdtempfails first (ENAMETOOLONG: … mkdtemp '/tmp/xxx…/teamai-push-carry-…'), which is a failure before the function is entered and proves nothing. The FIFO variant blocksgit addon the reader side and hangs the run. So the failing path is proved at unit level only, with the copy mocked; the real-CLI record above covers the path that must not change.Hit every surface
teamai push --branchis the only caller ofprepareExplicitBranch; plainpushdoes not carry.httpteams are read-only and never push.Notes for reviewers
teamai pushbugs: kept folder copies push never takes, an interrupted pre-push sync, a linked SKILL.md, a failed --branch carry, and self-mode leftovers #1880; the third and fifth are untouched and that issue should stay open.git reset --hardguarantees when it fails partway, and getting that wrong loses a member's edits.Disclosure
Implemented with AI assistance (Claude Code); every line reviewed and tested by the author.