Repository navigation
fix(session): merge a diverged session index on pull and retry push once (#1133) - #1139
Conversation
8ef3259 to
13a15d1
Compare
2669d2e to
a833eb8
Compare
The PR description documents sufficient testing, including representative built-CLI runs against a local bare remote. Deferred provider/agent coverage is not blocking. I did not run, build, or install anything. |
2430cd5 to
82a2151
Compare
…nce (Tencent#1133) gitPull ran a bare `git pull`, so the user's pull.rebase decided the outcome: unset refused any divergence, false stopped mid-merge, true stopped mid-rebase. It now merges explicitly, without rebase or autostash. Conflicts only in `_index.json` are rebuilt from the session files, keeping the identity the index recorded, and the merge is committed. Any other conflict aborts the merge, and an unfinished rebase, merge, or other git operation stops the pull untouched. Both come back as a `stopped` result that names the next step. gitPush pulls and pushes again once when the remote moved ahead, so a second machine's push no longer leaves its commit stranded locally. Git runs untranslated, so errors quote git's own reason line.
…ncent#1133) A pull that stops on conflicted session indexes now returns them instead of rebuilding them. session pull and the push retry rebuild them and commit the merge inside withSessionIndexLock, while the network pull and push stay outside it. When the lock stays busy the merge is left in progress and the member is told to rerun `teamai session pull`, which finishes it.
…s a diverged index (Tencent#1133)
…he identity from a side that recorded one (Tencent#1133)
82a2151 to
8d8c66b
Compare
|
No new confident findings in the available PR commit diff.
I did not run, build, or install anything from the PR. |
|
No new confident findings in the specified three-dot diff.
|
Summary
When two machines archived sessions for the same repo, both changed
sessions/repos/<repo>/_index.json, andteamai session pullstopped with a misleading "configured remote" error, depending on each member'spull.rebase. The pull is now an explicit merge, a conflict on session indexes alone is rebuilt from the session files, andsession pushpulls once and retries when the remote moved ahead.Every
_index.jsonwrite still goes throughwriteIndex, which leaves an unchanged index byte-identical, so a merged checkout stays clean on the next pull. A conflicted index takes itsrepoIdentityfrom the first side that recorded one, then from the directory name.Closes #1133
Evidence
main,450be2aa, same script):8d8c66b5, built CLI, isolated HOME and git config, local bare remote,pull.rebaseunset):src/__tests__/session-sync-pull.test.ts(real git, local bare remote) fails onmainand passes here. It covers a diverged index underpull.rebaseunset/false/trueandpull.ff=only; another file conflicting, with and without an index conflict; an earlier stopped merge, also when the remote moved on again; a stopped rebase; autostash config over local edits; a legacy_-folded repo directory; a conflicted side without a usable identity; the push retry (success, real conflict, hook rejection); andpush --allskipping an unreadable session while merging a diverged index.8d8c66b5:npx tsc --noEmit,npm run lint,npm run buildpass; session unit files 468/468; E2E suite: 1259 passed, 1 failed (source-freshness-recall, which fails the same way onmainon macOS:/private/varvs/var).gitlab/githubproviders and the Codex, CodeBuddy and OpenCode agents (left to CI), and git older than 2.27. Autostash is disabled with-cconfig rather than--no-autostash, whichgit pullbefore 2.27 rejects outside a rebase.Merge Danger
Door: two-way
Revert restores the old pull and push. Merge commits the new pull created stay in team repos, which is ordinary git history.
Blast Radius: sessions
Only
teamai session pullandteamai session pushchange. A member whose checkout holds a rebase, merge or unmerged files gets an explicit stop with the next step instead of a pull attempt.runGitnow setsLANGUAGE=enso the quoted git reason is in English.