Skip to content

Commit a90375e

Browse files
t3dotggclaude
andcommitted
test(server): removal case starts from a stale entitled catalog
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 209ee83 commit a90375e

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎apps/server/src/provider/CodexProvider.catalog.test.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ const solServiceTiers = Effect.fn("solServiceTiers")(function* (ultrafastEntitle
6060
const binaryPath = path.join(dir, "codex");
6161
yield* fs.writeFileString(binaryPath, FAKE_CODEX_APP_SERVER);
6262
yield* fs.chmod(binaryPath, 0o755);
63-
// Another Codex client (the plain CLI) wrote a fresh catalog without Ultrafast.
63+
// A fresh cache written by another client: the plain CLI's (no Ultrafast)
64+
// when entitled, or a stale entitled catalog when the entitlement is gone.
6465
yield* fs.writeFileString(
6566
path.join(dir, "models_cache.json"),
6667
JSON.stringify({
@@ -75,7 +76,9 @@ const solServiceTiers = Effect.fn("solServiceTiers")(function* (ultrafastEntitle
7576
isDefault: true,
7677
defaultReasoningEffort: "high",
7778
supportedReasoningEfforts: [{ reasoningEffort: "high", description: "" }],
78-
serviceTiers: [{ id: "priority", name: "priority", description: "" }],
79+
serviceTiers: (ultrafastEntitled ? ["priority"] : ["priority", "ultrafast"]).map(
80+
(id) => ({ id, name: id, description: "" }),
81+
),
7982
},
8083
],
8184
}),
@@ -100,7 +103,7 @@ it.layer(NodeServices.layer, { excludeTestServices: true })("Codex catalog disco
100103
}).pipe(Effect.scoped),
101104
);
102105

103-
it.effect("drops Ultrafast when the account is not entitled to it", () =>
106+
it.effect("drops Ultrafast once the account is no longer entitled to it", () =>
104107
Effect.gen(function* () {
105108
assert.deepStrictEqual(yield* solServiceTiers(false), ["default", "priority"]);
106109
}).pipe(Effect.scoped),

‎apps/server/src/provider/CodexProvider.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ const readCodexModelsCacheFetchedAt = Effect.fn("readCodexModelsCacheFetchedAt")
381381
* not get Sol Ultrafast. So the first answer can be another client's catalog.
382382
* App-server refreshes the catalog online at startup, so wait until a write
383383
* newer than this process's spawn lands, then list again. If no refresh
384-
* lands in time, keep the first answer.
384+
* lands in time, keep the first answer. Another client writing in the same
385+
* few hundred milliseconds can still win; the next probe corrects it.
385386
*/
386387
const requestCodexChatGptModels = Effect.fn("requestCodexChatGptModels")(function* (input: {
387388
readonly client: CodexClient.CodexAppServerClient["Service"];

0 commit comments

Comments
 (0)