Repository navigation
feat(conversation): add compact.strategy pointer mode - #1629
Merged
Merged
Conversation
Behind the new compact.strategy: pointer setting, a compaction skips the LLM summarizer call and seeds the continued session with one user message that opens with the context summary marker and names the previous session id, telling the model to pull only what it needs via infer conversations show. The summary strategy stays the unchanged default. The pointer keeps the optimizer gate, hasCheckpoint and the restore hook working in manual /compact, auto_at and idle rollovers alike.
2 tasks
inference-gateway-maintainer
Bot
marked this pull request as ready for review
October 28, 2026 16:49
inference-gateway-maintainer
Bot
requested a review
from a team
as a code owner
October 28, 2026 16:49
5 tasks
edenreich
reviewed
Oct 28, 2026
Replace the untyped strategy constants with a defined CompactStrategy string type and drop the verbose field comment the review flagged, threading the type through the optimizer config and struct so the summary and pointer values are compiler-checked instead of documented in prose
edenreich
reviewed
Oct 28, 2026
conversations show prints only the first 10 entries by default so a careless read does not flood the context. --no-trunc lifts the cap and --append (-a) prints the entries after the window so a long session can be read in chunks. Per-entry numbers stay true to the session across windows, truncated output is flagged in text and json, and the commands reference covers the new flags.
Contributor
|
🎉 This PR is included in version 0.239.0-rc.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Contributor
|
🎉 This PR is included in version 0.239.0 🎉 The release is available on: 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.
Resolves #1627
Summary
Adds an opt-in
compact.strategy: pointermode for compaction. With it, a rollover (manual/compact, theauto_attoken trigger or the idle trigger) skips the LLM summarizer call entirely and seeds the continued session with a single user message that opens with the context summary marker, names the previous session id, and tells the model to read only what it needs from there viainfer conversations show <id>. The model chooses what matters instead of the summarizer deciding up front. The defaultsummarystrategy is byte-for-byte unchanged.Changes
config.CompactConfiggainsstrategy(summary|pointer, defaultsummary), with env varINFER_COMPACT_STRATEGY(viper maps it automatically) and an unknown-value fallback tosummarywhen the optimizer is built.internal/conversation:smartOptimizenow builds its checkpoint through a strategy switch.summaryCheckpointis the moved (unchanged) LLM summary path;pointerCheckpointreads the previous session id from the wired repo at compaction time - insideperformRolloverthat is beforeStartNewConversationrepoints the repo, so it is exactly the id the session groupHistoryrecords - and skips the client entirely, so no LLM call, no backoff and nosummary_max_tokensinvolvement. The pointer message opens withcontextSummaryMarker, sohasCheckpointand the gatederrNoCheckpointpath from [BUG] Session rollover bypasses compaction backoff and rolls over on a failed summary #1592 keep holding.RestoreContext(skill restore) hook runs unchanged in both strategies.internal/containerpasses the strategy through to the optimizer (single wiring point).docs/configuration-reference.md: documentscompact.strategyunder Compact Settings, a pointer-mode note in the checkpoint paragraph, and the env var in the Compact Configuration env list.conversation_optimizer_test.go(no summarizer call, message shape, marker present, restore hook, missing-id fallback, unknown-strategy fallback) and full rollover tests insession_rollover_test.gofor all three triggers (manual force,auto_atgatedforce=false, idle force) with the real optimizer and a nil client, asserting the pointer names the id recorded in the groupHistoryand that the pointed-at session still holds the full conversation.No docs ticket: documentation was updated in-repo (this PR modifies
docs/configuration-reference.md, which lives in this repo).