Repository navigation
fix(models): replies truncate at 8192 output tokens when a model has no known output limit - #193899
Conversation
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR replaces copied output-token fallbacks with one context-aware default of up to 32,768 tokens while preserving explicit limits. Example: A custom OpenAI-compatible model named big-unknown has no configured or catalog output limit.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This maintainer-authored PR remains useful and has no remaining actionable findings; the updated stable-release upgrade evidence resolves the previous compatibility blocker. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherConfiguration materialization and provider discovery turn authored settings and catalog metadata into model budgets that inference transports serialize into requests. flowchart LR
A[Authored configuration] --> C[Model materialization]
B[Provider discovery] --> C
D[Shared output default] --> C
C --> E[Request budget]
E --> F[Provider transport]
Technical reviewBest possible solution: Use the shared context-aware fallback across existing model owners while retaining authored limits and provider-specific request contracts. Do we have a high-confidence way to reproduce the issue? Current-main source supplies the 8192 fallback, and the supplied before-fix agent request trace records that value on the wire; no target code was executed during this review. Is this the best way to solve the issue? The shared resolver is a small, coherent solution to the chosen default-budget change, preserves numeric model contracts, and avoids the cap-omission problems discussed in #126611. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7349fd516c64. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +73, Tests +131, Docs +2. Total +206 across 47 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)
Reviewed November 5, 2026, 11:25 PM ET / November 6, 2026, 04:25 UTC (Revision 3). |
3e53bfa to
21d9157
Compare
Models with no authored, provider, or catalog output limit fell back to 8192 output tokens (4096 for custom providers added through onboarding), which truncated long answers and large tool-call arguments. One shared resolver now owns the invented cap: 32768, reduced to half of a known context window below 64K so the prompt keeps room, never below the former 8192 unless the window itself is smaller. Explicit model and provider limits are unchanged. Self-hosted discovery and setup, Ollama, LM Studio, llama.cpp, OpenRouter, Copilot, Hugging Face, DeepInfra, Baseten, Synthetic, Hermes import, live catalog normalization and the custom-provider wizard use it instead of their own 8192 or 4096 constants.
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
Preserve real note-module exports in the Doctor mock. Allocate the exact 305-line net regression growth for shared output-budget, explicit/provider/window controls, and non-mutating Doctor coverage without changing the shared test-line scalar. Co-authored-by: vincentkoc <[email protected]> Co-authored-by: VACInc <[email protected]>
|
Merged via squash.
|
…no known output limit (openclaw#193899) * fix(models): raise the default output-token cap to 32768 Models with no authored, provider, or catalog output limit fell back to 8192 output tokens (4096 for custom providers added through onboarding), which truncated long answers and large tool-call arguments. One shared resolver now owns the invented cap: 32768, reduced to half of a known context window below 64K so the prompt keeps room, never below the former 8192 unless the window itself is smaller. Explicit model and provider limits are unchanged. Self-hosted discovery and setup, Ollama, LM Studio, llama.cpp, OpenRouter, Copilot, Hugging Face, DeepInfra, Baseten, Synthetic, Hermes import, live catalog normalization and the custom-provider wizard use it instead of their own 8192 or 4096 constants. * fix(doctor): report saved model output caps that pin a former onboarding default * fix(doctor): print saved output cap notice in plain doctor * test(models): satisfy output-budget CI guards Preserve real note-module exports in the Doctor mock. Allocate the exact 305-line net regression growth for shared output-budget, explicit/provider/window controls, and non-mutating Doctor coverage without changing the shared test-line scalar. Co-authored-by: vincentkoc <[email protected]> Co-authored-by: VACInc <[email protected]> --------- Co-authored-by: VACInc <[email protected]> Co-authored-by: vincentkoc <[email protected]>
Models without an authored, catalog, or provider output limit use the shared context-sized 32768 default rather than an invented 8192/4096 cap. Preserve explicit limits and add informational, non-mutating Doctor guidance for saved former onboarding defaults. Release adaptation: preserve release discovery/normalization and provider factory layouts, the Mistral safe repair ceiling, Azure wizard defaults, LM Studio served context, and existing SDK entrypoints. Port only the Ollama cloud budget facts/helper and native num_predict ownership needed by this change; keep explicit request and model-parameter precedence. Do not import the broad #173844 repetition guard or #177454 refactor. Use the baseline Doctor information renderer and factories without unsupported docsUrl or main-only finding-storage assumptions. Add release-native config-to-request and discovered/native output cap proof. Carry known hosted routes through existing Ollama fallback, dynamic, and setup builders, preserving bare local model behavior. Resolve the cloud reference helper through the baseline provider-model-shared SDK export. (cherry picked from commit 94e6734) Co-authored-by: vincentkoc <[email protected]> Co-authored-by: VACInc <[email protected]> Co-authored-by: RomneyDa <[email protected]>
Follow-up to the reviewed #193899 release adaptation. Retain local-daemon remote tag identity and explicitly configured output caps through guided preparation. Five boundary cases add 49 net regression-test lines; reconcile only this change allocation from 507 to 556. Before: 4 failures; after: 68 passing tests plus final typed 16-test pass. Co-authored-by: RomneyDa <[email protected]>
Adapt #193899 and #196766 to the release model/Doctor owners. Share only invented caps; preserve authored, provider, catalog and current Ollama cloud limits. Recompute fresh LM Studio defaults after preferred context selection. Doctor reports legacy saved caps without rewriting configuration. Source: 94e6734 Companion: 3c5122a Proof: real base regressions fail; current focused contracts total 493 passing tests over 18 files, plus 127 provider sibling tests. Counts reuse unchanged suite proof; no aggregate clean rerun claimed. Touched-source typecheck, focused lint, formatting and diff checks pass. Independent full review clear; follow-up fixture URL finding corrected and Doctor 13/13 passes. Allocate 347 net regression lines (324+23) for context-sized defaults, explicit limit controls, provider consumers and non-mutating Doctor behavior. Gap: no real-agent configured-provider outbound-budget composition or live provider/stable-upgrade proof. Release qualification remains with parent. Co-authored-by: vincentkoc <[email protected]> Co-authored-by: VACInc <[email protected]> Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 8cc0d68179c677a2609ff48e3fe7dda1ee4b3c04)
Related: #71045, #119259, #126458, #126611
Problem and scope
Vito Cappello's fix replaces the synthesized 8192-token output budget (4096 in the custom-provider wizard) with a bounded, context-aware default of up to 32768. It addresses truncation caused by that default on the configured/discovered provider paths below. This is an intentional default-budget policy, not a complete migration to absent output-cap metadata and not proof of a historical leaderboard improvement.
One owner,
resolveDefaultModelMaxTokens(contextWindow?)insrc/agents/defaults.ts, is exported throughplugin-sdk/provider-model-shared:min(32768, max(min(8192, window), floor(window / 2))).contextTokens, llama.cppn_ctx, vLLMmax_model_len, LM Studio load length, and the local Ollama 32Knum_ctxcap.The cutover covers config materialization, self-hosted discovery/setup, local Ollama, OpenRouter dynamic/live/Auto/capability-cache paths, Copilot, Hugging Face, DeepInfra, Baseten, Synthetic, Hermes import, generic live-catalog normalization, and the non-Azure custom-provider wizard.
User impact and accepted tradeoffs
Unknown-limit rows can request up to 32768 output tokens rather than 8192. A known 32K window gets a 16384 default; a 16K window gets 8192. Existing per-request prompt budgeting can trim these further.
Saved numeric caps are not rewritten. Old onboarding values such as 4096 or 8192 remain authoritative until the user raises or removes them. Doctor adds informational guidance, grouped by provider, without changing config, failing health, or offering an automatic repair. It skips Mistral, provider-level caps, and rows whose context-aware default is not higher. A known catalog cap may still apply after a saved cap is removed; the synthesized number is not a newly discovered factual model capability.
Known compatibility tradeoff: a strict provider with an unknown independent output ceiling can reject 32768 with a 400 where 8192 passed. Configure that model's real
maxTokenswhen this occurs. This is explicitly accepted as part of the bounded-default policy.Intentionally unchanged: Mistral's 8192 repair value (#53054), Doctor's historical metadata-corruption fingerprint, hosted Ollama catalog/context budgets, and Bedrock's authored-cap forwarding behavior (#97343). The materialized numeric model contract remains unchanged. Unlike the incomplete omission attempt in #126611, this does not remove the numeric field. It also does not fix every pre-existing unknown-cap constructor: unchanged inline/static paths can still use their existing context-sized fallback. No new config option, stored-data rewrite, or schema change is introduced.
Release note: Default synthesized output budget raised from 8192 to up to 32768, sized down for small context windows. Doctor points out saved 4096/8192 caps that may retain the old behavior.
Author's production-path and upgrade evidence
The original author ran official
pnpm openclaw agent --localbuilds against a local fake OpenAI-compatible endpoint, with isolated HOME/state/config and no real provider keys:938a72d4c1ewire capThe 32K row materializes to 16384; existing prompt budgeting trims it to 13349 because the default prompt/tools use about 19K. The 16K-window control stopped before a provider request because the default prompt did not fit; that pre-existing prompt-size limitation is unrelated to this change. The fake endpoint streamed
ok, so these cases prove serialization, not real-provider acceptance or long-generation quality.The author also exercised published
[email protected], then the branch's normal Doctor upgrade step, on the same isolated state. Saved provider-level 4096, wizard-saved 4096, and explicit 8192 remained unchanged on the wire; the unknown row changed from 8192 to 32768. All fake-provider turns returnedok, and the config'smodelssection remained identical. This upgrade proof covers config-driven custom providers, not every discovered provider plugin.A real
doctor --non-interactiverun printed saved-cap guidance, exited 0, and left the isolated config byte-identical. Detection tests cover grouping, Mistral/provider-cap skips, sanitization, note output, unchanged config, and healthy status.Independent real-model verification
Official
pnpm openclaw agent --localturns ran in secretless containers against real llama.cpp-served Qwen2.5-0.5B-Instruct Q4_K_M. Base:d4ae77eae296fd8eb1f90f7a4ebb5d77fa2e6ad9; PR runtime:357467abf979d35435a5e22f416c2112366a24d3. The subsequent CI-only repairdd92fac1754b9af32611dfea27d1518b7d21bd4cdoes not change runtime budget code.max_completion_tokensAll three turns were not aborted. The small model did not consistently follow the requested echo marker; its mismatches were preserved, not relabeled as exact-marker successes. This establishes config-to-wire budget propagation and normal completion, not task-solving quality.
A separate real-server
ignore_eos: truecontrol emitted exactly 8200 completion tokens with finish reasonlength. That is a forced-EOS budget-mechanism test, not natural long-generation or completed-tool-call evidence.Pins: model revision
9217f5db79a29953eb74d5343926648285ec7e67; model SHA-25674a4da8c9fdbcd15bd1f6d01d621410d31c6fc00986f5eb687824e7b93d7a9db; llama.cpp imageghcr.io/ggml-org/llama.cpp@sha256:41988e510b6fe0a0b5b9be00a9dbf91d9f0fa691da173d7b06d97d370329fe84.No hosted-provider API, paid inference, real credentials, or historical leaderboard replay was used. Other local inference servers remain covered by discovery-shape tests, not live calls. No benchmark gain or causal explanation of aggregate ranks is claimed.
Regression coverage and review
Author-reported red-on-base / green-on-branch cases:
src/config/defaults.test.ts(4 base failures/37),src/config/defaults.ollama-output-cap.test.ts(5/30), andsrc/plugin-sdk/provider-catalog-live-normalize.tokens.test.ts(2/6). The matrix includes unknown/large/32K/16K/4K windows, served context, explicit caps above/below defaults, provider caps, and provider caps on small windows.The author reports passing targeted core/provider tests and extension suites for Ollama, LM Studio, llama.cpp, OpenRouter, Copilot, Hugging Face, DeepInfra, Baseten, Synthetic, Hermes, and Bedrock authored-32768 forwarding; typecheck/lint/format/import-cycle checks and SDK export checks also passed. Earlier unrelated main-tree changelog/dead-export findings are not treated as proof that this candidate's CI passes.
Independent full-range local review, including the two CI repairs: complete single pass, no actionable P0–P2 findings. Static review did not execute tests. Scoped simplification kept the repairs to two files.
CI repair, test cost, and pending proof
The original head's CI failed mock-exports and test-lines. Repair
dd92fac1754b9af32611dfea27d1518b7d21bd4cpreserves the real note-module exports before overridingnoteand adds a separate 305-line allocation. Exact positive test growth against merge base938a72d4c1e4136d07f32156ed633f2f86a524a1is 327 additions minus 22 deletions = 305 (302 original plus three repair lines). The allocation is needed for shared-budget, explicit/provider/window controls and non-mutating Doctor regressions. The shared scalar is unchanged.Exact changed-file formatter: exit 0, 0.077 s. Official focused Doctor tests did not reach assertions in secretless isolation: compiled-worker preparation exited 137 on baseline (18.829 s) and patched snapshot (17.595 s); larger-memory/affinity attempts hit the shared host execution-memory budget. These are setup/resource failures, not assertion-level product failures. Focused test runtime and CI seconds remain unmeasured locally.
The isolated mock-export guard required a Git base; none was fabricated. The exact signed repair candidate has been published through the native pending-proof workflow, not declared ready to merge. Exact-head GitHub CI must validate the focused tests and both ratchets; fresh READY correction review and ordinary landing gates remain required.