Repository navigation
Conversation
The dirty-legacy SQLite regression test was reading process.env inside Effect.gen, which effect-tsgo rejects (TS377077). Match the other managed-runtime tests and take PATH/SystemRoot from HostProcess.Environment.
Route provider-bound terminals through canonical SQLite storage, reject mixed or overlapping homes, and preserve actionable recovery guidance. Serialize concurrent shadow setup and cover Windows path aliases, overrides, and legacy state with focused regressions. Prepared with GPT-6 through ChatGPT using the T3/MoonDesk harness.
Only run SQLite override and shadow-terminal materialization cases on hosts with symlink support. Keep safe preflight and non-overlay tests active on all platforms. Prepared with GPT-6 through ChatGPT using the T3/MoonDesk harness.
Legacy SQLite links in a shadow home are inert once Codex opens databases from CODEX_SQLITE_HOME, and on macOS and Linux SQLite already kept their sidecars beside the shared file. Refusing them would stop every existing shadow-home instance after upgrade. Refuse only a shadow WAL or journal that still holds data for a database it does not own. Drop the realpath alias check, in-process materialization lock and terminal shadow materialization, which the SQLite fix does not need, and cut tests to the routing cases. AI-assisted; verified with the tests and tools listed above. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI-assisted; verified with the tests and tools listed above.
…hers AI-assisted; verified with the tests and tools listed above.
…nking When a shadow home keeps its own SQLite databases and the shared home has others, the shadow was routed to its own SQLite home with the shared databases symlinked in. POSIX SQLite opens a symlinked database by its target's path, so its WAL stays beside the shared file. Windows SQLite derives the WAL from the link's path, so a shadow writer and a shared-home writer would each keep their own WAL for one database, which is the split reported in pingdotgg#24486. On Windows, refuse that layout before touching either home, including a shadow whose legacy link points at a shared database that is gone, and never link a database during setup even if the shared home gained one after the check. Name both homes and both databases in the recovery message. macOS and Linux keep the current routing. Tests cover the reviewer's case, the dangling legacy link and the check-to-setup race on Windows, keep the existing mixed-home test on POSIX, and use node:sqlite to show a POSIX shadow and the shared home share one WAL through the link.
Since pingdotgg#35912 a Codex shadow home shares the instance environment's CODEX_HOME when no home path is set. Provider terminals still resolved the shared home from settings alone, so they routed CODEX_SQLITE_HOME to ~/.codex while the provider used the environment's home. Resolve it the way the provider does.
…x-sqlite-wal-windows
…se through a link An explicit CODEX_SQLITE_HOME skipped every SQLite check. On Windows, naming a directory that holds a linked database, such as a shadow home with legacy links or the goals_1.sqlite link the old mixed-home fallback made, launched Codex against the link. Windows SQLite names the WAL after the path it is given, so that Codex kept its own WAL apart from the shared home's writers. This is the split reported in pingdotgg#24486, reached through the override instead of the fallback. On Windows, refuse an explicit SQLite home that holds a symlinked database, unless it is the shared home. The directory itself is read, so an alias of the shadow is caught too. The provider, the orchestration adapter, the managed runtime and provider terminals all resolve their environment here. macOS and Linux are unchanged, since SQLite follows the link itself there. A relative home is not inspected, because Codex resolves it per session. The Windows regression test now covers the review's fixture end to end: a real shadow state_5.sqlite beside a shared goals_1.sqlite that a shared-home writer holds open. It checks the provider and terminal paths, with and without the override, and that two writers routed to the shared home share one WAL. The legacy-link test uses the reported layout of four linked databases with index and empty WAL sidecars. Written by Claude Fable 5.2 in the T3 Code Claude Code harness. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…T3 checked Review of cc72e96d54 found three ways a Windows shadow home could still open a shared database through a link, so that it kept a WAL apart from the shared home's writers (pingdotgg#24486). Codex ranks `sqlite_home`, from any config.toml or a `-c` launch arg, above CODEX_SQLITE_HOME. A shadow whose config named itself opened its legacy links while T3 reported the shared home. T3 now passes the directory it checked as a final `-c sqlite_home=...` on every Codex command it builds: app-server sessions and probes, exec and mcp list. Codex 0.170.0 takes the last `-c` over every config layer, including a trusted project's .codex/config.toml, which T3 cannot read before launch. A `sqlite_home` in the launch args or in the shadow's or shared home's config.toml is refused with guidance, because Codex typed into a provider terminal gets no argument from T3, and silently outranking the setting would move a user's history. The config file is matched by line rather than parsed, and a line that only looks like the key is refused too. A relative CODEX_SQLITE_HOME skipped the check, and probes, sessions and text generation each resolve it against a different directory. It is refused. The shared home was recognised by its exact spelling only. An alias of it was inspected for links, and another letter case or a trailing separator reached Codex as written. The override is now compared by real path, ignoring case, and Codex gets the shared home's own spelling or the directory's real path. macOS and Linux are unchanged: SQLite opens a link by its target there. Written by Claude Fable 5.2 in the T3 Code Claude Code harness. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…tever its casing Windows reads environment names without regard to case, but a provider terminal merged the host, client and instance environments as plain objects. A client's `codex_sqlite_home` sat beside the host's CODEX_SQLITE_HOME, the host's spelling was the one checked, and its value was written back over the client's choice (pingdotgg#24486 review). The terminal now merges the three by name ignoring case on Windows, keeping instance over client over host. The SQLite check reads the variable the same way and returns a single CODEX_SQLITE_HOME, so the provider and the terminal agree on which value Codex gets. Written by Claude Fable 5.2 in the T3 Code Claude Code harness. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…Codex's own setting The Windows check for a `sqlite_home` that would outrank CODEX_SQLITE_HOME matched the text `sqlite_home =` anywhere. It refused a shadow whose MCP server had an environment variable of that name, whose instructions mentioned the setting inside a multi-line string, or whose launch args set `mcp_servers.<name>.env.sqlite_home`. Codex 0.170.0 accepts all three and keeps its databases where CODEX_SQLITE_HOME points (pingdotgg#24486 review). Codex reads `sqlite_home` from the root table only. config.toml is now scanned for that key alone: before the first table header, outside strings, comments, arrays and inline tables, bare or quoted, with a quoted key's escapes decoded. A launch arg counts only when the key before its first `=` is `sqlite_home`. `sqlite_home.x` and `[sqlite_home]` are tables, which Codex does not read as a path, so they are not refused. The scanner is 85 lines and apps/server has no TOML parser to reuse. Where a string or array is never closed, the old line match still decides, so a file Codex cannot parse is refused if any line could assign the key. A quoted key in a launch arg is refused too, although Codex 0.170.0 ignores it. The old match also missed a root key written with an escape, such as "sqlite_home", or behind a byte order mark. Codex honours both, and both are now refused. Written by Claude Fable 5.2 in the T3 Code Claude Code harness. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Three CodexHomeLayout tests failed on native Windows. CI runs on Linux and macOS only, so it did not see them. Two expected only CODEX_SQLITE_HOME. On Windows T3 also passes the checked directory as T3CODE_CODEX_SQLITE_HOME, for the final -c sqlite_home pin, and resolves a rooted path such as /elsewhere onto the working directory's drive. The expectations now say so. The relative CODEX_SQLITE_HOME test took path.relative from the working directory to a temp shadow. When the temp directory is on another drive there is no relative path, so the test handed the guard an absolute one. It now writes the relative path out. Written by Claude Opus 5.5 in the T3 Code Claude Code harness. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Caution Review failedAn error occurred during the review process. Please try again later.
|
Author
|
Closing in favour of continuing #29574, as CONTRIBUTING asks. The branch and the Windows evidence are posted there. |
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.
Note
Submitted by
claude-opus-5-5on behalf of Gib. Code by model:Continues #29574, which stopped in automated review with one major Windows finding open. This branch is that PR's head (
3001024b77, nkcbuilds' commits unchanged), a conflict-free merge ofmain, and 5 commits that close the finding and the gaps a re-review found after it. If you'd rather land it through #29574, its branch fast-forwards to this one.Fixes #24486
Problem
A Codex account with a shadow
CODEX_HOMEshares the main home's SQLite databases. T3 used to symlink them into the shadow. Windows SQLite names the-waland-shmfiles after the path it is given, so a database opened through the link gets a WAL of its own, apart from the shared home's writers. Committed state splits and goes missing. The leftover sidecars also disable the provider at the next start withCannot create Codex shadow home entry 'goals_1.sqlite-shm' … already exists and is not a symlink.How we found it. CodexWork, our second Codex account, kept getting disabled on Windows 11 by exactly that error, at least four times between Nov 3 and Nov 18. On native Windows the legacy layout reproduces the split. Through
node:sqlite, a row written through the link is gone after reopening, andintegrity_checkstill saysok.Fix
From #29574: the shadow keeps
CODEX_HOMEfor its private auth, and T3 points Codex at the shared databases withCODEX_SQLITE_HOME. T3 never links a database into a new shadow, and refuses ambiguous mixed or stranded SQLite state before changing anything. The driver, orchestration adapter, managed runtime, text generation and provider terminals all use the same routing.The stopped review's case is a shadow with its own
state_5.sqlitewhile the shared home hasgoals_1.sqlite. With no override,3001024b77already handles it: on native Windows it refused before linking anything and left both homes unchanged. The gap was an explicitCODEX_SQLITE_HOME. It returned before every check, so pointing it at a shadow that holds a symlinked database brought the split back. The follow-up commits change only Windows behaviour:cfd6b1bdfb: an explicitCODEX_SQLITE_HOMEother than the shared home is refused if it holds a symlinked.sqlitedatabase.1e110ac3cacloses three more routes to a split:sqlite_homefrom any config layer aboveCODEX_SQLITE_HOME. T3 now passes the directory it checked as a final-c sqlite_home=…tocodex app-server,codex execandcodex mcp list. It refuses a rootsqlite_homein the shadow's or shared home'sconfig.toml, or in the launch args, because Codex typed into a provider terminal gets no-cfrom T3.CODEX_SQLITE_HOMEis refused. Probes, sessions and text generation each start Codex in a different directory.846e6ddb83: a provider terminal merges the host, client and instance environments by name ignoring case, keeping instance over client over host. Before, a client'scodex_sqlite_homelost to the host'sCODEX_SQLITE_HOME.766ced0bf8: only Codex's rootsqlite_homecounts. An MCP server'ssqlite_homeenvironment variable, the text inside a multi-line string and-c mcp_servers.<name>.env.sqlite_home=…are not refused.config.tomlis read by an 85-line scanner, because apps/server has no TOML parser.f7b860b87f: threeCodexHomeLayouttests failed on native Windows only, which CI doesn't run. Their expectations now include the pin variable and Windows path resolution. The relative-path test no longer assumes the temp directory is on the repo's drive.Every refusal names the files and the steps to recover, and leaves all SQLite files unchanged.
Verification
Native Windows 11 Pro 26200, Codex CLI 0.170.0, Node 26.13.1, on this tree
Focused suites, one file at a time:
All 6 failures fail the same way on clean
main8cf97b5f06:CodexManagedRuntime.test.ts:126, twice;auth.jsonwatch timeout;$SHELLtests from fix(server): preserve shell paths containing spaces and dashes #37069.CodexTextGeneration also exits 1 from two unhandled
ECONNRESETerrors, the same onmain.The
-cpin survives Windows spawning. T3 runscodex.CMDthroughcmd.exewithshell: true, so the chain is cmd → codex.cmd → node → codex.exe. We drove the real CLI through both T3 paths,CodexAdapterV2.openand theCodexProviderprobe. A trusted project's.codex/config.tomlsetsqlite_hometo the shadow:-waland-shm) landed in the shadow, from the project layer.config/readreportedsqlite_homefromsessionFlags, and all 15 files landed in the shared home, none in the shadow.t3 sqlite's shared. codex.exe received-c "sqlite_home=\"C:\\…\\t3 sqlite's shared\""and decoded the exact path.config.tomlguard, on real files. A rootsqlite_homeis refused in the shadow's or the shared config with LF, CRLF, BOM+CRLF and a quoted key. The MCP environment key, a commented-out key and the key inside"""are allowed. Refusals left both trees unchanged.Override guard, on
cfd6b1bdfb.mklink /J) and a directory symlink to a shadow holding a symlinkedgoals_1.sqlite.Terminal merge. The client beats the host whichever spelling each uses, and the instance beats both.
T3CODE_CODEX_SQLITE_HOME, which carries the pin, never reaches the terminal.Real Codex app-server. With
CODEX_SQLITE_HOMEset to the shared home, it created every database and its sidecars only in the shared folder.Linux (Raspberry Pi), Codex CLI 0.170.0
codex app-serverand compared where it opened its databases with T3's verdict. 25 agree, and 2 are refused on purpose (below). In none did Codex usesqlite_homewhile T3 allowed the launch.Limitations
config.tomlwith an unclosed string or array is refused if any line could set the key. Codex drops such a file.-c '"sqlite_home"=…'is refused. Codex 0.170.0 ignores it.sqlite_homefrom a layer T3 can't read, such as a project's.codex/config.toml.cwd.CodexAdapterV2.openpasses nocwd, so the test passed the project itself.config/readfor that project still resolved to the pin.sqlite_homefrom Codex's managed requirements, and real managed ChatGPT OAuth.auth.json.lockdisabling a provider are fix(server): new Codex home entries no longer disable shadow-home providers #32058's problem, not this one.🤖 Generated with Claude Code