Skip to content

[1124] feat: openai-compatible-strict-reasoning (1/2) - #43

Closed
myk1yt wants to merge 17 commits into
mainfrom
pr/b05a-strict-reasoning-v2
Closed

[1124] feat: openai-compatible-strict-reasoning (1/2)#43
myk1yt wants to merge 17 commits into
mainfrom
pr/b05a-strict-reasoning-v2

Conversation

@myk1yt

@myk1yt myk1yt commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Stack Position

  • Feature Branch: feat/openai-compatible-strict-reasoning (1/2) + fix/mimo-parallel-tool-call-policy (shared 1/2 root)
  • Stage: 1/2
  • Depends on: None

Description

image

Full Feature Description

  • Feature Branch: feat/openai-compatible-strict-reasoning
  • Feature Name: OpenAI-Compatible Strict Reasoning and Provider Cost
  • Purpose: Resolves the problem where, despite differing levels of strict JSON schema and reasoning effort support across OpenAI-compatible endpoints, request control is scattered per provider, and cost is calculated as zero or inaccurately due to usage field differences. Enables users to explicitly opt in to strict tool schema and extended reasoning effort on supported endpoints, and normalizes response usage according to provider contracts to consistently display actual cost.
  • Full Change Description: B05a adds provider settings contracts, cached settings UI, strict schema opt-in, reasoning effort values, and base request shaping. B17 normalizes conditional fields, cached tokens, missing/zero values, and price lookup for OpenAI, OpenAI-compatible, Anthropic Vertex, and Qwen family usage. B05a is also shared as the foundation for the MiMo chain, but in this chain B17 is a sibling outcome that does not depend on B12.
  • Impact Scope: Affects provider-settings.ts, base-openai-compatible-provider.ts, base-provider.ts, OpenAICompatible.tsx, openai.ts, openai-compatible.ts, anthropic-vertex.ts, qwen-code.ts.
  • Errors and Edge Cases: Strict mode is opt-in and does not change existing schemas when disabled. Strict/reasoning fields are not sent to unsupported providers. MCP schemas are not aggressively hardened. The settings UI only modifies cachedState before saving. Cost calculation treats missing fields as unknown or zero per provider contract and does not produce negative tokens. Cached input/output tokens and provider-specific price units are not double-counted. B17 does not change request payload or tool-call policy.
  • Testing Method: Run B05a's settings serialization, schema conversion, opt-in/omitted-field, request fixture, and UI/locale tests, and B17's provider-specific usage/cost fixtures. Manually compare requests with strict toggle off vs. on, and feed fixed usage fixtures into OpenAI-compatible and non-OpenAI providers, comparing against documented calculation formulas and costs.

Why Split Into 17 PRs

Instead of submitting this feature as a single unified PR, it was split into individual PRs because as code size grows, safely reviewing a PR becomes very difficult. The feature was broken into mutually exclusive individual PRs so that each can be reviewed independently.

What This PR Specifically Changes

Adds provider-neutral strict schema opt-in, reasoning effort setting, cached settings UI, and OpenAI-compatible base request shaping. Does not include MiMo-specific enforcement or provider cost calculation.

Included Files

  • packages/types/src/provider-settings.ts
  • src/api/providers/base-openai-compatible-provider.ts
  • src/api/providers/base-provider.ts
  • src/api/providers/openai.ts
  • webview-ui/src/components/settings/providers/OpenAICompatible.tsx
  • Related locale and direct tests

Exclusion Scope

  • MiMo-specific capability/stream enforcement
  • Tool-call retention policy
  • Provider cost normalization changes
  • All items in the common removal rules

Summary by CodeRabbit

  • New Features
    • Added an optional strict tool-schema setting for OpenAI-compatible providers.
    • Strict mode improves schema validation while preserving MCP tool behavior.
    • The setting is saved per provider profile and defaults to disabled for compatibility.
    • Added localized descriptions across supported languages.
  • Bug Fixes
    • Requests without tools no longer include unnecessary parallel tool-call options.
    • Improved handling of incomplete or empty tool schemas.
    • Preserved configured reasoning behavior for supported O-series models.
  • Tests
    • Expanded coverage for strict and non-strict tools, profiles, and request behavior.

Upstream PR: Zoo-Code-Org#1124

Zoo (VP) and others added 17 commits August 2, 2026 10:02
…penAI Compatible provider

- Add openAiToolStrictMode boolean to provider settings (profile-scoped, default false)
- Add strict toggle checkbox in OpenAICompatible settings UI
- BaseProvider.convertToolsForOpenAI now accepts strictMode parameter
  - strictMode=true: strict:true + hardened schema
  - strictMode=false: strict:false + best-effort original schema
  - MCP tools: always strict:false regardless of setting
- Wire setting into all 4 openai.ts request paths
- Fix reasoning effort unsafe cast, add xhigh and max values
- Make parallel_tool_calls conditional on tools being present
Merge debris left strictToolSchemas/strictToolSchemasDescription twice
in the modelInfo object; JSON.parse silently kept the last occurrence.
Add scripts/find-dup-json-keys.js to detect duplicate sibling keys;
scan of all 18 locales shows en was the only affected file.
openAiToolStrictMode is honored by all OpenAI-protocol providers in a
profile, but the checkbox only exists under the OpenAI Compatible
section. Extend strictToolSchemasDescription to state the setting is
saved per profile and applies to other OpenAI-protocol providers.
Non-en locales hold untranslated English text for this key, so they
get the clarification appended as an English parenthetical.
…g PR Zoo-Code-Org#1124

- Add strict-reasoning.json aimock fixture with 6 probe tag mappings
  (fixes 30s e2e-mock timeout caused by 404 No fixture matched)
- Add Playwright CT visual test for strict tool schemas toggle in
  OpenAICompatible settings panel
Replace Windows-generated baseline with Linux CI artifact actual
screenshot to fix cross-platform rendering mismatch (5,456px diff).
- Add 5 tests to base-openai-compatible-provider.spec.ts for
  parallel_tool_calls and openAiToolStrictMode pass-through
- Add 2 tests to openai-compatible.spec.ts for strict mode fallback
  and enabled state (new file)
- Targets codecov/patch 76.47% -> 80%+ for PR Zoo-Code-Org#1124
Covers the 3 uncovered lines in OpenAICompatible.visual.fixture.tsx
that were blocking codecov/patch/webview-patch (25% -> 70%+).
@myk1yt myk1yt closed this Aug 12, 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.

1 participant