[GH-ISSUE #694] fit_max_tokens issue, context problem with agentic coding. #323

Closed
opened 2026-11-04 01:41:58 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @mkultra333 on GitHub (Oct 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/694

I'm using Strata with Oh My Pi, context size 131072 and maxTokens in OMP set to 64000. I would run into a problem where the existing context plus the next promt size would choke. The error message from OMP is:


✘ 400 prompt (67811 tokens) + max tokens (64000) exceeds the context (131072); requests are never
 truncated. Se…
   prompt (67811 tokens) + max tokens (64000) exceeds the context (131072); requests are never
 truncated. Send a…
   raw-http-request=C:\Users\Jared\.omp\logs\http-400-requests\1791019190383-1s8auzy6vao75.json
 Dismissed when you send your next message.

After some back and forth with Claude we found that this can be fixed with a setting already in Strata, change fit_max_tokens from False to True. I can't find any way to do this manually though, if I add it to my strata-iq3_xxs.json file it just gets overwritten again when I launch.

The only way I found to change it was in setup.py, find this code:


    cfg = {"exe": str(eng / EXE), "args": args, "cwd": str(ROOT), "tokenizer": str(pack / "tokenizer"),
           "model_name": f"{fam['name']}-{model.lower()}", "log": str(ROOT / f"strata-{tag.lower()}.log"),
           "lib_dirs": lib_dirs, "port": a.port}

and change the last line to:

           "lib_dirs": lib_dirs, "port": a.port, "fit_max_tokens": True}

After that,
"fit_max_tokens": true,
appears in strata-iq3_xxs.json and the context problem in OMP goes away and it all works fine.

Perhaps fit_max_tokens should be true by default? Or easily set with a command line option?

Originally created by @mkultra333 on GitHub (Oct 3, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/694 I'm using Strata with Oh My Pi, context size 131072 and maxTokens in OMP set to 64000. I would run into a problem where the existing context plus the next promt size would choke. The error message from OMP is: ``` ✘ 400 prompt (67811 tokens) + max tokens (64000) exceeds the context (131072); requests are never truncated. Se… prompt (67811 tokens) + max tokens (64000) exceeds the context (131072); requests are never truncated. Send a… raw-http-request=C:\Users\Jared\.omp\logs\http-400-requests\1791019190383-1s8auzy6vao75.json Dismissed when you send your next message. ``` After some back and forth with Claude we found that this can be fixed with a setting already in Strata, change fit_max_tokens from False to True. I can't find any way to do this manually though, if I add it to my strata-iq3_xxs.json file it just gets overwritten again when I launch. The only way I found to change it was in setup.py, find this code: ``` cfg = {"exe": str(eng / EXE), "args": args, "cwd": str(ROOT), "tokenizer": str(pack / "tokenizer"), "model_name": f"{fam['name']}-{model.lower()}", "log": str(ROOT / f"strata-{tag.lower()}.log"), "lib_dirs": lib_dirs, "port": a.port} ``` and change the last line to: ``` "lib_dirs": lib_dirs, "port": a.port, "fit_max_tokens": True} ``` After that, "fit_max_tokens": true, appears in strata-iq3_xxs.json and the context problem in OMP goes away and it all works fine. Perhaps fit_max_tokens should be true by default? Or easily set with a command line option?
Author
Owner

@apdogod123321-ops commented on GitHub (Oct 4, 2026):

im having this problem nearly constantly too

<!-- gh-comment-id:5976161747 --> @apdogod123321-ops commented on GitHub (Oct 4, 2026): im having this problem nearly constantly too
Author
Owner

@sruggier commented on GitHub (Oct 4, 2026):

im having this problem nearly constantly too

There is a workaround: you can set fit_max_tokens, as described in this comment.

It only gets overwritten if --setup is passed to the CLI.

<!-- gh-comment-id:5976773576 --> @sruggier commented on GitHub (Oct 4, 2026): > im having this problem nearly constantly too There is a workaround: you can set `fit_max_tokens`, as described [in this comment](https://github.com/Niko1221/Strata/issues/545#issuecomment-5964029432). It only gets overwritten if `--setup` is passed to the CLI.
Author
Owner

@Niko1221 commented on GitHub (Oct 7, 2026):

Answered: since 0.1.39 setup keeps fit_max_tokens (and the other settings listed in its keep list) when you run it again, so the value you set in the config survives --setup. Closing; please reopen with the version and config if it gets overwritten again.

<!-- gh-comment-id:6037747852 --> @Niko1221 commented on GitHub (Oct 7, 2026): Answered: since 0.1.39 setup keeps fit_max_tokens (and the other settings listed in its keep list) when you run it again, so the value you set in the config survives --setup. Closing; please reopen with the version and config if it gets overwritten again.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#323
No description provided.