Skip to content

feat(ai): add explicit provider-group routing (0.2.12 candidate) - #65

Merged
FlyOverCoderKY merged 2 commits into
mainfrom
claude/support-provider-group-20261113
Nov 14, 2026
Merged

FlyOverCoderKY merged 2 commits into
mainfrom
claude/support-provider-group-20261113

Conversation

@FlyOverCoderKY

@FlyOverCoderKY FlyOverCoderKY commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

OpenRouter base-provider selectors can cover multiple eligible endpoints and regions. Independent learning and engineering checks can now opt into provider-group mode when the route, captured allowlist and approval all select it, and the approved route hash binds finite price filters. Absent fields preserve existing selector refusals, route hashes and request bytes; present undefined fields remain invalid policy.

Group requests serialize documented USD-per-million max_price filters with a zero per-request-charge ceiling, validate their worst-case token charge using exact decimal arithmetic, and retain separate total-budget and native-accounting guards. The SD05 checker refuses group mode before funding; other purpose models retain existing behavior. Host metadata/privacy review and actual provider qualification remain required. All five packages are prepared as the unpublished synchronized 0.2.12 candidate.

Validation: current-head CI passed formatting, types, all 4,258 tests across 97 files, both synthetic examples, release metadata checks and canonical pack/clean-tarball consumers on Node 22 and 24. Both actual local Nodes passed the focused 191-case suite (including 72 provider-group cases) and canonical consumers; five archives are byte-identical across Nodes (339 packed files). Includes public-subpath type coverage and legacy hash/wire assertions. Configured OpenRouter review is clean and CodeQL passed. No live provider calls or host activation.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-11-14T03:02:34.817750Z 298e86f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

OpenRouter review posted (clean). #65 (review)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenRouter pull-request review

Verdict: issues
Scope: full-pr (full-pr)
Mode: initial
Commit: 298e86f0b7a5ea7fba06838cd70794df987f968f
Judge: openai/gpt-5.6-luna
Cost: $0.3025 (lanes $0.3007 + judge $0.0018)

Lanes

  • openai/gpt-6.1-sol: ok (0 finding(s), 80.5s, 310698+2769 tokens (253864 cached), 7 tool round(s), via Azure, $0.21)
  • z-ai/glm-5.3-flash: ok (3 finding(s), 335.1s, 1647081+50602 tokens (1420160 cached), 27 tool round(s), via Reka, $0.0861)

Findings

🔵 Issue 1 — Captured-policy comment contradicts the new allowProviderGroup default

packages/ai/src/openrouter/support-independent-checks-model.ts:511 · nit · identified by z-ai/glm-5.3-flash

A reviewer auditing the SD05 isolation reads the comment "Only the SD05 wrapper opts in. Capture the policy rather than trusting a mutable caller object..." and can conclude both captured flags default to opt-in. The line directly below it, const allowProviderGroup = attemptPolicy?.allowProviderGroup !== false;, has the opposite default: every caller that omits attemptPolicy (including createSupportIndependentChecks at packages/ai/src/openrouter/support-independent-checks.ts:395) gets group serialization enabled at the attempt/protocol layer, and only the SD05 wrapper opts out (support-release-followup-checks.ts:299).

The comment predates the group flag and describes only allowApprovalRenewal, but it now sits over two lines with opposite default semantics, so a future maintainer assessing "which layer defaults to enabled" for provider groups can misjudge it. The real opt-in gate is route + allowlist + approval (plus protocol.allowProviderGroup === true in the transport), which is why this is only a comment-accuracy issue, not a behavior bug.

Checked: createSupportIndependentCheckModel callers (grep), createSupportOpenRouterModel callers (only the independent-check model and one test), and the three-way opt-in enforcement in read() and selectedProviderMaxPrice — behavior is sound; only the comment is misleading.

🔵 Issue 2 — Explicit-undefined group fields are treated as group intent, contradicting the documented "omit" path

packages/ai/src/openrouter/provider-selection.ts:78 · nit · identified by z-ai/glm-5.3-flash

A host that builds routes with conditional spread, e.g. { ...base, providerSelectionScope: group ? "provider_group" : undefined, providerMaxPrice: group ? price : undefined }, expects the documented legacy behavior: packages/ai/README.md and docs/RELEASE_NOTES.md say "Omitting the new fields preserves the existing exact mode, selector refusals, request bodies and hashes". Instead, Object.hasOwn(route, "providerSelectionScope") / Object.hasOwn(route, "providerMaxPrice") treat a present-but-undefined key as group intent, so selectedProviderMaxPrice throws "Provider-group policy unavailable" and the route is refused everywhere (resolve returns null, transport maps to route_unavailable) with no indication that the explicit undefined keys caused it — a diagnosability cost during host migration.

The refusal direction is conservative (never an unsafe dispatch), and the new tests deliberately use Reflect.deleteProperty for the "missing cap" case, so this looks intentional; but the public docs' "omitting" wording doesn't cover the explicit-undefined authoring pattern, and the TS types explicitly permit | undefined on these fields.

Proof gap: I could not execute code or inspect node_modules/zod (absent from the checkout), so whether zod 4.6.7's object parse drops explicit-undefined keys before Object.hasOwn sees them is unverified; if zod drops them, the legacy path behaves as documented and only raw (unparsed) routes are affected. Either way the doc wording and the runtime semantics disagree for at least one input form.

🔵 Issue 3 — New export-subpath test's runtime assertions are tautologies

tests/openrouter-export.test.ts:36 · nit · identified by z-ai/glm-5.3-flash

The new test "types an explicit provider-group policy through the public subpath" asserts expect(route.providerSelectionScope).toBe(approval.providerSelectionScope) and expect(allowlist[0]!.providerSelectionScope).toBe("provider_group") — both compare literals that the test itself just assigned, so they can never fail regardless of any change to the group policy (e.g., deleting the allowlist scope check in read() or the approval check in selectedProviderMaxPrice would still pass). Its only real content is compile-time type acceptance of the new fields via the public subpath and expect(root).not.toHaveProperty("providerMaxPrice").

The test name says it pins typing, which it does, but the tautological runtime expects create the appearance of behavioral coverage that actually lives in tests/openrouter-provider-groups.test.ts. An assertion-only rewrite (e.g., expectTypeOf) or dropping the trivial expects would make the intent honest.

Checked: the behavioral three-way opt-in, price gating, and wire serialization are covered by the new groups test file, so nothing is uncovered — this is purely about the misleading strength of these two assertions.

Workflow run

Comment thread tests/openrouter-export.test.ts Resolved

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenRouter pull-request review

Verdict: clean
Scope: latest-commit (commit-range)
Mode: verify
Commit: 4c01593f0672937bc70112a37398149a7d7f1e66
Judge: openai/gpt-5.6-luna
Cost: $0.1206 (lanes $0.1205 + judge $0.0001)

Lanes

  • openai/gpt-6.1-sol: ok (0 finding(s), 14.0s, 38342+461 tokens (23276 cached), 3 tool round(s), via Azure, $0.0491)
  • z-ai/glm-5.3-flash: ok (0 finding(s), 390.8s, 1118481+51322 tokens (1022720 cached), 21 tool round(s), via Friendli, $0.0714)

Round 2 resolution

  • 3 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is risk).
  • Open findings after this round: 0 (0 bug-severity).

No structured findings from the successful lane(s).

Workflow run

@FlyOverCoderKY
FlyOverCoderKY merged commit b41b301 into main Nov 14, 2026
5 checks passed
@FlyOverCoderKY
FlyOverCoderKY deleted the claude/support-provider-group-20261113 branch November 14, 2026 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant