fix(codex-link): isolate model transfers and widen local connection capacity
Server CI and Windows package / verify (push) Successful in 2m3s
Server CI and Windows package / windows-package (push) Successful in 6m58s

This commit is contained in:
yilsem committed 2026-10-13 00:35:08 +03:00
1 parent 2718b460ed
commit 369f6c2ca8
16 files changed
+790 -40

No files matched your search

+24
View File
@@ -39,6 +39,7 @@ interface World {
probesUntilUp: number
autostart: null | string
regFails: boolean
configWriteFails: boolean
/** Every observable effect, in order. */
events: string[]
clock: number
@@ -59,6 +60,7 @@ function createWorld(patch: Partial<World> & { files?: Map<string, string> } = {
staleVersion: null,
probesUntilUp: 0,
regFails: false,
configWriteFails: false,
spawnWorks: true,
...patch
}
@@ -71,6 +73,7 @@ function createWorld(patch: Partial<World> & { files?: Map<string, string> } = {
exists: file => world.files.has(file),
readText: file => world.files.get(file) ?? null,
writeTextAtomic: (file, text) => {
if (file === PATHS.codexConfig && world.configWriteFails) throw new Error('config locked')
world.events.push(`write ${file}`)
world.files.set(file, text)
},
@@ -332,6 +335,27 @@ describe('applyCodexLink', () => {
expect(world.listening).toBe(false)
})
it('keeps the bridge and login item if disconnect cannot restore the config', async () => {
const { link, world } = createWorld({ listening: true })
await link.apply()
const linkedConfig = world.files.get(PATHS.codexConfig)
const autostart = world.autostart
world.events.length = 0
world.configWriteFails = true
expect(await link.apply({ enabled: false })).toMatchObject({
bridgeRunning: true, lastError: 'config-write-failed'
})
expect(world.files.get(PATHS.codexConfig)).toBe(linkedConfig)
expect(world.autostart).toBe(autostart)
expect(world.events).not.toContain('stop')
expect(world.events).not.toContain('autostart clear')
world.configWriteFails = false
expect(await link.apply({ enabled: false })).toMatchObject({ bridgeRunning: false, lastError: null })
expect(world.files.get(PATHS.codexConfig)).toBe(USER_CONFIG)
})
it('stays off across applies and comes back when turned on', async () => {
const { link, world } = createWorld()
world.files.set(PATHS.settingsFile, '{"enabled": false, "kapsam": "ide", "not": "ours"}')