Skip to content

fix: return conservative token limits for unspecified models#3063

Open
LLuke wants to merge 1 commit into
ultraworkers:mainfrom
LLuke:fix/default_context_window
Open

fix: return conservative token limits for unspecified models#3063
LLuke wants to merge 1 commit into
ultraworkers:mainfrom
LLuke:fix/default_context_window

Conversation

@LLuke
Copy link
Copy Markdown

@LLuke LLuke commented May 24, 2026

to avoid crashes

Summary

  • When working with a model not specially handled and coded in rust/crates/api/src/providers/mod.rs, the claw doesn't have an idea about the context window size. It will keep on growing without automatic compact, eventually lead of crash of the claw process when an error is thrown in the main.rs. The proper way fix is configure and don't hardcode any. However, we still need a reasonable default du jour to reduce chance of crashes. Thus it is picked to be max_output_tokens: 16_384, context_window_tokens: 131_072 as the minimum of each among the current specified models. While this doesn't prevent crash while working with much less capable models and may under-utilize much more capable models, it is a line in the sand currently needed before claw-code further optimize.

Anti-slop triage

Verification

  • Targeted tests/docs checks ran, or the gap is explicitly recorded.
  • git diff --check passes.
  • No live secrets, tokens, private logs, or unrelated generated churn are included.

Resolution gate

  • If this PR resolves an issue, the issue number and fix evidence are linked.
  • If this PR should not merge, the rejection/defer rationale is evidence-backed and does not rely on vibes.
  • I did not merge/close remote PRs or issues from an automation lane without owner approval.

@LLuke
Copy link
Copy Markdown
Author

LLuke commented May 24, 2026

After the fix, testing clawd with MiniMax M2.5 with up to 192K token context window is stable with auto-compacted seen:

...
[auto-compacted: removed 61 messages]
...
[auto-compacted: removed 8 messages]

The 16K/132K were much lower than the model's full capacity but as a safe default the clawd code no longer hangs or crash, -- it is rather snappy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant