[Feat] Add custom request fields for OpenAI-compatible providers - #1350
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
97e9415 to
5bf75a2
Compare
Review processThis PR was opened by an automated account. A human maintainer must verify the change intent, provenance, and validation before merging.
Current step: The required review sequence passed. Remaining merge requirements apply. |
9b78833 to
2423f86
Compare
6b437a1 to
a865df1
Compare
|
@CodeRabbit review |
✅ Action performedReview finished.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: ⛔ Files ignored due to path filters (5)
📒 Files selected for processing (33)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📜 Recent review details🧰 Additional context used📓 Path-based instructions (10)Treat model, provider, MCP, path, command, and tool data as untrusted.⚙️ CodeRabbit configuration file Files:
For persisted settings, verify the complete schema/storage/runtime/webview round trip, shared default semantics, and focused true plus false/unset tests.⚙️ CodeRabbit configuration file Files:
Require regression coverage at the lowest valid harness with behavior-focused assertions, including relevant negative, error, false/unset, and boundary cases.⚙️ CodeRabbit configuration file Files:
Check strict typing and exhaustive behavior across normal, boundary, error, cancellation, retry, and compatibility paths.⚙️ CodeRabbit configuration file Files:
Check React state and effect dependencies, cleanup, accessibility, i18n, and light/dark theme behavior.⚙️ CodeRabbit configuration file Files:
Verify extension/webview contracts, cancellation and error propagation, VS Code lifecycle correctness, and behavior under retries and partial failure.⚙️ CodeRabbit configuration file Files:
Act as an adversarial second-opinion reviewer.⚙️ CodeRabbit configuration file Files:
Add focused tests for UI binding and save behavior, persistence or normalization, and the value returned by `getStateToPostToWebview()`, including true and false/unset cases when defaults could hide omissions.📄 CodeRabbit inference engine (AGENTS.md) Files:
Fix lint violations in new TypeScript code instead of suppressing them.📄 CodeRabbit inference engine (AGENTS.md) Files:
After editing a file, run ESLint with pruning and zero warnings for that relative file, and confirm its suppression count did not increase.📄 CodeRabbit inference engine (AGENTS.md) Files:
🔇 Additional comments (17)
📝 SummarySummary by CodeRabbit
WalkthroughAdds an optional ChangesOpenAI-compatible extra request body
Estimated code review effort: 3 (Moderate) | ~30 minutes Merge Risk: ⚪ Minimal · up to The extra request-body setting is validated, persisted for applicable profiles, and merged across supported request paths without an unresolved material issue. Sequence Diagram(s)sequenceDiagram
participant ProviderSettings
participant OpenAiHandler
participant OpenAIAPI
ProviderSettings->>OpenAiHandler: provide openAiExtraBody
OpenAiHandler->>OpenAiHandler: merge extra fields with request options
OpenAiHandler->>OpenAIAPI: submit request with request-owned fields preserved
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (5 passed)
Full details: Description checkExplanation The description clearly explains the feature, motivation, implementation scope, validation behavior, request integration, testing coverage, and linked issue. It does not use the repository template headings or provide explicit reproducible test steps and checklist selections, but the content is sufficiently complete. Full details: Linked Issues checkExplanation The implementation satisfies the primary requirements in [ Full details: Out of Scope Changes checkExplanation The changes remain focused on the linked feature. Type definitions, request handling, configuration persistence, UI validation, localization, tests, and visual coverage all support the Extra Body capability. Full details: Docstring CoverageExplanation Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 15 files. (18 skipped: 18 unsupported.) Full details: Regression EvidenceExplanation The new Extra Body validation call in Resolution Add a focused test in Full details: Trust And Persistence InvariantsExplanation No explicit trust or persistence failure is introduced.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 ESLint
packages/types/src/__tests__/provider-settings.test.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. packages/types/src/provider-settings.tsESLint skipped: the matched ESLint configuration already failed (missing-dependency). packages/types/src/provider-settings/index.tsESLint skipped: the matched ESLint configuration already failed (missing-dependency).
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What changed
OpenAI-compatible provider profiles now include a localized Extra Body JSON editor for provider-specific request fields. Zoo Code validates the JSON, rejects runtime-managed and prototype-sensitive keys, persists it only for OpenAI-compatible profiles, and merges safe fields into streaming, non-streaming, O-family, and single-completion requests.
The settings control uses VS Code-themed components, accessible validation feedback, translations for every supported locale, and unclipped full-height visual baselines for dark, light, high-contrast, and high-contrast-light themes. The visual tests apply each theme after the shared gallery mount so every baseline exercises its intended VS Code theme.
Focused assertions cover the Extra Body copy, placeholder, ARIA relationships, reserved-key formatting, and non-OpenAI bypass.
Why this change was made
Providers such as Sail Research require request-body metadata to select features such as the
balancedcompletion window. Custom headers cannot express those fields, so users previously needed a proxy. This closes #1104.Impact
Users can configure provider-specific fields such as
{ "metadata": { "completion_window": "balanced" } }directly in an OpenAI-compatible profile without allowing custom JSON to override Zoo Code's model, messages, tools, streaming, reasoning, temperature, or token limits.Related PRs