Skip to content

Commit 4abe6d5

Browse files
sahrizviclaude
andcommitted
docs(codex): correct stale sibling-plugin ownership comments
coderabbit MINOR round-3 catch: after reverting the plugin/openai/codex.ts changes, the docstring on `shouldAllowOAuthModel` and the test file's top comment still claimed the helper is "shared across both files" — that hasn't been true since I reverted openai/codex.ts. A future contributor reading the current tip would mistakenly assume the sibling filter has the same policy. Both docstrings now describe this as the ACTIVE plugin's policy (plugin/codex.ts, wired via plugin/index.ts) and explicitly call out that plugin/openai/codex.ts has its own separate filter with the parseFloat > 5.4 fallback — adopting the shared helper is followup on that file's refactor. Doc-only. 26/26 tests pass; typecheck clean; marker guard clean. Co-Authored-By: Claude Opus 4.7 <[email protected]>
1 parent bc4f1c1 commit 4abe6d5

2 files changed

Lines changed: 21 additions & 13 deletions

File tree

‎packages/opencode/src/plugin/codex.ts‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,17 @@ export const OAUTH_ALLOWED_MODELS = new Set([
3030
"gpt-5.6",
3131
])
3232

33-
/** Single source of truth for OAuth (ChatGPT-subscription) model filtering.
34-
* A model is kept if either (a) its id contains ``"codex"`` (all codex
35-
* variants ship on the subscription), or (b) its id is an exact member of
36-
* ``OAUTH_ALLOWED_MODELS`` (the curated non-codex releases). Reused across
37-
* plugin/codex.ts and plugin/openai/codex.ts to prevent drift between the
38-
* two implementations during the in-flight refactor. */
33+
/** OAuth (ChatGPT-subscription) model-filter policy for the ACTIVE plugin
34+
* (this file — wired via plugin/index.ts). A model is kept if either
35+
* (a) its id contains ``"codex"`` (all codex variants ship on the
36+
* subscription), or (b) its id is an exact member of
37+
* ``OAUTH_ALLOWED_MODELS`` (the curated non-codex releases).
38+
*
39+
* The sibling file plugin/openai/codex.ts (an in-progress refactor,
40+
* currently NOT wired) has its own separate filter with a
41+
* ``parseFloat(match[1]) > 5.4`` fallback. Adopting this helper is
42+
* followup work on that refactor — do NOT assume the two files share
43+
* this policy today. */
3944
export function shouldAllowOAuthModel(modelId: string): boolean {
4045
if (modelId.includes("codex")) return true
4146
return OAUTH_ALLOWED_MODELS.has(modelId)

‎packages/opencode/test/plugin/codex-allowlist.test.ts‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
// Regression coverage for the ChatGPT-subscription (OAuth) model filter
2-
// in packages/opencode/src/plugin/codex.ts (the ACTIVE plugin wired via
3-
// plugin/index.ts). The sibling file plugin/openai/codex.ts is an
4-
// in-progress refactor that reuses ``shouldAllowOAuthModel`` from this
5-
// same module — so the filter behavior is tested once here.
2+
// in packages/opencode/src/plugin/codex.ts — the ACTIVE plugin wired
3+
// via plugin/index.ts.
64
//
75
// Filed as issue #1132: GPT 5.6 was released but the allowlist stopped
86
// at 5.4, so users on ChatGPT Pro/Plus (Codex tier) couldn't pick it in
97
// the model picker even though the underlying models.dev catalog had it.
108
//
11-
// Sibling test file test/plugin/codex.test.ts covers the OAuth-flow +
12-
// JWT parsing internals of plugin/openai/codex.ts. This file covers
13-
// only the OAuth model-filter policy shared by both files.
9+
// Sibling file plugin/openai/codex.ts is an in-progress refactor of the
10+
// same plugin, currently NOT wired via plugin/index.ts, and NOT covered
11+
// by this file — it has its own separate ``ALLOWED_MODELS`` + a
12+
// ``parseFloat > 5.4`` fallback in its ``models()`` filter, and its
13+
// existing test file (test/plugin/codex.test.ts) already covers its
14+
// OAuth-flow + JWT parsing internals. When that refactor is wired,
15+
// adopting ``shouldAllowOAuthModel`` here (and expanding this file's
16+
// coverage to the newly-active filter) is followup work.
1417
import { describe, expect, test } from "bun:test"
1518
import { OAUTH_ALLOWED_MODELS, shouldAllowOAuthModel } from "../../src/plugin/codex"
1619

0 commit comments

Comments
 (0)