Skip to content

fix(chutes): report accurate context windows for sparse catalog rows - #119196

Merged
steipete merged 1 commit into
openclaw:mainfrom
mushuiyu886:fix/chutes-max-model-len-context
Aug 5, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
mushuiyu886:fix/chutes-max-model-len-context

Conversation

@mushuiyu886

Copy link
Copy Markdown
Contributor

Related: #118868

What Problem This Solves

Fixes an issue where Chutes users could have models registered with a smaller context window when a live catalog row omitted context_length but provided a valid max_model_len. The current public catalog exposes two such models with max_model_len=131072, while OpenClaw registered both with the generic 128000 fallback.

Why This Change Was Made

The Chutes-owned live catalog projection now selects the first valid value in this order: context_length, max_model_len, then the existing 128000 default. Keeping context_length first preserves the provider's explicit product-level limit when both fields are present, while max_model_len supplies the serving limit only when that primary field is unavailable or invalid.

User Impact

Chutes model discovery now preserves the provider's available context capacity for sparse catalog entries. Existing rows with context_length keep their current behavior, and malformed or non-positive metadata still falls back safely.

Evidence

  • Regression-first proof: the new precedence test failed before the production change because the missing/invalid context_length cases registered 128000 instead of 131072.
  • node scripts/run-vitest.mjs extensions/chutes/models.test.ts — 14 tests passed.
  • All four Chutes test files through scripts/run-vitest.mjs — 27 tests passed.
  • node scripts/run-tsgo.mjs -p extensions/chutes/tsconfig.json --noEmit — passed.
  • oxfmt --check, targeted oxlint, and git diff --check — passed.
  • Chutes documents max_model_len as the maximum sequence length, and its catalog aggregation preserves the instance value by excluding it from metadata overrides.
  • Production LOC: +5/-1; tests: +35/-0. The production growth declares and consumes one provider-published contract field at its owning projection boundary.

Exact-head live proof (704192488b3cffd1e2b64c2d39129ef3c756e239), using the public https://llm.chutes.ai/v1/models response and the production discoverChutesModels() path:

BEFORE
unsloth/Mistral-Nemo-Instruct-2407-TEE: context_length=null, max_model_len=131072, registered=128000
Nemotron-3-Nano-Omni-30B-TEE: context_length=null, max_model_len=131072, registered=128000
allServingLimitsPreserved=false

AFTER
unsloth/Mistral-Nemo-Instruct-2407-TEE: context_length=null, max_model_len=131072, registered=131072
Nemotron-3-Nano-Omni-30B-TEE: context_length=null, max_model_len=131072, registered=131072
allServingLimitsPreserved=true

CONTROL
google/gemma-4-31B-turbo-TEE: context_length=131072, max_model_len=262144, registered=131072
contextLengthPriorityPreserved=true

@mushuiyu886
mushuiyu886 marked this pull request as ready for review August 4, 2026 11:28
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 7:41 AM ET / 11:41 UTC.

ClawSweeper review

What this changes

The PR makes Chutes model discovery use a valid serving max_model_len after context_length and before the existing 128000-token fallback.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

This is a necessary, narrow Chutes catalog fix with no actionable defect found. Current main ignores valid max_model_len when context_length is absent or invalid; the branch corrects that provider-owned projection and preserves the existing default.

Priority: P2
Reviewed head: 704192488b3cffd1e2b64c2d39129ef3c756e239

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong exact-head behavioral evidence, focused coverage, and a provider-local implementation support a clean maintainer review.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides exact-head before/after public-catalog output through the production discovery path and shows the unchanged primary-field control.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides exact-head before/after public-catalog output through the production discovery path and shows the unchanged primary-field control.
Evidence reviewed 7 items Current-main defect: Current main projects a context window from context_length only, then falls back to 128000, so a sparse row with a valid serving limit cannot retain that limit.
Owner-boundary repair: The PR adds the field at the Chutes catalog-row boundary and selects the first valid context_length, max_model_len, then default value; the shared runtime invokes this projector before returning discovered rows.
Load-bearing regression coverage: The exact-head test covers primary precedence, missing and invalid primary values using the serving limit, and an all-invalid default control through discoverChutesModels().
Findings None None.
Security None None.

How this fits together

The Chutes provider plugin fetches its vendor model catalog and projects each row into OpenClaw model metadata. That metadata supplies the context window used by the authenticated provider catalog for agent model selection and budgeting.

flowchart LR
  Auth[Authenticated Chutes profile] --> Catalog[Chutes model catalog]
  Catalog --> Projection[Chutes row projection]
  Projection --> Choice{Valid context limit}
  Choice --> Window[Registered context window]
  Window --> Provider[Chutes provider catalog]
  Provider --> Agents[Agent model selection]
Loading

Before merge

  • Complete next step (P2) - No repair lane is needed because the submitted branch already contains the narrow, source-backed fix and regression coverage.
Agent review details

Security

None.

PR surface

