Repository navigation
fix(server): keep Codex shadow memories private - #147
chrisohearn merged 6 commits into
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
chrisohearn
left a comment
There was a problem hiding this comment.
Independent review of record (fallback for the hosted Codex review, which failed on a usage limit)
Scope. I reviewed head e2b59e5e414bf0b1b3b6c877525474d5226eff9d against base 7ab03827a574f7fe767f8a91afa54a5e2b20f60a. I fetched refs/pull/147/head and integration/mcp-events-20261109 into an isolated clone, confirmed both SHAs, and confirmed the merge base is the base commit. I read the full diff (11 files, +766/−39), FORK.md at the head, and the surrounding code in CodexHomeLayout.ts, codexShadowPreflight.ts, CodexDriver.ts and the update guard.
Verification.
- CI: every check on this head passed: Build and Typecheck, Lint, Test, Test Server 1–8, Release Smoke, Update guard tests, Upstream stable tag tests and Agent context budget. Mobile, Web and Rust were skipped.
- Local runs:
test-guard.shandtest-upstream-stable-tag.shboth passed (rc=0).
Verdict: no blocking findings.
Findings
P2 (nonblocking): a shadow redirect during an update leaves the outage clock open
- Where:
scripts/fork/host/t3-update-guard/guard:1120(outage_begin "update $cur -> $latest") and the redirect branch atguard:1189-1195. - What happens: when launch sends the update to a known-ready build,
cmd_updatewrites the rejected marker, callsreportand returns 1, but never callsoutage_end. The fallback build'sprovecan't close the outage either: it runs about 75 s after the start, whilecmd_updatestill holds$LOCK, so it takes the early-return branch atguard:550before it reachesoutage_end. No laterproveruns, because the guard doesn't restart the fallback. - Impact:
outage-sincestays on disk while the fallback is serving normally. Because the redirect'sreporttouchesoutage-reported, the nextprovecan report an inflated recovery duration and attribute unrelated fatal breadcrumbs to this stale outage. - Fix: call
outage_end "$selected"beforenotify/reportin the redirect branch. Extend the redirect test to keep the real outage functions and assert that$OUTAGEis gone aftercmd_updatereturns.
P3 (nonblocking nit): the release-note banner never retires
- Where:
scripts/fork/publish-release.sh:13-15. - What happens: the “Codex shadow compatibility” paragraph is added to every future release's notes unless the caller's notes already contain it. It stays relevant only while a downgrade to a pre-#147 build is plausible.
- Fix: gate it so it appears only in the first release containing this change, or record in
FORK.mdwhen to remove it.
Focus areas checked, no issues
- Migration namespace: the database check is unchanged in substance. It moved into
preflight_allows_database, and the launcher-protocol exemption is kept. - Shadow-home setup and refusal order: the refusal now happens before unlinking or moving anything. Moving
removePrivateSymlinkafter the refusal is safe because the inspect step skips private entry names, so no refusal depended on those links being gone first.- Adding
memories_v2to the shadow-local entry names stops new builds from linking it. removeSharedMemoriesV2Linkremoves the link only when it resolves to the sharedmemories_v2(directly or by real path). It never touches the shared target or a real local directory.- When the shadow directory isn't writable, the link is correctly reported as not settleable. Tests cover keeping local data, unlinking with shared content intact, and refusing without touching anything.
- Adding
- Database incompatibility vs shadow readiness:
can_startreturns 0 (ready), 1 (positive conflict), 2 (database incompatible) or 3 (unknown), and the guard keeps these apart. A shadow-only failure never restores the pre-update snapshot. Unknown preflight keeps the active build that can open the database and never downgrades on that basis. - Launch and rollback availability: every launch path still ends in
exec. Rollback prefers a healthy build reported ready, then falls back to any build that can open the database, so service stays up. Older builds without a shadow report are never preferred over the active build. - Update after a launch redirect: the redirect requires the selected build to be serving the port, up at least 60 s, trusted and healthy, able to open the database, and the new release still to report a positive conflict. It marks the release rejected on this host only and returns without stopping or restarting the fallback.
- Preflight
CODEX_HOME:!config.homePath?.trim() && environment.CODEX_HOMEnow matches the runtime's home-path selection. This fixes the mismatch when a shadow home was set buthomePathwas absent. - Release gate and upstream sync:
env -u CODEX_HOME -u CODEX_SQLITE_HOMEprevents a caller's shell from steering__service-preflight, while per-instance settings still apply. The gate still requirescodexShadowHomes == ready, and anauto-settleinstance rolls up toready. Stable-tag-only targeting is unchanged, and its suite passes. - Documentation:
FORK.mdand the guard README match the behavior, including the documented trade-off that an older build may refuse a Codex instance once it has localmemories_v2data.
Close the update outage clock when a shadow conflict redirects to the known-serving fallback, and cover the real recovery path in the guard test. Retire the compatibility note after the first release containing its marker. GPT-6 Luna in T3 Code (Codex harness).
chrisohearn
left a comment
There was a problem hiding this comment.
Independent review of record (fallback for the hosted Codex review, which failed on a usage limit)
Scope. Reviewed PR #147 at head f8ea21009dc5247c6dd05bca4e02e41d4310d2f3 against base 7ab03827a574f7fe767f8a91afa54a5e2b20f60a (integration/mcp-events-20261109). The reviewer confirmed the merge base equals the base and examined the full PR diff and FORK.md.
Provenance. The review ran as Claude Opus 5.5. The delegated request specified high effort and the T3 dispatch returned effort=high; the reviewer reports its native session header showed a numeric setting of 15 and could not independently confirm that label mapping. This review is posted with that limitation disclosed.
Verification.
- All 20 checks passed on this head: Build and Typecheck, Lint, Test, Test Server 1–8, Release Smoke, Fork host update guard, Upstream stable tag tests, and Agent Context Budget. Mobile, Web and Rust were skipped.
- Reviewer ran
test-guard.shandtest-upstream-stable-tag.shfrom an exported copy of the head; both passed. - The regression checks fail if either repair is removed.
Verdict: no blocking findings.
Previous findings resolved
- P2, outage clock after shadow redirect:
guard:1193now callsoutage_end "$selected"before notification/reporting. The redirect test runs the real outage/report functions and asserts the outage file and report marker are cleared and recovery is logged on the fallback. - P3, compatibility note repeated in later releases:
publish-release.shchecks the publisher marker on the previous preview tag. The fixture proves the first release includes the note and a later release retires it.
Nonblocking follow-ups
- The redirect recovery duration includes the candidate health-wait interval, even though the fallback was already serving. Filed as #148.
- The
v*-preview.*tag glob can include upstream preview tags; if one later sorts above the newest fork preview, the compatibility note could return. Filed as #149.
A separate canary-failure branch at guard:1206 was present in the base and is outside this PR.
2b0622c
into
integration/mcp-events-20261109
Codex CLI 0.170 creates
memories_v2in the shared home while each shadow may retain its own real directory. Older setup treated a real shadow directory as a conflict and left legacy links to shared memories in place.This change:
memories_v2as shadow-local, preserving shared contents and real per-instance memory;CODEX_HOMEandCODEX_SQLITE_HOMEfrom release preflight so an agent shell cannot redirect the check.Release note:
Codex memories now stay private to each shadow home. Older releases may refuse to start that Codex instance after local
memories_v2has been created; upgrade to this release to restore the instance. Shared memories are preserved.Closes #146
Validation:
bash scripts/fork/host/t3-update-guard/test-guard.sh— passed, including launch, rollback, legacy-preflight, and shadow-only snapshot cases.pnpm exec vp test run apps/server/src/provider/Drivers/CodexHomeLayout.test.ts apps/server/src/cloud/codexShadowPreflight.test.ts— 32/32 passed.pnpm exec vp run check:changed origin/integration/mcp-events-20261109— all stages passed (format, lint, knip, GraphQL, typecheck, 34 tests across 3 files).scripts/fork/test-upstream-stable-tag.sh— passed.