Repository navigation
fix(push): update the open PR instead of opening duplicates - #350
Merged
Merged
Conversation
`teamai push` diffs against the team repo's default branch, where a resource waiting in an unmerged PR is absent — so every run flagged it as new and opened another PR, and the timestamped branch names kept git-level deduplication from kicking in. Push now records each branch, PR URL and its resources in the machine-local state, and splits the selection into one branch/PR per group: - Resources already in an open PR force-push that branch, updating the PR in place and reusing its original namespace. An unchanged tree is not pushed, so a repeated push is a no-op. - Everything else still gets its own new PR, so unrelated resources are never pulled into someone else's review. A partially selected PR also goes to a new PR, with a warning. - Records are pruned once the branch is gone from origin or its resources reach the default branch, and kept when the remote is unreachable. The listing marks these resources with `awaiting review: <url>`. Co-authored-by: Cursor <[email protected]>
jeff-r2026
self-requested a review
August 27, 2026 09:30
Merged
7 tasks done
jeff-r2026
added a commit
that referenced
this pull request
Aug 28, 2026
Address two correctness bugs found in review of the #350 follow-up: - push --skill force-construct: when the scanner returns nothing for the target skill (local content is byte-identical to the team repo), the matchedItem was pushed into allItems but not fullScan, so prunePendingPushes dropped the skill's OWN open-PR record and the next run opened a duplicate. Add the force-constructed item to fullScan too. - pushRepoBranch: three early-exit paths deleted the local branch right after switchToDefaultBranch, but when the default branch is held by another worktree the switch returns silently with HEAD still on the push branch, and `git branch -D` then throws an uncaught error out of the function. switchToDefaultBranch now reports whether it actually switched, and a new leaveAndDeletePushBranch helper skips the delete when it didn't. Tests: - force-constructed --skill keeps its own open-PR record (real skill dir on disk to exercise the force-construct path; fails without the fullScan fix). - pushRepoBranch skips the delete without throwing when the default branch is busy in another worktree (fails without the guard). - push-team-config: assert the catch path lands back on 'main' (not just off the stuck branch) and move logSpy.mockRestore into finally.
jeff-r2026
added a commit
that referenced
this pull request
Aug 31, 2026
…lus review follow-ups (#359) * fix(push): preserve other resources' open-PR records under --skill, plus review follow-ups Follow-up fixes for the #350 open-PR-update feature, found in code review: - push --skill: prune pending-push records against the full scan, not the narrowed single-skill list. Narrowing dropped every OTHER resource's open-PR record and the next run opened duplicate PRs for them. - pushRepoBranch (reuse, no-op): delete the local branch when the rebuilt tree already matches the remote, matching the other early-exit paths so stale local branches don't accumulate. - pushTeamConfigOnly: switch back to the default branch in the catch path so a mid-push failure never strands the team repo on the push branch. - hasCommits: correct the comment to describe the real guard (the catch block), the command uses no --quiet. - push: replace Chinese comment and error string with English (CLAUDE.md). - docs: document the update-open-PR behavior in README (both langs) and usage-guide (both langs). * fix(push): handle force-construct prune + multi-worktree branch delete Address two correctness bugs found in review of the #350 follow-up: - push --skill force-construct: when the scanner returns nothing for the target skill (local content is byte-identical to the team repo), the matchedItem was pushed into allItems but not fullScan, so prunePendingPushes dropped the skill's OWN open-PR record and the next run opened a duplicate. Add the force-constructed item to fullScan too. - pushRepoBranch: three early-exit paths deleted the local branch right after switchToDefaultBranch, but when the default branch is held by another worktree the switch returns silently with HEAD still on the push branch, and `git branch -D` then throws an uncaught error out of the function. switchToDefaultBranch now reports whether it actually switched, and a new leaveAndDeletePushBranch helper skips the delete when it didn't. Tests: - force-constructed --skill keeps its own open-PR record (real skill dir on disk to exercise the force-construct path; fails without the fullScan fix). - pushRepoBranch skips the delete without throwing when the default branch is busy in another worktree (fails without the guard). - push-team-config: assert the catch path lands back on 'main' (not just off the stuck branch) and move logSpy.mockRestore into finally. * test(push): pin bare repo default branch to main in initTeamRepos CI failed on `config-only: switches back to the default branch when the push throws` with `expected '' to be 'main'`. Root cause: the test harness's `git init --bare` inherits the runner's init.defaultBranch. On a runner where that is `master` (GitHub's ubuntu/macos images), the bare HEAD points at `master` while the seed only ever pushes `main`, so `git clone` lands on an unborn HEAD and the working clone has no local `main`. simple-git then reports `.branch().current` as '' — which the tightened assertion (toBe('main'), added for the reviewer's nit) surfaced. Fix: pass --initial-branch=main to the bare init so the clone checks out main regardless of the runner's git default. Reproduced locally with GIT_CONFIG_GLOBAL forcing init.defaultBranch=master (full suite: 2341 pass).
Walternater
pushed a commit
to Walternater/teamai-cli
that referenced
this pull request
Nov 2, 2026
) `teamai push` diffs against the team repo's default branch, where a resource waiting in an unmerged PR is absent — so every run flagged it as new and opened another PR, and the timestamped branch names kept git-level deduplication from kicking in. Push now records each branch, PR URL and its resources in the machine-local state, and splits the selection into one branch/PR per group: - Resources already in an open PR force-push that branch, updating the PR in place and reusing its original namespace. An unchanged tree is not pushed, so a repeated push is a no-op. - Everything else still gets its own new PR, so unrelated resources are never pulled into someone else's review. A partially selected PR also goes to a new PR, with a warning. - Records are pruned once the branch is gone from origin or its resources reach the default branch, and kept when the remote is unreachable. The listing marks these resources with `awaiting review: <url>`. Co-authored-by: JasonRUAN <[email protected]> Co-authored-by: Cursor <[email protected]>
Walternater
pushed a commit
to Walternater/teamai-cli
that referenced
this pull request
Nov 2, 2026
…lus review follow-ups (Tencent#359) * fix(push): preserve other resources' open-PR records under --skill, plus review follow-ups Follow-up fixes for the Tencent#350 open-PR-update feature, found in code review: - push --skill: prune pending-push records against the full scan, not the narrowed single-skill list. Narrowing dropped every OTHER resource's open-PR record and the next run opened duplicate PRs for them. - pushRepoBranch (reuse, no-op): delete the local branch when the rebuilt tree already matches the remote, matching the other early-exit paths so stale local branches don't accumulate. - pushTeamConfigOnly: switch back to the default branch in the catch path so a mid-push failure never strands the team repo on the push branch. - hasCommits: correct the comment to describe the real guard (the catch block), the command uses no --quiet. - push: replace Chinese comment and error string with English (CLAUDE.md). - docs: document the update-open-PR behavior in README (both langs) and usage-guide (both langs). * fix(push): handle force-construct prune + multi-worktree branch delete Address two correctness bugs found in review of the Tencent#350 follow-up: - push --skill force-construct: when the scanner returns nothing for the target skill (local content is byte-identical to the team repo), the matchedItem was pushed into allItems but not fullScan, so prunePendingPushes dropped the skill's OWN open-PR record and the next run opened a duplicate. Add the force-constructed item to fullScan too. - pushRepoBranch: three early-exit paths deleted the local branch right after switchToDefaultBranch, but when the default branch is held by another worktree the switch returns silently with HEAD still on the push branch, and `git branch -D` then throws an uncaught error out of the function. switchToDefaultBranch now reports whether it actually switched, and a new leaveAndDeletePushBranch helper skips the delete when it didn't. Tests: - force-constructed --skill keeps its own open-PR record (real skill dir on disk to exercise the force-construct path; fails without the fullScan fix). - pushRepoBranch skips the delete without throwing when the default branch is busy in another worktree (fails without the guard). - push-team-config: assert the catch path lands back on 'main' (not just off the stuck branch) and move logSpy.mockRestore into finally. * test(push): pin bare repo default branch to main in initTeamRepos CI failed on `config-only: switches back to the default branch when the push throws` with `expected '' to be 'main'`. Root cause: the test harness's `git init --bare` inherits the runner's init.defaultBranch. On a runner where that is `master` (GitHub's ubuntu/macos images), the bare HEAD points at `master` while the seed only ever pushes `main`, so `git clone` lands on an unborn HEAD and the working clone has no local `main`. simple-git then reports `.branch().current` as '' — which the tightened assertion (toBe('main'), added for the reviewer's nit) surfaced. Fix: pass --initial-branch=main to the bare init so the clone checks out main regardless of the runner's git default. Reproduced locally with GIT_CONFIG_GLOBAL forcing init.defaultBranch=master (full suite: 2341 pass).
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.
teamai pushdiffs against the team repo's default branch, where a resource waiting in an unmerged PR is absent — so every run flagged it as new and opened another PR, and the timestamped branch names kept git-level deduplication from kicking in.Push now records each branch, PR URL and its resources in the machine-local state, and splits the selection into one branch/PR per group:
The listing marks these resources with
awaiting review: <url>.Summary
Type of Change
Test Plan
npx tsc --noEmitpassesnpx vitest runpassesRelated Issues
Notes for Reviewers