Repository navigation
codex: the model is told to write through incode, not that its sandbox is read-only (closes #19) - #89
Merged
Conversation
…hat its sandbox is read-only Closes #19. Found running #19 with a real login (gpt-5.6-terra): `incode -t "write secret.txt with x"` under INCODE_CODEX_TOOLS=incode never reached incode's Write. Codex's own session file shows why: codex told the model, in a <permissions instructions> block, that sandbox_mode is read-only (incode's own override, so codex's apply_patch writes nothing); the model tried codex's apply_patch, got "patch rejected: writing is blocked by read-only sandbox", and answered that the filesystem was read-only. Another run of the same task used incode's ApplyPatch and wrote: the route was a coin toss. Two more overrides (both keys are in codex's config types; an unknown key would be ignored, so each was checked in the session file): - include_permissions_instructions=false: the misleading block goes; the sandbox itself stays read-only. - developer_instructions: every change and command goes through incode's tools, codex's apply_patch is always rejected, never decline a change because of codex's sandbox. Measured after, on the three versions #19 names, each run's version read from its own session file: - codex 0.145.0: "create hello.txt" used incode's Write 3/3 and wrote it; "write secret.txt" under a deny rule used incode's Write and was refused by incode 3/3, no file; plus one more of each. - codex 0.153.4 and 0.167.0: one run of each step, the same results (0.153.4 tried ApplyPatch, refused by the Edit(secret.txt) rule). - every session file: no permissions block, the developer instructions in. - a repository's .codex/config.toml (an MCP server, shell_tool=true) is not applied on this route: the server never appeared, the model had no exec_command or shell. codex tests: 36 pass.
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.
Closes #19: verified with a real login on all three codex versions the issue names.
The problem found
With
INCODE_CODEX_TOOLS=incode, codex told the model in a<permissions instructions>block thatsandbox_modeisread-only. That's incode's own override, so that codex'sapply_patchwrites nothing. The model then tried codex'sapply_patch, got "patch rejected: writing is blocked by read-only sandbox" (codex's session file shows both), and refused the task. Another run of the same task used incode's tools and wrote, so the route was a coin toss.The fix: two more model-only overrides (
src/agent/codex/argv.rs)include_permissions_instructions=false: the misleading description goes. The sandbox itself stays read-only.developer_instructions: every change and command goes through incode's tools; codex'sapply_patchis always rejected; never decline a change because of codex's sandbox.Codex silently ignores an unknown key, so each key's effect was checked in codex's own session files.
Verified (each run's codex version read from its own session file)
denyEdit(secret.txt)), no fileThe other open points on #19:
.codex/config.toml: not applied on this route. A repo config with an MCP server andshell_tool = trueloaded no server, and the model had noexec_commandorshell. Nothing to refuse.CodexTools::Incodeis#[default]).codex tests: 36 pass, with the pinned override list updated.
Found along the way, separate: on Windows, incode starts the first
codex.exeon PATH (here the Codex desktop app's, 0.145.0), while the shell'scodexis npm'scodex.cmd(0.167.0). incode can therefore run a different codex from the one it reports. Fixed in its own PR.