Repository navigation
fix(codex): a pod-less Codex seat's restore keeps its git dirs writable, so it can still commit - #2023
Conversation
rig context recap-write wrote the recap in the caller's own process, so a seat whose writable roots don't include the topology tree (a default workspace-write Codex seat) failed with EPERM at mkdir, and a rebuild started without the seat's decisions unless an operator installed the draft by hand. The CLI still writes locally first. When the OS refuses that write (EPERM, EACCES or EROFS), it sends the same recap to the daemon's new POST /api/context-packs/seat-recap, which owns the topology tree and primes RECAP.md at the next rebuild. Both paths call one store function, writeSeatRecapAt, which holds the address checks the CLI used to do inline: bounded segments, an existing rig, no symlinked or file segment, and a created seat folder. Callers that can write behave as before, including with the daemon down. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The shared Markdown parser's heading regex backtracked polynomially on a long whitespace run, and the daemon now parses submitted recaps. A short scan replaces it and keeps the same headings: up to three spaces, one to six #, whitespace or the end next, and a trimmed title with no line break inside. Handover profiles and the CLI's advisory scan use the same parser. - The store and route comments now say what the address checks cover: the rig, seats and seat folders. A link already at RECAP.md or its archive folder is followed, as the local write always did. - When the daemon writes the recap, the success line names it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… LEARNED.md and recap A default workspace-write Codex seat can't write its own topology folder (<topology root>/rigs/<rig>/seats/<seat>), where its LEARNED.md and recap live: the folder sits outside the seat's writable roots, so both writes fail with EPERM and what the seat learned is lost to its next occupant. Each Codex launch now adds that one folder as an --add-dir, created first if missing (Codex can't create it), under the same rules as the git metadata dirs: fresh, resume and fork alike, after the conversation id on resume and fork so the ps proofs survive a path with a space, none for a rebuild (its observed envelope keeps what ran) or a provably read-only profile, and an in-place restart keeps the running process's own add-dirs. The restore path's resume adds it on the plain workspace-write floor. A malformed seat name, an unsafe segment or a symlinked rigs/seats segment gives no folder, with a warning, and nothing is created through a symlink. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e, so it can still commit #2000 gave Codex's fresh, resume and fork launches the git metadata dirs as --add-dirs, so a restored or forked seat can still commit. A restore through the restore path (rig up --existing, a restore after a reboot) resumes through CodexResumeAdapter, which added none: a default workspace-write seat restored that way couldn't write its worktree's .git, and commits failed. That path now adds the same git dirs, from the same resolver, then the seat folder, after the conversation id so the resume proof reads the id even from a path with a space. Only on the plain workspace-write floor, as for the seat folder: a named profile isn't checked for read-only there, and Codex refuses a writable root under one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Resolve and append resume directories packages/daemon/src/adapters/codex-resume.ts, packages/daemon/src/startup.ts |
The adapter combines resolved Git metadata directories with the prepared topology folder when no named profile is active and the launch posture is workspace-write. It appends each nonempty root as a quoted --add-dir argument. Startup supplies the Git-directory resolver. |
Verify resume directory arguments packages/daemon/test/codex-git-add-dirs.test.ts, packages/daemon/test/codex-resume.test.ts |
Tests check restore arguments for ordinary repositories and linked worktrees. They also verify that named-profile resumes omit --add-dir and do not call the resolver. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related PRs
- mvschwarz/openrig#2000: Adds Git
--add-dirpaths to Codex fresh, resume, and fork launches throughCodexRuntimeAdapter. - mvschwarz/openrig#2018: Adds the seat topology folder to
CodexResumeAdapterunder the same workspace-write floor. - mvschwarz/openrig#1791: Suppresses generated writable roots for read-only named Codex profiles.
Suggested reviewers: openrig-review, rudycelekli, shravansumanthanan
Merge Risk: 
Minimal · up to 3a92c
-
Pod-less Codex resumes gain the intended Git-directory arguments, with no identified issue blocking merge after normal checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title names the fix (pod-less Codex seat restore keeps git metadata directories writable so it can commit), and the raw summary and objectives confirm that the change adds git metadata --add-dir paths to CodexResumeAdapter restores on the plain workspace-write floor. The title is specific and matches the primary change. It is long at 95 characters, and it uses a comma clause, but it still conveys the main change clearly.
-
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
…x-seat-folder-writable
…t folder A Codex seat may now write its own topology folder, and the daemon writes there for it through the recap route with its own wider filesystem access. So a link the seat plants at RECAP.md or recap-superseded/ would carry the daemon's write out of the folder: an archived recap, with bytes the seat chose, landing in whatever folder the link names. Before touching current or archived recap state, the store now requires an existing RECAP.md to be a regular file and recap-superseded/ a real folder, dangling links included, and otherwise refuses the write with a clear message, leaving the current recap, the archive and the link's target as they were. This intentionally refuses a layout the store used to follow. The direct write, the daemon fallback and the existing error are unchanged. The check runs before the write, so a change made in between isn't covered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…x-restore-gitdirs
CodexResumeAdapter serves only seats without a pod; a seat in a pod resumes through the launch adapter, which #2000 already covers. The two test comments and the describe title said every restored seat. Text only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…writable #2008 landed as a squash, so this branch's merged copy of #2008 conflicted. main's three conflicted files are byte-identical to #2008's a3ef5b7, so each resolves to this branch's version and the net diff against main is #2018's own change plus the store check, unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#2018 landed as a squash, so this branch's merged copy of #2018 conflicted. main's four conflicted files are byte-identical to #2018's final head 5842d1f, so each resolves to this branch's version and the net diff against main is #2023's own four files, unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
openrig-review
left a comment
There was a problem hiding this comment.
Approved at 3a92c59. A pod-less Codex seat restored through CodexResumeAdapter (rig up --existing, or a restore after a reboot) now gets the git metadata --add-dirs that #2000 gave fresh, resume and fork launches, then its seat folder, after the conversation id and only on the plain workspace-write floor, so it can still commit. Seats in a pod restore through the launch adapter #2000 already fixed. Pair: dev60-review (Claude) and review-r2 (Codex) at 21f8930, with dev60-review's wording fix rechecked; the main merge to this head adds only main, checked by net diff. Required CI passes at this head.
— dev60-planner@v-openrig-build
…le, so it can still commit (mvschwarz#2023) A Codex seat without a pod restores through `CodexResumeAdapter` (`rig up --existing`, or a restore after a reboot), and that path added none of the git metadata `--add-dir`s mvschwarz#2000 gave fresh, resume and fork launches. So a default workspace-write seat restored that way couldn't write its worktree's `.git`, and commits failed. It now gets the same git dirs from the same resolver, then its seat folder, after the conversation id, so the `ps` proofs still read the id. They're added only on the plain workspace-write floor, since a named profile isn't checked for read-only on this path and Codex refuses a writable root under a read-only sandbox. Seats in a pod restore through the launch adapter, which mvschwarz#2000 already covers. Tests use real temporary repositories: an ordinary repository's restore adds `<cwd>/.git`, and a linked worktree's adds its worktree and common git dirs, never the `.git` file.
What this changes
A pod-less Codex seat restored through
CodexResumeAdapter(byrig up --existing, or a restore after a reboot) now gets the same git metadata--add-dirs that #2000 gave its fresh, resume and fork launches, so it can still commit in its worktree. Seats in a pod restore through the launch adapter, which #2000 already fixed.CodexResumeAdapter, which serves only seats without a pod, added none of them. A default workspace-write seat restored that way couldn't write its worktree's.git, and commits failed, which is the bug #2000 fixed for the other launch paths.How
resolveCodexGitAddDirs), wired in at startup:<cwd>/.git;.gitfile.Tests
<cwd>/.git, the same as its fresh launch, after the id, and the id still parses from a path with a space;.gitfile.🤖 Generated with Claude Code
Summary by CodeRabbit