Skip to content

Commit 125156c

Browse files
committed
fix(windows): preserve short unknown catalog retries
1 parent b2563de commit 125156c

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎docs-site/src/content/docs/guides/sub-agent-surface.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ separately by `ocx doctor`. `stale` clears only after every detected Codex app-s
260260
the final catalog write; it does not necessarily clear `unknown`.
261261

262262
On Windows, this advisory check uses asynchronous PowerShell/CIM discovery on the v2 request path.
263-
Concurrent cold checks share one in-flight discovery and results are cached briefly. A
263+
Concurrent cold checks share one in-flight discovery. Observed states are cached for five seconds;
264+
an `unknown` failure is cached for only 250 milliseconds so a transient CIM error retries quickly. A
264265
slow or failing CIM query can delay or suppress only OpenCodex-authored model guidance; it does not
265266
block the Bun event loop, `/healthz`, or unrelated proxy traffic. Explicit CLI/service lifecycle
266267
operations retain the synchronous, fail-closed process collector because they may signal processes.

‎src/codex/app-server-processes.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ export async function collectCodexAppServerCatalogStateForRequest(
854854
if (requestCatalogStateCache
855855
&& requestCatalogStateCache.generation === generation
856856
&& sameRequestCatalogStateIdentity(requestCatalogStateCache.identity, identity)
857-
&& now - requestCatalogStateCache.atMs < CATALOG_STATE_TTL_MS) {
857+
&& now - requestCatalogStateCache.atMs < catalogStateTtlMs(requestCatalogStateCache.status.state)) {
858858
return requestCatalogStateCache.status;
859859
}
860860
if (requestCatalogStateFlight

‎tests/codex-app-server-processes.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ describe("collectCodexAppServerCatalogState (#857)", () => {
185185
// Failure is advisory and fail-closed, but caching it briefly prevents a
186186
// broken CIM provider from spawning one PowerShell process per request.
187187
expect(calls).toBe(1);
188+
189+
now += 241;
190+
await expect(collectCodexAppServerCatalogStateForRequest(io)).resolves.toMatchObject({
191+
state: "unknown",
192+
});
193+
expect(calls).toBe(2);
188194
resetCodexAppServerCatalogStateCache();
189195
});
190196

0 commit comments

Comments
 (0)