Repository navigation
[PR] fix(codex): keep marketplace Git repos inside CODEX_HOME (overlay owns .tmp) - #5586
ranxianglei wants to merge 1 commit into
Conversation
…5584) bili codex shares the real codex home into its overlay via symlinks, which linked $CODEX_HOME/.tmp in from the real home. Codex stores git-backed marketplace/plugin checkouts under $CODEX_HOME/.tmp/marketplaces/<name>, so their canonical paths resolved back OUTSIDE the active overlay home and Codex rejected every such update with "trusted Git repository root escapes Codex home". The overlay now owns .tmp itself: refreshOverlayHome/finalizeCodexHome take a localOnlyEntries exclusion set ({".tmp"}) so .tmp is never linked in from the real home, never merged back into it, and a stale escaping symlink left by a pre-fix launch is dropped at startup so codex recreates it as a genuine per-overlay path. dsh's shared-home fold is unaffected (opt-in param). Regression suite: tests/codex-overlay-tmp-containment.test.ts (fresh, persistence across launch+exit, stale-symlink migration, plus a negative control proving the old behavior escapes). Closes #5584
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.7960-pr.5586.de9100dThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5586.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) PR #5586 审核结论:代码正确、测试有牙、可合;当前 CI 红是继承性失败,与本 PR 无关。 先说 CI(最关键,已拉 job 日志逐一核对)
代码本体(逐路径核对了 refreshOverlayHome / finalizeCodexHome / prepareCodexHome / migrateLegacyCodexOverlay / runLaunch)结构化八问:
测试有效性:4 个 case 都有牙——尤其第 4 个是负向对照(不传 diff 整洁度 & 代码整洁:仅 2 文件(src/launcher.ts +39/-7、新增测试 +117),无 lockfile/version/kernel 变动、无空行噪音。命名达意( 判定:✅ 代码与测试质量达标、方向正确、无无意回归,可合。唯一拦路的是继承性 CI 红(storage-engine-proofs golden 漂移,与本 PR 无关)——按 CI 协调纪律等 master/ci-fixes 收敛后重跑转绿即可,无需在本 PR 内处理。 |
|
(ai: sglang-gpu0/qwen3.8-27b) 已合入 master: 本 PR 的改动经「codex 车道小修合集第三辑」#5971 送审合入。本 PR 关闭以免重复。 |
…ontainment (for ranxianglei#5586, closes ranxianglei#5584)
What
Fixes the
bili codexfailure where Codex rejects every Git-backed plugin-marketplace update with:(affected marketplaces:
context-mode,context7-marketplace,floorplan). Plaincodexnever shows this.Root cause
bili codexruns Codex against an overlay home (~/.codex-bili, or a per-session slot~/.codex-bili-sN). To share the user's existing Codex state, the launcher symlinks every entry of the real~/.codexinto the overlay — including.tmp. Codex keeps its marketplace/plugin Git checkouts under$CODEX_HOME/.tmp/marketplaces/<name>, so withCODEX_HOME=<overlay>those repo paths resolve back through the.tmpsymlink into the real home — outside the active home. Codex's containment check ("trusted Git repository root escapes Codex home") then rejects each update. Plaincodexuses~/.codexdirectly, where.tmpis a real subdirectory, so nothing escapes.Fix
The overlay now owns
.tmpinstead of sharing it.refreshOverlayHomeandfinalizeCodexHometake an opt-inlocalOnlyEntriesexclusion set ({ ".tmp" }for the codex lane):.tmpinto the overlay (and excludes it from the hollow-home accounting);.tmpback into the real home nor relinks it;.tmpsymlink left by a pre-fix launch is dropped at startup so Codex recreates it as a genuine per-overlay path.The dsh shared-home fold is untouched (it does not pass the set, so its behavior is byte-for-byte unchanged).
Behavior change (disclosed)
bili codexshared~/.codex/.tmpinto the overlay via a symlink, so its marketplace Git repos escaped the active home and every Git-backed marketplace update failed.~/.codex-bilihome or a-sNslot) owns its own.tmp; Codex clones its marketplaces into it on first launch (one-time per overlay; the directory then persists). Marketplace/plugin data still works, and nothing in the real~/.codex/.tmpis touched.No new config fields, env vars, or CLI flags are introduced.
Tests
New hermetic suite
tests/codex-overlay-tmp-containment.test.ts:.tmpin (unrelated entries still link through);.tmppersists across re-launch refresh and exit finalize (no merge-back, no relink, no real-home pollution), with the containment invariant asserted (the repo's canonical path resolves inside the active home);prepareCodexHomemigrates away a stale escaping.tmpsymlink;.tmpin and escapes (so the suite has teeth).Local:
npm run typecheckclean; targeted suites green (66/66: the new suite pluslauncher-sqlite-overlay,codex-concurrent-launch,launcher-codex-sqlite-home,codex-overlay-env). Full regression runs on CI.Closes #5584