Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(usage): identify Codex quotas by workspace account #10873

Closedkalvenschraut(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/10873/headopened View on GitHub

Showing 9 changed files with 157 additions and 4 deletions (loading 7).

x
0 of 9 viewed, 9 left
80 additions and 1 deletionapps/server/src/provider/Layers/CodexProvider.test.tsModified
View file
@@ -1,6 +1,85 @@
import { assert, it } from "@effect/vitest";
+import * as NodeFSP from "node:fs/promises";
+import * as NodeOS from "node:os";
+import * as NodePath from "node:path";
+import * as Effect from "effect/Effect";
​
-import { applyPreferredCodexDefaultModel, mapCodexModelCapabilities } from "./CodexProvider.ts";
+import {
+ applyPreferredCodexDefaultModel,
+ mapCodexModelCapabilities,
+ readCodexAccountId,
+ resolveCodexAuthHome,
+} from "./CodexProvider.ts";
+​
+it("resolves the selected or shadow home ahead of inherited credentials", () => {
+ const inherited = { CODEX_HOME: "/shared", HOME: "/user" };
+ assert.strictEqual(
+ resolveCodexAuthHome(
+ { homePath: "/shadow", environment: { CODEX_HOME: "/instance" } },
+ inherited,
+ ),
+ "/shadow",
+ );
+ assert.strictEqual(
+ resolveCodexAuthHome({ environment: { CODEX_HOME: "/instance" } }, inherited),
+ "/instance",
+ );
+ assert.strictEqual(resolveCodexAuthHome({}, inherited), "/shared");
+ assert.strictEqual(
+ resolveCodexAuthHome({ environment: { HOME: "/instance-user" } }, { HOME: "/user" }),