Repository navigation
fix: preserve requested output limits for custom models - #146479
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 5:27 PM ET / 21:27 UTC. ClawSweeper reviewWhat this changesPreserves explicit Anthropic and Mistral output-token limits when custom-model metadata omits its ceiling, with regression coverage and documentation. Merge readiness✅ Ready for maintainer review The repair remains necessary on fetched main and the latest release. The introduced changes preserve existing known-limit behavior, and no actionable correctness or security defect was found. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s provider adapters translate model metadata and request options into provider API requests. Their output-limit calculation controls the response budget and Anthropic’s manual-thinking budget. flowchart LR
A[Model metadata] --> C[Resolve output limit]
B[Requested output limit] --> C
C --> D[Anthropic thinking budget]
C --> E[Mistral request]
D --> F[Anthropic request]
E --> G[Provider response]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource 0, Tests +57, Docs +2. Total +59 across 7 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep output-limit normalization in the existing shared helper and fit Anthropic manual thinking within the available model or explicit request capacity. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the trigger: an explicit output limit and an undefined model ceiling reach Math.min and produce NaN on current main. Execution was not repeated in this read-only review. Is this the best way to solve the issue? Yes, the patch repairs the existing calculation without adding another policy owner, configuration option, or migration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9b59fe4ef7da. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Fixes: custom Anthropic and Mistral requests can fail with invalid output-token limits when model metadata omits its maximum output size.
User Impact
User impact: an explicitly requested output limit works even when the model's output ceiling is unknown. Known ceilings still apply, and omitted limits retain their existing behavior.
Why This Change Was Made
Preserve the explicit request limit when there is no model ceiling to clamp against, including Anthropic manual-thinking requests.
Evidence
Five regression cases failed before repair; all 150 tests in the affected provider and shared-option suites pass afterward. Authenticated Anthropic requests passed with both known and omitted model ceilings, retaining the explicit 360-token request limit. Independent review found no actionable issues. The original defect also caused an authenticated Anthropic exec reviewer to return HTTP 400 for an invalid max_tokens value.