perf(codex): gate retained route inventory

This commit is contained in:
Brennan Benson
2026-07-31 17:59:32 -07:00
parent f8bc8055e9
commit 54980f0e05
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -849,7 +849,7 @@ function startTerminalRuntimeStartupServices(): Promise<void> {
await initDaemonPtyProvider(signal, {
macosLoginSessionWatch: process.platform === 'darwin' && !isServeMode
})
if (hasRecordedLegacySharedCodexPane()) {
if (codexRuntimeHome?.isHostSystemDefaultRealHome() && hasRecordedLegacySharedCodexPane()) {
const livePtyIds = await listLiveDaemonPtyIds()
if (livePtyIds) {
reconcileCodexPaneAccountsWithLivePtys(livePtyIds)
@@ -98,6 +98,10 @@ describe('startup ordering', () => {
it('reconciles retained Codex homes after authoritative daemon inventory', () => {
const source = readFileSync(join(process.cwd(), 'src/main/index.ts'), 'utf8')
const daemonInitIndex = source.indexOf('await initDaemonPtyProvider(signal')
const routeGateIndex = source.indexOf(
'codexRuntimeHome?.isHostSystemDefaultRealHome()',
daemonInitIndex
)
const inventoryIndex = source.indexOf('await listLiveDaemonPtyIds()', daemonInitIndex)
const reconciliation = 'codexRuntimeHome?.reconcileLegacySharedHomeForRetainedPanes()'
const reconciliationIndex = source.indexOf(reconciliation, inventoryIndex)
@@ -105,7 +109,8 @@ describe('startup ordering', () => {
const desktopIndex = source.indexOf('Promise.resolve(openMainWindow())', serveIndex)
expect(daemonInitIndex).toBeGreaterThanOrEqual(0)
expect(inventoryIndex).toBeGreaterThan(daemonInitIndex)
expect(routeGateIndex).toBeGreaterThan(daemonInitIndex)
expect(inventoryIndex).toBeGreaterThan(routeGateIndex)
expect(reconciliationIndex).toBeGreaterThan(inventoryIndex)
expect(serveIndex).toBeGreaterThan(reconciliationIndex)
expect(desktopIndex).toBeGreaterThan(serveIndex)