GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(models): keep per-provider context caps independent by iF2007 · Pull Request #1224 · lidge-jun/opencodex Conversation
|
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request is already Ready for Review. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
✅ Deterministic PR hygiene checks passed. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe PR adds independent provider context-cap values and optional global propagation. The management API, GUI, CLI, tests, and localized documentation now support this behavior. ChangesProvider context-cap management
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Operator
participant ModelsPage
participant ProviderRoutes
participant ContextCap
Operator->>ModelsPage: Select provider cap or global cap
ModelsPage->>ProviderRoutes: Submit validated update
ProviderRoutes->>ContextCap: Apply provider value or setAll
ContextCap-->>ProviderRoutes: Update cap configuration
ProviderRoutes-->>ModelsPage: Return updated provider catalog
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
gui/src/pages/Models.tsx (1)
420-425: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winSend the next provider-cap state.
Line 420 sets
enabledto the current cap state. The request at Line 425 then re-applies the current state.When the cap is off, clicking the switch sends
enabled: false. When the cap is on, clicking the switch sendsenabled: true. The switch cannot enable or disable a provider cap.Proposed fix
- const enabled = contextCaps[provider] !== undefined; + const enabled = contextCaps[provider] === undefined;As per path instructions, GUI state must stay consistent with management API responses.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@gui/src/pages/Models.tsx` around lines 420 - 425, Update the provider-cap toggle logic around the enabled state and the PUT request so it sends the next state, not the current state: invert whether contextCaps[provider] is defined before serializing enabled. Keep the UI state synchronized with the management API response by applying the returned provider-cap state after a successful request.Source: Path instructions
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/server/management/provider-routes.ts`:
- Around line 615-635: Validate optional provider context-cap fields before any
configuration mutation: in the provider-specific branch, reject a supplied value
unless it is a finite positive number, returning 400 instead of converting it to
undefined; in the global-cap branch, reject a supplied setAll unless it is
boolean, while preserving omitted-field behavior. Apply these checks before
setProviderContextCap, setGlobalContextCapValue, save, or related
reconciliation, using the existing request handler flow.
---
Outside diff comments:
In `@gui/src/pages/Models.tsx`:
- Around line 420-425: Update the provider-cap toggle logic around the enabled
state and the PUT request so it sends the next state, not the current state:
invert whether contextCaps[provider] is defined before serializing enabled. Keep
the UI state synchronized with the management API response by applying the
returned provider-cap state after a successful request.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: aa346184-6a7d-4847-b4be-9b9e0098beb5
docs-site/src/content/docs/guides/model-routing.mddocs-site/src/content/docs/ja/reference/configuration/providers.mddocs-site/src/content/docs/reference/configuration/providers.mddocs-site/src/content/docs/ru/guides/model-routing.mddocs-site/src/content/docs/ru/reference/configuration/providers.mddocs-site/src/content/docs/zh-cn/guides/model-routing.mddocs-site/src/content/docs/zh-cn/reference/configuration/providers.mdgui/src/pages/Models.tsxsrc/providers/context-cap.tssrc/server/management/provider-routes.tstests/management-provider-validation.test.ts
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: c8c3fdce06
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
SummaryAll review findings have been addressed in commit Fixes
Verification
All four review comment threads are resolved. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
gui/src/pages/Models.tsx (1)
491-505: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftKeep the bulk-cap target set consistent with the GUI.
allCappedonly considers non-native routed groups with rows. The bulk actions send{ setAll: ... }, butsrc/server/management/provider-routes.tsLines 655-657 passes every configured provider tosetAllProviderContextCaps.src/providers/context-cap.tsLines 63-73 then writes an entry for every supplied name.This includes disabled providers and providers that the Models page excludes as native or non-routed. The toggle can persist caps that the GUI cannot display or manage.
Use one shared eligible-provider predicate for the GUI and server bulk path. At minimum, exclude disabled providers and non-routed providers. Add a regression test with disabled and native providers.
Suggested server-side target selection
- const names = Object.keys(config.providers); + const names = eligibleRoutedProviderNames(config);Based on the PR objectives, the toggle must apply only to enabled routed providers. As per path instructions, keep GUI state consistent with management API responses and shared routing/config layers.
Also applies to: 542-542
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@gui/src/pages/Models.tsx` around lines 491 - 505, Align the bulk-cap target selection used by Models.tsx allCapped and provider-routes.ts setAllProviderContextCaps through one shared eligibility predicate. The predicate must include only enabled, routed, non-native providers so setAll cannot persist caps for providers the GUI excludes; keep GUI state and management API responses consistent. Add regression coverage including disabled, native, and non-routed providers.Source: Path instructions
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/server/management/provider-routes.ts`:
- Around line 615-619: Update the validation preceding Branch 1 in the handler
to reject malformed or mixed payloads before branch selection: require provider
and enabled to be present together with their expected types, reject any payload
containing provider fields with setAll, and return 400 without modifying
configuration. Ensure numeric value validation remains intact, and add
regression tests covering invalid enabled with provider and setAll combined with
provider fields, verifying unchanged configuration.
---
Outside diff comments:
In `@gui/src/pages/Models.tsx`:
- Around line 491-505: Align the bulk-cap target selection used by Models.tsx
allCapped and provider-routes.ts setAllProviderContextCaps through one shared
eligibility predicate. The predicate must include only enabled, routed,
non-native providers so setAll cannot persist caps for providers the GUI
excludes; keep GUI state and management API responses consistent. Add regression
coverage including disabled, native, and non-routed providers.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 217e85a8-7da8-4882-bed4-494442586029
docs-site/src/content/docs/ko/reference/configuration/providers.mdgui/src/pages/Models.tsxsrc/server/management/provider-routes.tstests/management-provider-validation.test.ts
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Follow-up review round summaryA new CodeRabbit finding (Major — "Reject malformed and mixed payloads before branch selection") arrived after the first round and has been fixed in commit FixPayload validation now happens before branch selection (
Regression testsBoth cases are covered in Verification
All review comment threads (first round + this one) are resolved. The PR head is at |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: 3bd8b0828e
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
a26bace to
2245a43
Compare
There was an error while loading. Please reload this page.
|
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/server/management/provider-routes.ts`:
- Line 606: In the PUT provider context-cap validation flow, validate the parsed
body with isPlainRecord before accessing provider, enabled, value, or setAll.
Reject any non-object payload, such as {"provider": true}, with the route’s
consistent 400 response, then compute hasProviderFields and continue existing
validation for plain-record bodies.
- Around line 628-632: Normalize body.value with Math.floor before validation in
the provider-context-caps PUT handler, reject undefined or values whose
normalized result is less than 1, and reuse that normalized value for both
per-provider and global cap setters. Add a regression test covering value 0.5
that preserves the previous cap without mutating configuration.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 88daedcf-c8ca-4424-9100-405be4cfadbc
devlog/_plan/260808_context_cap_per_provider/evidence/01-models-context-caps.png is excluded by !**/*.pngsrc/server/management/provider-routes.tstests/management-provider-validation.test.ts
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.