Skip to content

Commit 019ce4c

Browse files
committed
fix: recognize owned Codex model catalog cache during host probes
1 parent f3cd961 commit 019ce4c

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

scripts/lib/real-codex-host-probe.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,8 @@ function partitionInstalledRuntimeEffects(effects, identity) {
10211021
} else if (change.root === 'globalHome') {
10221022
owned = createdDirectory && ['.codex/devcodex/.runtime-generation-leases', leaseRoot].includes(name)
10231023
if (ordinaryFile) {
1024-
owned = /^\.codex\/(?:state|goals|logs|memories)_[0-9]+\.sqlite(?:-shm|-wal)?$/u.test(name) ||
1024+
owned = name === '.codex/models_cache.json' ||
1025+
/^\.codex\/(?:state|goals|logs|memories)_[0-9]+\.sqlite(?:-shm|-wal)?$/u.test(name) ||
10251026
/^AppData\/Local\/Microsoft\/PowerShell\/(?:ModuleAnalysisCache-[A-Fa-f0-9]+|StartupProfileData-NonInteractive)$/u.test(name) ||
10261027
(name.startsWith(leaseRoot + '/') && /^(?:memory|profile)-mcp-[a-f0-9]{8}-[0-9]+\.json$/u.test(name.slice(leaseRoot.length + 1)))
10271028
}

scripts/test-real-codex-host-probe.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,7 @@ async function main() {
700700
[effectHome, '.codex/goals_1.sqlite-shm'],
701701
[effectHome, '.codex/memories_1.sqlite'],
702702
[effectHome, '.codex/state_5.sqlite-wal'],
703+
[effectHome, '.codex/models_cache.json'],
703704
[effectHome, '.codex/devcodex/.runtime-generation-leases/fixture-generation/memory-mcp-24efaa5d-12032.json'],
704705
[effectHome, 'AppData/Local/Microsoft/PowerShell/ModuleAnalysisCache-0C86AEE9'],
705706
[effectHome, 'AppData/Local/Microsoft/PowerShell/StartupProfileData-NonInteractive'],
@@ -738,6 +739,7 @@ async function main() {
738739
]) assert.strictEqual(canContinueIndependentInstalledTurn({ ...deniedReceipt, ...changed }), false)
739740
for (const [root, name] of [
740741
['globalHome', '.codex/config.toml'], ['globalHome', '.codex/auth.json'],
742+
['globalHome', '.codex/models_cache.json.backup'], ['addDir', '.codex/models_cache.json'],
741743
['globalHome', '.codex/devcodex/runtime-fixture-generation/mcp/memory-server.js'],
742744
['globalHome', '.codex/devcodex/.runtime-generation-leases/other-generation/memory-mcp-24efaa5d-12032.json'],
743745
['addDir', '.memory/hooks/another-project/lifecycle-state.json'], ['addDir', 'unexpected.txt'],
@@ -748,6 +750,8 @@ async function main() {
748750
}
749751
const linkEffect = { root: 'globalHome', path: '.codex/logs_2.sqlite', before: null, after: { type: 'symlink', target: sourceRoot } }
750752
assert.deepStrictEqual(partitionInstalledRuntimeEffects({ ...rawEffects, unexpectedChanges: [linkEffect] }, effectIdentity).unexpectedChanges, [linkEffect])
753+
const cacheLinkEffect = { ...linkEffect, path: '.codex/models_cache.json' }
754+
assert.deepStrictEqual(partitionInstalledRuntimeEffects({ ...rawEffects, unexpectedChanges: [cacheLinkEffect] }, effectIdentity).unexpectedChanges, [cacheLinkEffect])
751755
const independentLedger = initializeAttemptLedger({ evidenceRoot, identity: effectIdentity })
752756
const deniedAttempt = claimAttempt(independentLedger, 'H1')
753757
const deniedBytes = Buffer.from(JSON.stringify(deniedReceipt) + '\n')

0 commit comments

Comments
 (0)