Skip to content

fix(push): merge a self-mode teamai.yaml edit onto the default branch - #1837

Merged
SaulMoro merged 2 commits into
Tencent:mainfrom
Walternater:fix/self-push-merge-team-config
Nov 13, 2026
Merged

SaulMoro merged 2 commits into
Tencent:mainfrom
Walternater:fix/self-push-merge-team-config

Conversation

@Walternater

@Walternater Walternater commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

A self-mode teamai push carries the member's working-tree teamai.yaml into the disposable worktree, which is checked out at origin/<default>. It wrote the whole working file over that copy, so a setting a teammate had landed since the member's HEAD was absent from the pushed branch — merging that branch reverted the teammate's setting. Git mode already merges the edit (#1831); self mode now merges it the same way, before handing the config to pushCore.

What changed

  • src/push.ts — pendingSelfTeamConfig keeps its "is the working copy edited" check, and its HEAD read becomes committedSelfTeamConfig so the merge below uses the same commit. In the self-mode worktree callback, the pending edit is merged onto the worktree's teamai.yaml with that HEAD copy as the base, and the merged text is what is written and what pushCore receives.
  • src/__tests__/e2e/self-mode-push-behind.test.ts — two cases: the pushed branch holds the teammate's autoUpdate: false and the member's submodules: false; and two different values for one key refuse the push (Conflicting keys: <key>), create no branch, and leave the member's edit in place.

Tests

  • Both new cases fail on main for the reported reason: expected '<config>' to contain 'autoUpdate: false' / to contain 'Conflicting keys: submodules'.
  • npm run test:e2e -- src/__tests__/e2e/self-mode-push-behind.test.ts: 28 passed.
  • npm run typecheck, npm run lint, npx vitest run src/__tests__/yaml.test.ts: pass.

Real CLI, in a verify world:

  • main world (Build 9ab114832433, teamai 0.22.0, sha256 02a1b9f0c4d0): teammate lands autoUpdate: false on origin/main; the member, not merged, appends submodules: false and runs teamai push --all. The pushed .teamai/teamai.yaml holds only submodules: false — the reported diff.
  • change world (Build 9ab114832433+dirty, teamai 0.22.0, sha256 7cc5358143af): same steps push autoUpdate: false and submodules: false; git diff main..teamai/push/... adds only +submodules: false. A second run, after the teammate sets submodules: true on origin/main, exits 1 with Push failed: Conflicting keys: submodules., creates no branch, and leaves the member's file unchanged.
  • sh <run> git fetch origin preceded both pushes, so the member's checkout was behind origin/main as in the report.
  • Ledger: 13 LEAKS in each world, all the known self-mode teamai uninstall gap #1808 (project/.teamai, project/.claude, the teamai-reports worktree and refs); the push writes none of them.

Surfaces

  • Team repo modes: self mode is the fix; git mode's merge is unchanged; http mode does not use this path.
  • Entry points: teamai push, including --all, --dry-run (the merge runs against the disposable worktree, as the carry did before, and a conflict refuses the preview), and a config-only push (pushTeamConfigOnly receives the merged text).
  • --branch: the merge runs before pushCore for every self-mode push, so an explicit branch receives merged content; prepareExplicitBranch's own merge then sees the edit relative to the same HEAD and is a no-op. A new --branch name is refused earlier on main for an unrelated reason, so it is not a separate test here.
  • Checkouts: the world and the E2E both run a normal checkout; a linked worktree or submodule shares the same active-tree HEAD read, unchanged by this fix. Windows: the merge is path/git show only; CI runs the E2E subset.

Fixes #1835.

A self mode push wrote the member's whole working-tree `teamai.yaml` over the
worktree's copy of the default branch, so a setting a teammate landed there
since the member's HEAD was reverted by the pushed branch. The git-mode path
merges the edit instead (Tencent#1831); self mode now does the same before it hands
the config to `pushCore`.

The base is the config committed at the member's HEAD, which is what the edit
was made against, and the destination is the worktree's `origin/<default>`.
Two edits of one key still refuse the push, with `mergeTeamConfig`'s message.

Fixes Tencent#1835
@github-actions

Copy link
Copy Markdown

No findings in the specified diff.

The PR description documents sufficient testing, including representative real-CLI verification of both the successful merge and conflict refusal. No PR code was run, built, or installed.

@SaulMoro SaulMoro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was generated by AI during triage.

Looks right. Merging the self-mode edit with mergeTeamConfig gives the same three-way merge git mode got in #1831:

  • the base is the teamai.yaml at the member's HEAD;
  • the destination is the copy in the disposable worktree at origin/<default>;
  • pushCore and pushTeamConfigOnly receive the merged text.

The before and after runs in the description match #1835's report, and the conflict case is refused with nothing pushed.

One thing before it can merge: #1836 landed on main after this branch was cut and also changes src/push.ts. Please merge main into the branch so CI runs on the combined code, and I'll take another look at the new head.

[P3 nit] Two small things:

  • The new Conflicting keys refusal on a self-mode push deserves a CHANGELOG line. A push that used to succeed, while reverting a teammate's setting, now stops.
  • With --branch onto an existing branch older than the default branch, the second merge in prepareExplicitBranch brings the default branch's newer keys into that branch. Merging the branch into the default branch is harmless, but its diff shows them.

@SaulMoro

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

#1842 has now landed on main and also changes src/push.ts, alongside the #1836 changes already there. Please merge main into this branch so CI runs on the combined code, and I'll take another look at the new head.

@github-actions

Copy link
Copy Markdown

No findings in the specified diff. The earlier review reported no findings, so none require resolution.

The PR description documents sufficient testing, including representative real-CLI verification of successful merging and conflict refusal.

No PR code was run, built, or installed.

@SaulMoro
SaulMoro merged commit ca0cf59 into Tencent:main Nov 13, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] A self-mode teamai push reverts a teammate's newer teamai.yaml change

3 participants