Skip to content

fix: enforce MaxTokens cap in repomap Format() to prevent system prom…#46

Merged
batalabs merged 2 commits intomainfrom
fix/repomap-token-cap
Apr 8, 2026
Merged

fix: enforce MaxTokens cap in repomap Format() to prevent system prom…#46
batalabs merged 2 commits intomainfrom
fix/repomap-token-cap

Conversation

@batalabs
Copy link
Copy Markdown
Owner

@batalabs batalabs commented Apr 8, 2026

…pt overflow

The format() function was building the full repo map without respecting the configured MaxTokens limit. For large repos (e.g. muxd itself) this produced ~38k token output injected into every system prompt, overflowing models with smaller practical context windows (e.g. ZAI Coding Plan API with glm-5.1).

Now truncates at the nearest newline boundary with a truncation notice.

…pt overflow

The format() function was building the full repo map without respecting the
configured MaxTokens limit. For large repos (e.g. muxd itself) this produced
~38k token output injected into every system prompt, overflowing models with
smaller practical context windows (e.g. ZAI Coding Plan API with glm-5.1).

Now truncates at the nearest newline boundary with a truncation notice.
@batalabs batalabs self-assigned this Apr 8, 2026
@batalabs batalabs merged commit 393a8c7 into main Apr 8, 2026
4 checks passed
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