Source +4, Tests +35. Total +39 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 1 +4
Tests 1 35 0 +35
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 40 1 +39

Review metrics

Metric Value Why it matters
Production vs test LOC production +5/-1; tests +35/-0 The small production increase declares and consumes one vendor-published catalog field at the owning projection boundary, with focused precedence coverage.

Technical review

Best possible solution:

Keep the provider-local precedence chain and land it after required GitHub checks complete for the exact head.

Do we have a high-confidence way to reproduce the issue?

Yes. Current main's fallback expression source-proves the sparse-row failure, and the PR supplies exact-head public-catalog output through the production discovery path.

Is this the best way to solve the issue?

Yes. The Chutes projector owns this vendor-specific field shape; shared runtime already delegates projection there, and sibling providers use equivalent positive-value precedence rather than a core workaround.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2a3a840aaf80.

Labels

Label justifications:

  • P2: Incorrect context metadata affects Chutes model discovery and agent budgeting, but the repair is bounded to one provider catalog projection.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides exact-head before/after public-catalog output through the production discovery path and shows the unchanged primary-field control.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head before/after public-catalog output through the production discovery path and shows the unchanged primary-field control.

Evidence

What I checked:

  • Current-main defect: Current main projects a context window from context_length only, then falls back to 128000, so a sparse row with a valid serving limit cannot retain that limit. (extensions/chutes/models.ts:96, 2a3a840aaf80)
  • Owner-boundary repair: The PR adds the field at the Chutes catalog-row boundary and selects the first valid context_length, max_model_len, then default value; the shared runtime invokes this projector before returning discovered rows. (extensions/chutes/models.ts:97, 704192488b3c)
  • Load-bearing regression coverage: The exact-head test covers primary precedence, missing and invalid primary values using the serving limit, and an all-invalid default control through discoverChutesModels(). (extensions/chutes/models.test.ts:241, 704192488b3c)
  • Validation contract: Both fields use the shared positive-safe-integer guard, which rejects strings, fractions, non-finite values, zero, and negatives. (packages/normalization-core/src/number-coercion.ts:98, 2a3a840aaf80)
  • Current implementation provenance: Blame attributes the existing Chutes projection and its previous context_length-only fallback to the commit that introduced the current files. (extensions/chutes/models.ts:96, d8caec4de5cc)
  • Exact-head real behavior proof: The PR body includes a public-catalog before/after run through the production discovery path: two sparse rows change from 128000 to 131072 while a row with both fields retains context_length precedence. (704192488b3c)

Likely related people:

  • Vincent Koc: Blame attributes the Chutes row projection and its original fallback behavior to the commit that introduced the current files. (role: current implementation introducer; confidence: high; commits: d8caec4de5cc; files: extensions/chutes/models.ts, extensions/chutes/models.test.ts)
  • Peter Steinberger: Recent history shows the shared live-model projection refactor and earlier Chutes metadata validation work. (role: shared catalog architecture contributor; confidence: high; commits: 603f83905888, ef7ad6f7440a; files: src/plugin-sdk/provider-catalog-live-runtime.ts, extensions/chutes/models.ts)
  • mushuiyu886: Prior merged Chutes fixes cover proxy-safe dynamic discovery and live-catalog metadata, independently connecting this author to the area. (role: recent Chutes discovery contributor; confidence: medium; commits: 53f13f051001, 367fe9a42b28; files: extensions/chutes/models.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-04T11:33:43.999Z sha 7041924 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit e8eb765 into openclaw:main Aug 5, 2026
152 of 159 checks passed
@steipete

steipete commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 5, 2026
* origin/main: (22 commits)
  refactor(plugins): consolidate lifecycle hook dispatch (#119429)
  fix(ci): stabilize TUI PTY proof ownership (#119420)
  test(system-agent): reduce suite setup overhead (#119424)
  fix(ui): keep session rail pill status from overlapping the headline (#119397)
  fix(discord): avoid doctor runtime loading (#119391)
  fix(media): decouple playback cache retention (#119417)
  fix(slack): infer upload filename extensions from MIME types (#119399)
  refactor(channels): unify configured binding resolution (#119414)
  refactor(google-meet): unify gateway and tool dispatch (#119413)
  test(state): reuse legacy database fixtures (#119423)
  fix(reset): preserve bootstrap guidance for dynamic models (#119179)
  fix(chutes): honor serving context limits (#119196)
  refactor(status): consolidate scan projections and lazy loaders (#119412)
  fix(status): status --all slows down with missing plugins (#119203)
  refactor(gateway): consolidate usage reporting and caches (#119409)
  perf(gateway): keep reload and recovery machinery off gateway cold start (#119094)
  fix(cli): align TaskFlow controller columns for wide text (#118801)
  fix: make startup migration restart guidance install-neutral (#119406)
  fix(ci): preserve cache warmer shard envelopes (#119403)
  fix(sessions): preserve compatible auth profiles on model changes (#117550)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: chutes P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants