fix(services): Prevent compact summary truncation at 200-token cap#457
Merged
fix(services): Prevent compact summary truncation at 200-token cap#457
Conversation
The summary was hardcoded at 200 max tokens with no FinishReason check, so when the model hit the cap the truncated mid-sentence text was rendered as a complete summary. Raise the default to 1024, expose it as compact.summary_max_tokens, and warn-log on FinishReason=length.
ig-semantic-release-bot Bot
pushed a commit
that referenced
this pull request
Apr 27, 2026
## [0.104.2](v0.104.1...v0.104.2) (2026-04-27) ### 🐛 Bug Fixes * **services:** Prevent compact summary truncation at 200-token cap ([#457](#457)) ([36b9612](36b9612)), closes [#454](#454) * Reconcile token displays and persist metadata-only saves ([#459](#459)) ([8bc8767](8bc8767)) ### 📚 Documentation * Update agents MD ([#458](#458)) ([27bfaea](27bfaea)) ### 🧹 Maintenance * **nix:** Update package to v0.104.1 ([#456](#456)) ([784e4bc](784e4bc))
Contributor
|
🎉 This PR is included in version 0.104.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GenerateLLMSummaryhardcodedmaxTokens := 200and ignoredFinishReason, so when the model hit the cap the truncated mid-sentence text was rendered as a complete--- Context Summary ---block. Raise the default to 1024 and expose it ascompact.summary_max_tokensfor tuning.response.Choices[0].FinishReason == sdk.Lengthso future truncations are visible in logs instead of failing silently.fix(services): Trigger auto-compact from gateway-reported tokens) made auto-compact actually fire on the gateway-reported token count — the 200-cap was always too tight, but compaction rarely triggered before, so the truncation was rarely visible.