Repository navigation
Fall back to a private temp state root when the CSO default is read-only (CHE-10265) [squash] - #16
Merged
congvc-bot-x99[bot] merged 2 commits intoNov 26, 2026
Conversation
…ad-only (CHE-10265)
…ts stays unchanged (CHE-10265)
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.
Fixes CHE-10265 (parent incident CHE-9976). Head
4bdec7d3a7c0c8012805df5e67fdce40eb30f661.Problem
In a Codex
workspace-writesandbox (codex-cli 0.166.0)~/.gstackis read-only, sogstack-cso-launcher startreturnedPERSISTENCE_FAILED (EROFS)and Codex reviewers could not run the security scan.~/.gstack/security/csoalready existed, so the failure was thechmodof an existing directory, not amkdir.Change
privateRoot(): if the default root cannot be written (EROFS/EACCES/EPERM) and noGSTACK_STATE_ROOT,GSTACK_HOME,GSTACK_STATE_DIRorCLAUDE_PLUGIN_DATAis set, retry once under/tmp/gstack-cso-<uid>(sticky/tmp, per-uid, 0700). Not on Windows.UNSAFE_PATH. An unsafe default root is not retried. An explicit state-root variable is never replaced. No bypass.chmodandaccess(W_OK)faults becomePERSISTENCE_FAILEDwith the errno).assertStateOutsidealso checks the fallback path./tmp/gstack-cso-<uid>and are not visible outside it.Reproduce (before, installed build at b3ef735)
After (launcher built from this head)
startreturns a run ("status": "running", runId 1795712655544-a1307daf42795438) in the sandbox;inspectandfinishon that run also work in the sandbox. State dir:drwx------ /tmp/gstack-cso-1000/security/cso.Tests
bun test test/cso-sandbox-state-root.test.ts test/cso-error-mapping.test.ts test/cso-state-userns.test.ts→ 16 pass, 1 skip, 0 fail.New cases: read-only default falls back (0700, owned by uid); writable default unchanged; explicit root never replaced; group/world-writable ancestor still rejected; group-writable pre-existing leaf rejected; unsafe default not retried; bwrap read-only user-namespace run with existing read-only state dirs succeeds.
bun run format:cso:checkclean.Wider CSO suite (
test/cso*.test.tsminus docker/macos/windows/lifecycle, TMPDIR=/tmp): base main 766 pass / 23 fail; this branch 774 pass / 23 fail. The 23 failures are identical in count and exist on main on this host (not touched here). Note: with this host's default TMPDIR (group-writable ancestor) 240 more fail on both — same guard.Not covered
Windows (fallback off). Reading in the sandbox a run created outside it (different root). Codex builds without a writable /tmp.