Repository navigation
fix(session): Codex counts as installed before its first session; session pull leaves _index.json unchanged - #1141
Merged
jeff-r2026 merged 2 commits intoOct 15, 2026
Conversation
Codex creates ~/.codex/sessions on its first session, so a member who installed Codex but never ran it failed 'session migrate -t codex' with 'not installed'. Codex is now ready when its root exists or the codex CLI is on PATH; the write already creates sessions/YYYY/MM/DD.
…ing new Every session pull rebuilt _index.json with a fresh top-level updatedAt, each entry's updatedAt taken from meta pushedAt (push records the session's own updatedAt), and entries in directory order (push appends). The team checkout stayed modified, so the next pull that brought index changes refused to merge. The rebuild now keeps the entry updatedAt and order it cannot derive from disk, and the write is skipped when the content is unchanged.
|
No actionable findings in the specified diff. The PR description satisfies the testing requirement: it records real-CLI verification after Review was read-only; I did not run, build, or install anything from the PR. |
jeff-r2026
approved these changes
Oct 15, 2026
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.
Summary
Two session fixes.
session migrate -t codexfailed with "not installed" for anyone who had installed Codex but never run a session, because readiness required~/.codex/sessions/. Codex is now a target when~/.codexexists orcodexis on PATH. The write already createssessions/YYYY/MM/DD/.session pullrewrotesessions/repos/<repo>/_index.json, so the team checkout stayed modified, and the next pull that brought index changes failed with "Your local changes ... would be overwritten by merge". Three things differed from what push writes: a fresh top-levelupdatedAt, each entry'supdatedAt(push records the session's own, the rebuild usedpushedAt), and entry order (push appends, the rebuild used directory order). The rebuild now keeps each entry'supdatedAtand order from the current index, and the index is not written when its content is unchanged.Type of Change
Test Plan
npx tsc --noEmitpassesnpm run lintpassesnpx vitest run: the session, sync and Codex files pass (27 files, 497 tests). The full run has two failures outside session code:mcp-reconcile(gitEAGAINunder load; passes on its own) andgitlab-clone-realspawn(hangs locally).mainfirst)session-codex-install.test.ts: migrate into Codex with only~/.codex; Codex listed as installed with only the CLI on PATH; not listed with neither; listing with nosessions/returns empty.session-sync.test.ts: a bare remote and two clones; push, then pull twice, andgit statusis clean; a second push, then a pull merges and stays clean.Real CLI after
npm run build, isolated HOME:Fix 1, HOME with only
~/.codex/, a planted Claude session,codexnot on PATH:With codex-cli 0.162.1 on PATH,
codex exec resume <id>opens the migrated session (session id: aaaaaaaa-...) and then stops at401 Unauthorized, because the test HOME has no auth.Fix 2, alice runs
session pushandgit push, bob runssession pulltwice:Not run locally: the other agents and the
gitlab/githubproviders (left to CI).Related Issues
Follow-up to #593. The
_index.jsonproblem showed up while working on #1139.Notes for Reviewers
codex;codex-internalandtcodexstill need their root directory.sync.ts. The edits here are two small blocks inwriteIndexandrebuildIndex; whichever PR merges second rebases.