Repository navigation
Allow explicitly approved GPT-5.4 checker groups - #74
Conversation
|
OpenRouter review posted ( |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: issues
Scope: full-pr (full-pr)
Mode: initial
Commit: 344b27bb311fb90f2c9d56e87e504bd2d39a2ec3
Judge: openai/gpt-5.6-luna
Cost: $0.1844 (lanes $0.1800 + judge $0.0045)
Lanes
openai/gpt-6.1-sol: ok (1 finding(s), 46.2s, 125669+1645 tokens (85863 cached), 4 tool round(s), via Azure, $0.14)z-ai/glm-5.3-flash: ok (6 finding(s), 642.4s, 996887+44654 tokens (869248 cached), 19 tool round(s), via Particle AI, $0.0430)
Findings
🔵 Issue 1 — Stale approvals masking route-refusal regressions
worker/src/support-paid-checker-group.test.ts:301 · nit · identified by openai/gpt-6.1-sol
If configured group-price admission or the GPT-5.4 static tuple restrictions regress, several new refusal tests can still pass because their route mutations also invalidate the approval hash. They therefore do not independently pin the safeguards named by those cases.
groupFixture() signs the original route, but the parameterized test changes hash-bound fields without renewing the fictional approval:
over-budgetchangesproviderMaxPrice.prompt.exact-endpoint-in-groupchangesendpointTag.wrong-output-parameterchangesoutputTokenParameterto the otherwise supportedmax_tokensparameter.
For these cases, construct a matching fictional approval for the changed policy before checking refusal. Keep changed-price-hash deliberately unsigned so it continues to test hash invalidation separately.
I checked support-independent-checks-model.test.ts, which explicitly tests refusal after a hash-bound configuration mutation, and the new lower-live-price-cap case. The latter exercises a reduced call-time budget, not rejection of an otherwise correctly approved route whose configured worst-case price exceeds its cap. The SDK implementation is external to this checkout, but the hash-binding contract and the fixtures establish the competing refusal reason.
🟠 Issue 2 — GPT-5.4 tokenizer tables are now eagerly loaded and initialized in the main worker bundle regardless of profile
worker/src/support-paid-bootstrap.ts:15 · risk · identified by z-ai/glm-5.3-flash
With no SUPPORT_PAID_CONFIGURATION_JSON installed (the stated default: nothing enabled), or with a legacy mini-only checker profile, every isolate of the pegma-dev-api worker still loads the gpt-tokenizer/model/gpt-5.4 encoding tables and executes the import-time warm-up countTokens("", ordinaryText) before any profile validation runs. The checker feature is off or legacy-only, yet pays the bundle size, memory and cold-start CPU for the second large BPE table.
The mechanism: worker/src/support-paid-bootstrap.ts:15 statically imports the new support-independent-checks-token-counter.ts, whose module scope (lines 5-9) runs setMergeCacheSize(0) for both models plus the warm-up encode. The bootstrap itself is statically imported by the main worker entry (worker/src/index.ts:18, main = src/index.ts per worker/wrangler.jsonc). The codebase's own pattern defers exactly this cost: support-assistant-production.ts:223 loads ./support-assistant-token-counter only via await import(...) after configuration validation. docs/SUPPORT_CHECKER_UPGRADE.md (lines ~72-76) itself flags tokenizer work as a Free-CPU risk requiring a cold/warm CPU gate, and its line ~39 framing that "No ... feature flag is installed or enabled by this code change" does not cover the now-unconditionally shipped tokenizer tables.
Checked: pnpm-lock.yaml confirms gpt-tokenizer@4.1.2 is base-pinned and unchanged by this PR; only the new subpath import is new to the graph. Proof gap: node_modules is absent from the checkout, so I cannot measure the bundle delta; CI's check:worker wrangler dry-run would catch a script-size overrun but not per-isolate cold-start CPU. A lazy await import(...) at the createSupportIndependentCheckTokenCounter call site (mirroring the assistant pattern) would avoid the cost while keeping the capability.
🟠 Issue 3 — Most it.each hold cases mutate hash-bound route fields, so the refusals cannot be attributed to the SDK checks their names claim
worker/src/support-paid-checker-group.test.ts:274 · risk · identified by z-ai/glm-5.3-flash
A future SDK regression that deletes the providerSelectionScope cross-check, the request:0 rule, the finite-price rule, the endpoint/parameter/model allowlist match, or the worst-case cost cap would keep this suite green: the cases below still hold via a different mechanism, so the tests cannot fail for the behavior each title claims to pin.
groupFixture (lines ~57-60) computes r.approval.requestPolicySha256 over the full unsigned route, and docs/SUPPORT_CHECKER_UPGRADE.md states the route policy is hash-bound ("Any change requires current approval of the new policy hash"). Under that documented model, every case that mutates a route field then refuses via the approval-hash comparison alone, and the named check is never reached or distinguishable: route-scope-absent, route-scope-undefined, price-absent, price-undefined, price-nonfinite (unless the SDK canonicalizer serializes Infinity and null identically, which the in-file comment assumes but the suite does not verify), request-charge, over-budget, changed-price-hash, exact-endpoint-in-group, wrong-output-parameter, and unknown-route-model. Even under a narrower hash field set, over-budget/request-charge/changed-price-hash are also caught by the worst-case budget path (65536-token ceiling at >0.0153 USD/M vs the 1000-micros cap), so the hold still cannot be attributed.
The genuinely isolated cases in the same block are the approval-side ones (approval-scope-absent, approval-scope-undefined, expired-approval, future-approval, old-wire, logging-enabled — approval is excluded from the hash) and the qualification ones (qualification is not hash-bound); the isolated analogues for the route-side checks exist only for the allowlist (the direct-model test at lines ~370-400) and for budgets (the context-level full-system-*/lower-live-price-cap cases). The PR body's claim that "explicit/absent/undefined scope handling, price ... refusals" are covered is therefore weaker than it reads.
Proof gap: node_modules is absent, so the SDK's canonical hash field set cannot be read to confirm which cases are confounded. Fix is cheap and pattern-proven in this very file: recompute requestPolicySha256 after each mutation (as groupFixture does) so each case isolates its named rule, or assert the specific refusal via direct createSupportIndependentCheckModel construction as the allowlist test already does.
🟠 Issue 4 — Release-follow-up refusal of group routes is asserted in docs/PR but pinned by no host test
worker/src/support-paid-bootstrap.ts:428 · risk · identified by z-ai/glm-5.3-flash
If the published SDK 0.2.12 does not actually refuse provider-group routing for release-follow-up checks (or that refusal regresses), a release-follow-up profile deployed alongside a group checker route would run its release-follow-up checks against the openai/gpt-5.4 group route, max_price policy and shared counter without any purpose-specific approval for that purpose — and no test in this repository would fail.
The host code shares the group capability with that purpose unconditionally: releaseFollowup.production.checks is {...independentChecks, authority: ...} (worker/src/support-paid-bootstrap.ts:428), carrying checkerAllowed and the gpt-5.4 counter, and reads the same profile.checks.route. The release-follow-up validation block only validates the generator route (legacy allowed + mini counter); nothing host-side validates or holds the checks port for a group route. docs/SUPPORT_CHECKER_UPGRADE.md lines ~36-38 assert "the published SDK separately refuses provider groups for release-follow-up checks. That purpose remains held for a group route rather than inheriting a learning or engineering approval" — a security-relevant boundary claim.
Checked: grep over worker/src finds no test combining a group checker route with releaseFollowup; support-release-followup-production.test.ts and support-release-followup-paid-fixtures.ts only use the legacy route, and the new support-paid-checker-group.test.ts has no release-follow-up case at all. Proof gap: the SDK internals are unreadable here (node_modules absent), so I cannot confirm the refusal exists; that is exactly why the host-side pin is needed. A test that applies groupFixture-style mutations to supportFollowupPaidFixture and asserts the release-follow-up checks port refuses (while the generator stays legacy) would close the gap.
🔵 Issue 5 — *-undefined hold cases are byte-identical duplicates of the *-absent cases after the JSON round-trip
worker/src/support-paid-checker-group.test.ts:276 · nit · identified by z-ai/glm-5.3-flash
route-scope-undefined, approval-scope-undefined and price-undefined can never exercise a code path distinct from their *-absent twins in this harness: every fixture is persisted with save(f) → JSON.stringify(f.profile) and re-parsed by readSupportPaidProfile, and JSON.stringify drops undefined object properties. The serialized profile is therefore identical to the corresponding absent case, so the SDK observes the same bytes three times.
The in-file comment ("JSON has no undefined/non-finite representation: these become absent/null operator fields and must still hold at the normal root") acknowledges the collapse for the JSON normal root, yet the cases remain in the list, inflating the apparent negative coverage that the PR body reports as "explicit/absent/undefined scope handling". Genuine undefined-value handling can only be pinned on a non-serialized path, e.g. constructing the model directly with a Reflect.set(..., undefined) allowlist as the separate allowlist test at lines ~370-400 already does.
Checked: save at lines ~65-70 of the test file; readSupportPaidProfile in worker/src/support-paid-profile.ts parses the JSON string only.
🔵 Issue 6 — No hold case for a contradictory present scope value on the approval or route
worker/src/support-paid-checker-group.test.ts:252 · nit · identified by z-ai/glm-5.3-flash
The suite only exercises absent/undefined scope values, so a future SDK change that treats any truthy scope string as group consent would pass unnoticed. Concrete scenario: an approval carrying providerSelectionScope: 'exact_endpoint' beside a group route resolves the group route because the SDK checks scope presence rather than equality — the route would then run under an approval that never named the group scope. The reverse mismatch (route scope absent, approval scope 'provider_group') is likewise unpinned: a permissive regression could resolve the legacy mini route under a group-naming approval.
docs/SUPPORT_CHECKER_UPGRADE.md line ~21 states "Route, static checker allowlist and current Admin approval must independently select that scope", which implies equality, not mere presence; only absence/undefined on both sides is tested today.
Checked: the full it.each case list (lines ~251-272) and the switch body (lines ~274-348) contain no case setting a non-group truthy scope on either side; the direct-model allowlist test varies only absence/undefined on allowlist entries. Adding approval-scope-other (e.g. 'exact_endpoint') and route-scope-other hold cases with a recomputed policy hash would close it.
🔵 Issue 7 — Group route lacks the frozen approval-hash pin that the legacy route has
worker/src/support-paid-checker-group.test.ts:59 · nit · identified by z-ai/glm-5.3-flash
The legacy test pins the SDK-derived values absolutely — requestPolicySha256 === "36168760483e..." and the full request-body hash 423afcea198e... — so any change to the SDK's hash inputs or wire body for the legacy route fails loudly. The group path has no equivalent pin: groupFixture recomputes requestPolicySha256 via the SDK function at runtime, so a change to the SDK's group hash field set keeps every group test green.
Concrete failure scenario: a future SDK update drops providerMaxPrice from the route-policy hash. The price would no longer be approval-bound (the docs' "hash-bound providerMaxPrice" property, line ~21), and no group case would fail — the price-related hold cases are simultaneously absorbed by the hash/budget mechanisms (see the attribution finding), so nothing detects the lost binding.
Checked: the legacy pins exist at lines ~180-190 of the test file; the group fixture's recompute at lines ~57-60 is the only hash assertion for the group path, and it is self-referential (computed by the same SDK function it would need to police). Pinning the group fixture's requestPolicySha256 (and optionally the group request body hash) to a frozen constant would match the legacy coverage.
|
Fixed all seven initial configured findings in 9d727bf. For body-only r1-4, the new paired host-bootstrap test constructs the actual published createSupportReleaseFollowupChecks with a real Memory Store and valid current root key/profile/purpose evidence: legacy policy resolves ready, while the otherwise qualified GPT-5.4 group resolves unavailable. The generator stays mini, both paths use the root's shared checker selection, and application/release-evidence/provider-key/fetch sentinels remain untouched. This pins the producer purpose refusal directly rather than inferring it from a missing host worker. The other fixes defer optional loading, isolate route-policy refusals from stale hashes, replace JSON-identical undefined cases, cover contradictory scope values and freeze group policy/wire hashes. Current Node 22/24 worker types and 79 focused tests pass; fresh automatic configured OpenRouter and full CI remain required. |
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: issues
Scope: latest-commit (commit-range)
Mode: verify
Commit: 9d727bf28d1bcf8430f45bc897063505135f7824
Judge: openai/gpt-5.6-luna
Cost: $0.1891 (lanes $0.1889 + judge $0.0001)
Lanes
openai/gpt-6.1-sol: ok (0 finding(s), 46.0s, 140688+1717 tokens (105533 cached), 5 tool round(s), via Azure, $0.13)z-ai/glm-5.3-flash: ok (0 finding(s), 270.4s, 1209730+32146 tokens (1128192 cached), 22 tool round(s), via Modal, $0.0618)
Round 2 resolution
- ✅
r1-2fixed correctly — GPT-5.4 tokenizer tables are now eagerly loaded and initialized in the main worker bundle regardless of profile:support-paid-bootstrap.tsnow dynamically imports the optional counter only foropenai/gpt-5.4, retains the existing mini implementation for legacy profiles, and recheckscurrent()after awaiting selection. The optional module's import-time warm-up is removed. New module-load tests cover absent, malformed, unknown-model and legacy selections. Bundle-size and deployed CPU qualification remain… ⚠️ r1-3fixed incorrectly — Mostit.eachhold cases mutate hash-bound route fields, so the refusals cannot be attributed to the SDK checks their names claim: The serialized table cases now renew approval hashes after route mutations, correctly removing the stale-hash explanation for the scope, selector, parameter, request-charge and configured-cap cases.
However, the replacement nonfinite-price case at worker/src/support-paid-checker-group.test.ts:529 changes the hash-bound prompt price to Infinity while retaining the original approval hash. Thu…
- ✅
r1-4fixed correctly — Release-follow-up refusal of group routes is asserted in docs/PR but pinned by no host test: The new paired test constructs the publishedcreateSupportReleaseFollowupCheckswith actual host-bootstrap checker options, a Memory Store and current fictional purpose/key evidence. The legacy control resolvesready, while the otherwise qualified GPT-5.4 group resolvesunavailable. It also verifies the shared checker counter, unchanged mini generator selection, and untouched application, re… - 4 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is
risk). - Open findings after this round: 1 (0 bug-severity).
No structured findings from the successful lane(s).
There was a problem hiding this comment.
OpenRouter pull-request review
Verdict: clean
Scope: latest-commit (commit-range)
Mode: verify
Commit: 2cd6c87dd72b73c4bb68a8edfda223346336cb16
Judge: openai/gpt-5.6-luna
Cost: $0.0665 (lanes $0.0663 + judge $0.0001)
Lanes
openai/gpt-6.1-sol: ok (0 finding(s), 19.3s, 49751+742 tokens (32817 cached), 3 tool round(s), via Azure, $0.0583)z-ai/glm-5.3-flash: ok (0 finding(s), 135.8s, 205560+21558 tokens (190208 cached), 10 tool round(s), via Relace, $0.0080)
Round 3 resolution
- ✅
r1-3fixed correctly — Mostit.eachhold cases mutate hash-bound route fields, so the refusals cannot be attributed to the SDK checks their names claim: The current hold matrix recomputes approval hashes from normalized route bytes for every case except the intentional stale-price case. This removes stale hashes as the competing refusal for scope, request-charge, configured-cap, endpoint and output-parameter mutations.
Own undefined and nonfinite fields are now passed directly to the SDK without JSON serialization. For nonfinite-price, the la…
- Open findings after this round: 0 (0 bug-severity).
No structured findings from the successful lane(s).
An explicitly approved GPT-5.4 Azure checker profile was held by the normal paid bootstrap because its static allowlist and tokenizer supported only GPT-4.1-mini. Add the checker-only
openai/gpt-5.4/Azure/azure/max_completion_tokenstuple withprovider_groupscope and the actualgpt-tokenizer@4.1.2GPT-5.4 counter. The optional implementation loads only after GPT-5.4 selection; absent, malformed, unknown-model and legacy selections do not initialize it, and current bindings are rechecked after that await.The SDK requires matching route, static allowlist and current Admin approval, a hash-bound finite price policy, current qualification/privacy evidence and bounded full-message admission. Legacy checker hashes/wires and all generator/answer allowlists are unchanged. All host checker consumers share the selected checker capability; an actual paired SDK regression pins the existing release-follow-up group refusal. No live route, approval, credentials or feature flags are installed or enabled.
Validation: worker type checks and 79 focused non-Native tests across six files passed on Node 22.18.0 and 24.18.0, including 35 checker cases. Frozen legacy/group policy and request-body hashes, lazy-loading refusal, separately reapproved invalid routes, genuine nonserialized undefined/nonfinite fields, contradictory scope values, full system/user admission, expiry before physical calls and the SDK's follow-up purpose boundary are covered. Package/lock bytes and 2,058 installed members across ten selected public packages are unchanged.
The configured OpenRouter action and full GitHub CI run on this current head. Local Native D1, benchmarks, full suites and deployed CPU/provider quality remain separate qualification; no live provider call or customer activation was performed.