Repository navigation
Conversation
Codex's Linux sandbox creates every missing filesystem-rule destination as an empty mount point, which outlived the dispatch and left files such as commondir and MERGE_HEAD in .git (#229). The publish profile now keeps the common Git directory read-only, grants writes only to objects, refs, logs and the worktree's private directory, and names only paths that exist. Dangerous absent paths (worktree config under extensions.worktreeConfig, a core.hooksPath inside a writable Git directory, main-worktree publishing) route the stage away before dispatch. Automatic Git maintenance is disabled inside the sandbox.
A timed-out, interrupted or finished dispatch's process group now gets SIGTERM and a bounded grace period, so a sandbox can run its own teardown, before SIGKILL. Output pipes held by a stray descendant are waited on for a bounded time, so cleanup never blocks the cycle (#229).
Initial review — PR #232 (work item #229)[CCR-20261014-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2Verdict: APPROVED for head Summary and scopeI reviewed the whole accumulated diff The change does what it says. The Codex publish profile now keeps the common Git root read-only and grants writes only to Conventions: I applied Findings[REV-001] · low · open · - · blocks:no — Output drain can wait twice
|
| Command / flow | Result |
|---|---|
wc -l + sha256sum on the evidence diff |
1900 lines, hash matches; PR head equals d81f290… |
python3 -m unittest discover -s tests |
exit 0, 1390 tests OK (120 s) |
python3 scripts/validate-package.py |
exit 0, VALID: 15 skills … |
Real Git: empty .git/.codex/.agents/.aws dirs in objects, refs, logs, worktrees/w, then fsck, for-each-ref, count-objects -v, reflog expire --all, pack-refs --all, gc, worktree list, status in the worktree |
all exit 0, no warnings, garbage: 0. Confirms the docs' claim that Git ignores Codex's own carve-outs |
_run with a setsid descendant holding both pipes |
returns rc 0 after 10.0 s (REV-001) |
Probe through the real runner with a failing fake codex |
stderr kept in the detail (REV-002 is coverage only) |
unprotectable_git_paths with core.hooksPath as a symlink into refs |
routes away |
git status --porcelain before and after the suite |
clean |
Unverified
- Real Codex CLI behavior (whether a nested
writeunder areadroot takes effect, mount materialisation, and whethershell_environment_policypassesGIT_CONFIG_PARAMETERSthrough). No Codex CLI was run in this stage. This fails closed: if Codex does not honor the nested grants, the probe's write markers fail and the stage routes away before dispatch.
CI (policy: strict, the default)
Head d81f290af0d8ba1673c0204525f0111601175575: 4 passed, 0 failed, 0 pending.
| Check | State |
|---|---|
| Skills, manifests, and Bash installer (push) | pass |
| Skills, manifests, and Bash installer (pull_request) | pass |
| PowerShell installer (push) | pass |
| PowerShell installer (pull_request) | pass |
No check that the repository normally runs is missing.
Residual risks
- The change has not been run against a live Codex CLI (see Unverified). The manual check in
docs/verification.mdis the remaining evidence. - Inside the sandbox, packed-ref deletion (including
fetch --pruneandpush --deleteof packed remote-tracking refs),pack-refs,gc, shallow fetch, and rerere (whenrr-cacheexists) now fail, because each needs a write to the read-only root. The PR documents the first four. rerere is an additional edge case. - Codex still creates empty
.git,.codex,.agents, and.awsdirectories below the writable roots. Git ignores them (verified above), but they remain artifacts. A follow-up issue is suggested in the PR.
Closes #229
Work item: datacas/code-cycle-toolkit#229 (GitHub Issues)
Summary
Codex writing publish dispatches no longer leave empty files in
.git. The publish profile now keeps the common Git directory read-only, grants writes only toobjects,refs,logs, and the worktree's private directory, and names only paths that already exist. Before dispatch, a stage routes away from Codex when a dangerous path is absent. A stopped dispatch's process group now getsSIGTERMand a bounded grace period beforeSIGKILL.Diagnosis
.git:commondir, state markers, lock files, andrefs//logs/refs/{bisect,worktree,rewritten}. Git then failed withfailed to read .git/commondir..gitstill had the incident's leftovers: emptylogs/HEAD.lockandlogs/refs/{bisect,rewritten,worktree}, dated 2026-10-13 10:21. The routing step that started this run hit the same leftovers: "Codex linked-worktree Git metadata probe failed: protected Git metadata directory has an unexpected file: bisect"._publish_filesystem_rules()emits 70 rules, and 55 of them name absent paths. The incident reported 54 files. The new profile emits 9 rules and names 0 absent paths.test_the_emulator_reproduces_the_incidentuses a fakecodexthat creates missing rule destinations, as the Linux sandbox does. It reproduces the brokengit status.codexneeds an approval this stage does not have.packed-refscannot be granted as a file path. So it carved out every protected name as an individual rule, whether or not the path existed.objects/refs/logsand the private worktree directory. These are also the only--add-dirroots now.commondir/gitdir,config.worktreeand its lock, the workspace.git, and the main worktree'slogs/HEADandrefs/logs/refsbisect/worktree/rewritten.extensions.worktreeConfigis on andconfig.worktreeor its lock is missing;core.hooksPath(local, worktree-specific, or relative) resolves inside a writable Git directory;gc.auto=0andmaintenance.auto=falseare set throughGIT_CONFIG_PARAMETERS..gitafter the dispatch.isolated_defect, decisionimplement.Work units
WU-1scripts/executors.py,tests/test_codex_git_sandbox.py,tests/test_executors.py,tests/fakes/fake_agent.py,docs/verification.md,CHANGELOG.mdtest_codex_git_sandbox(Profile, RouteAway, ProbeMarker, SandboxSideEffect, PublishingUnderReadOnlyRoot), updatedtest_executors,test_installed_cyclepython3 -m unittest discover -s tests: 1387 tests OK;python3 scripts/validate-package.py: VALIDWU-2scripts/executors.py,tests/test_codex_git_sandbox.py,docs/routing.md,CHANGELOG.mdStagedTerminationTests(teardown runs on timeout; TERM-ignoring group killed after grace; finished dispatch leaves no descendants)python3 -m unittest discover -s tests: 1390 tests OK; validator VALIDVerification (agent-reported)
python3 scripts/validate-package.pypython3 -m unittest discover -s tests(final head)python3 -m unittest test_codex_git_sandbox_publish_filesystem_rules()in a real linked worktree: rules naming absent pathsThe tests check the repository itself, before, during, and after both the probe and the dispatch, rather than only the serialized rules. In the side-effect tests,
.gitis identical at all three points, for absent and for existing protected paths. A real-Git test makes the common root andworktreesread-only with directory permissions. Under that restriction,commit,update-ref,fetch, andpushsucceed, the main worktree'sHEAD,index,logs/HEAD, andrefs/heads/mainare unchanged, andpack-refsfails, which is the documented limitation.Environment assumptions. Git-using tests set their own identity and
GIT_CONFIG_GLOBAL=/dev/null/GIT_CONFIG_NOSYSTEM=1, so they do not depend on~/.gitconfig. The read-only emulation and signal tests are skipped on Windows and when running as root. Local run: Linux (WSL2), Python 3.10, Git 2.34.1.Residual risk
docs/verification.md..git,.codex,.agents, and.awsbelow every writable root, and they were observed as empty directories inobjects,refs, andlogs. These come from the CLI, not from these rules. Git ignores the dot-prefixed names, but they are still artifacts. Avoiding them needs a Codex-side setting, so a follow-up may be worth opening.GIT_CONFIG_PARAMETERS. It reaches the agent's commands only if Codex'sshell_environment_policyinherits it, which is the default.logs/refs/*, are not removed. They no longer block the probe, which now protects them as existing files.Checks of the pushed head
Head
d81f290af0d8ba1673c0204525f0111601175575: 4 passed, 0 failed, 0 pending.run: stage=implement profile=deep_coder requested_model=anthropic/claude-opus-5-5 resolved_model=? effort=high executor=claude schema:2