Skip to content

Commit 1128ed7

Browse files
refactor(auth): trim dead usage formatters and demo (#1031)
* chore(cl-6815): trim unreachable usage formatters, demo, kickoff stub Decision: usage display is not a product surface — delete fetch/format helpers and their tests rather than wiring them in. Keep only the live auth-header helpers used by oauth-scope-check, renamed usage.ts -> auth-headers.ts. Delete src/tui/demo.ts (410 lines, README-only reference) and the unreferenced workflows/kickoff stub. Net-negative. * chore: clean post-purge stale references (#1052) * chore: clean post-purge stale references * fix(auth): omit empty account id and pin auth header boundaries (#1064)
1 parent 9b073d8 commit 1128ed7

18 files changed

Lines changed: 149 additions & 1020 deletions

.oxlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
}
9292
},
9393
{
94-
"files": ["src/tui/smoke.ts", "src/tui/demo.ts"],
94+
"files": ["src/tui/smoke.ts"],
9595
"rules": {
9696
"no-console": "off"
9797
}

scripts/ci-timings.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,6 @@
474474
"src/util/control-char-strip.test.ts": 1,
475475
"src/util/tool-output-uri.test.ts": 1,
476476
"tests/helpers/defined.test.ts": 1,
477-
"tests/unit/codex-usage.test.ts": 1,
478477
"tests/unit/context-window.test.ts": 1,
479478
"tests/unit/director.test.ts": 1,
480479
"tests/unit/faremeter.test.ts": 1,
@@ -491,7 +490,6 @@
491490
"tests/unit/tui/theme.test.ts": 1,
492491
"tests/unit/tui/tool-formatter-web-brand.test.ts": 1,
493492
"tests/unit/tui/url-links.test.ts": 1,
494-
"tests/unit/workflow-kickoff.test.ts": 1,
495493
"tests/unit/workflows-capabilities.test.ts": 1,
496494
"src/agent/directors/counsel/package.test.ts": 0,
497495
"src/inference-abort.test.ts": 0,
@@ -510,7 +508,6 @@
510508
"tests/unit/mcp-stdio-env.test.ts": 0,
511509
"tests/unit/provider-protocol-flags.test.ts": 0,
512510
"tests/unit/run-agent.test.ts": 0,
513-
"tests/unit/session/run-sink-exec-status.test.ts": 0,
514-
"tests/unit/xai-usage.test.ts": 0
511+
"tests/unit/session/run-sink-exec-status.test.ts": 0
515512
}
516513
}

src/auth/codex/auth-headers.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { CODEX_CLIENT_VERSION, CODEX_ORIGINATOR } from "./constants.js";
2+
3+
export function codexAuthHeadersForToken(
4+
token: {
5+
readonly access: string;
6+
readonly accountId?: string | undefined;
7+
},
8+
commandName: string,
9+
): Record<string, string> {
10+
const headers: Record<string, string> = {
11+
authorization: `Bearer ${token.access}`,
12+
originator: CODEX_ORIGINATOR,
13+
"user-agent": `${commandName} (${CODEX_ORIGINATOR}/${CODEX_CLIENT_VERSION})`,
14+
};
15+
// An empty account id carries no identity — sending it as a header value
16+
// would label the request with a meaningless id. Only a non-empty id rides.
17+
if (token.accountId) headers["chatgpt-account-id"] = token.accountId;
18+
return headers;
19+
}

src/auth/codex/constants.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ const codexRedirect = new URL(CODEX_REDIRECT_URI);
1111
export const CODEX_CALLBACK_PORT = Number(codexRedirect.port);
1212
export const CODEX_CALLBACK_PATH = codexRedirect.pathname;
1313

14-
// Live usage/quota for the prepaid plan (window %, reset, credits) and the
15-
// account's available model catalog. The models endpoint requires a
14+
// The account's available model catalog. The models endpoint requires a
1615
// client_version query param.
17-
export const CODEX_USAGE_PATH = "/codex/usage";
1816
export const CODEX_MODELS_PATH = "/codex/models";
1917
export const CODEX_CLIENT_VERSION = "0.50.0";
2018

src/auth/codex/usage.ts

Lines changed: 0 additions & 214 deletions
This file was deleted.

0 commit comments

Comments
 (0)