Skip to content

fix(types): preserve reasoning policy record shapes - #8811

Merged
diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.49from
backryun:chore/ts7-types-reasoning-policy
Jul 28, 2026
Merged

diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.49from
backryun:chore/ts7-types-reasoning-policy

Conversation

@backryun

Copy link
Copy Markdown
Contributor

Part of #8484. Two widened inference boundaries, three diagnostics, zero new.

Root cause

detectThinkingBudget() built a heterogeneous nested array without a contextual type, so each
destructured pair widened to string | JsonRecord. Separately,
attachReasoningRuleDirective() inferred its spread result as a closed { model: unknown }
object even though the function deliberately appends internal directive fields and returns a
JsonRecord.

This declares the existing contracts at those two boundaries:

  • budget-field pairs are [JsonRecord, string]
  • the directive-bearing body is a JsonRecord

Runtime values and routing behavior are unchanged.

Diagnostics

Measured independently against release/v3.8.49 at 0eeb8f45c:

  • TypeScript 6 open-sse diagnostics: 150 → 147
  • TypeScript 7.0.2 native diagnostics: 149 → 146
  • Full line-number-agnostic error-set diff: 3 fixed, 0 new

With #8809 and #8810 included, the cumulative projection is TS6 140 / TS7 139.

Validation

  • npm run typecheck:core
  • Reasoning routing unit, pipeline, and Codex WebSocket tests — 16/16 passed
  • ESLint on src/lib/reasoningRouting/policy.ts
  • npm run check:file-size
  • Prettier and git diff --check

No new runtime test was added because the values and branches are unchanged, while the existing
tests already cover budget-only intent, directive application, Chat Completions, Responses,
Anthropic Messages, combo filtering, connection rules, and the Codex WebSocket path.

@backryun
backryun marked this pull request as ready for review July 27, 2026 23:09
@backryun
backryun requested a review from diegosouzapw as a code owner July 27, 2026 23:09
@diegosouzapw
diegosouzapw merged commit 1b1e962 into cheaper-inference:release/v3.8.49 Jul 28, 2026
5 checks passed
@backryun
backryun deleted the chore/ts7-types-reasoning-policy branch July 28, 2026 02:14
@diegosouzapw diegosouzapw mentioned this pull request Jul 28, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
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.

2 participants