You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(catalog): preserve context inference through provider edits - #7077
Follow-up to #7024: preserve inferContextWindow through the provider management API.
Include the optional value in GET /api/providers; accept boolean PATCH values and null to clear it. Reject invalid types before applying sibling changes.
Preserve the latest live value when a same-name POST omits the field, including a concurrent PATCH while destination validation is awaiting. Explicit submitted values still win.
Add eight focused route regressions and document the API contract. The default-off inference policy, built-in provider behavior, and existing context caps are unchanged. No GUI changes.
Verification
Based on merged dev aca5ccfcc209a3b64075336987247db0a20c5615.
Red baseline on the pre-fix implementation: PATCH rejected the field; same-name POST lost both existing true and false values.
Bun 1.4.3, guarded focused run: management-provider-context-inference, vendor-context, and responses-compaction-http-isolation: 27 passed, 0 failed, 549 assertions.
bun run typecheck, bun run structure:check, bun run privacy:scan, and git diff --check: passed.
bun test tests/test-layout.test.ts tests/test-layout-tooling.test.ts tests/ci-workflows/file-size-ratchet.test.ts: 28 passed, 0 failed.
The focused run used temporary homes, fail-closed network/subprocess guards, and a synthetic unavailable-Codex-runtime stub for the catalog fixture. API tests exercise the real schema and config loader with an injected fixture writer, rather than the full production save/migration path.
Full-suite exception: the broader import-connected graph contains other provider/auth fixtures with potential real external requests; earlier broad execution was stopped by safety review, so it was not safely runnable in this cloud environment. This is not a demonstrated regression in this PR. The eight focused API regressions cover the changed GET/PATCH/POST behavior, strict input rejection, omitted/explicit values, and concurrent PATCH preservation; the production save/migration path remains outside this fixture coverage. Required exact-head CI still needs maintainer execution authorization before merge; results from feat(catalog): infer custom-provider context windows from model metadata #7024 are not validation of this follow-up.
Independent source review of this narrow fix found no blocking issue. This is technical review, not maintainer approval. At the readiness check, the branch was 10 commits behind dev 2acdb925229f8812cc9db24bfb1b114bfed35ff2, within the repository's limit.
Checklist
Scope stays focused and avoids unrelated cleanup.
Docs or release notes were updated when needed.
Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
New Features
Provider management responses now include the configured context-window inference setting.
You can set or clear the setting with a PATCH request. When saving a provider with the same name, omitting the setting preserves its latest value; an explicitly submitted boolean takes precedence.
Documentation
Updated provider configuration and management API references with the setting’s behavior, including its default-off, custom-provider-only availability.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
The provider management API now exposes inferContextWindow in reads, accepts boolean or null PATCH updates, and preserves the latest value during same-name POST saves when the request omits it.
GET exposes the configured value. PATCH sets it with a boolean, clears it with null, and rejects other types. Tests cover persistence, catalog-cache invalidation, and rejected updates.
Same-name POST preservation src/server/management/provider-routes.ts:1369-1374, tests/server/management-provider-context-inference.test.ts:125-179, docs-site/src/content/docs/reference/configuration/providers.md:423-426, docs-site/src/content/docs/reference/management-api.md:650-655, structure/catalog-vendor-context.md:14-16, structure/gui-and-management-api.md:278
When POST omits the field, the route preserves its latest live value, including changes made during destination validation. An explicitly submitted value takes precedence. Tests cover stored values, validation, and concurrent PATCH updates. The documentation also describes the preserveResponsesReasoningContent form setting.
sequenceDiagram
participant Client
participant ProviderManagementAPI
participant DestinationValidator
participant LiveProviderConfig
Client->>ProviderManagementAPI: POST provider without inferContextWindow
ProviderManagementAPI->>DestinationValidator: Validate destination
Client->>ProviderManagementAPI: PATCH inferContextWindow during validation
ProviderManagementAPI->>LiveProviderConfig: Apply boolean or clear field
DestinationValidator-->>ProviderManagementAPI: Validation completes
ProviderManagementAPI->>LiveProviderConfig: Read latest inferContextWindow
ProviderManagementAPI-->>Client: Save candidate with latest value
Loading
Merge Risk:⚪ Minimal · up to c6675
This change keeps the context-inference setting intact when providers are edited through the management API. No merge-blocking risk was identified in the supplied material.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (6 skipped: 6…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely describes the main change: preserving context inference through provider edits. It matches the provider API behavior and documented objective.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (6 skipped: 6 unsupported.)
Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
all PR quality gates passed; the review readiness checklist is complete.
Review readiness checklist
✅ Required local validation passed; commands, results, and any full-suite exception are documented.
✅ I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
✅ I resolved all correct Codex and CodeRabbit findings.
✅ My PR is ready for review.
✅ 4/4 boxes ticked.
This pull request is already Ready for Review.
The review-ready label marks this PR as ready; review automation runs independently.
Maintainers: @lidge-jun@Ingwannu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #7024: preserve
inferContextWindowthrough the provider management API.GET /api/providers; accept boolean PATCH values andnullto clear it. Reject invalid types before applying sibling changes.Verification
Based on merged dev
aca5ccfcc209a3b64075336987247db0a20c5615.bun run typecheck,bun run structure:check,bun run privacy:scan, andgit diff --check: passed.bun test tests/test-layout.test.ts tests/test-layout-tooling.test.ts tests/ci-workflows/file-size-ratchet.test.ts: 28 passed, 0 failed.2acdb925229f8812cc9db24bfb1b114bfed35ff2, within the repository's limit.Checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit