fix(cli): make auto-compact non-agentic#32
Open
BunsDev wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the CLI TUI’s idle auto-compaction behavior to honor the configured auto-compact enablement/threshold and to avoid triggering an agentic query-loop turn by using the dedicated non-tool compaction path.
Changes:
- Sync the effective compaction threshold from config into TUI state (
app.auto_compact_threshold) and gate idle auto-compact onapp.auto_compact_enabled. - Replace the idle-path “synthetic user message +
run_query_loop” flow with a direct call toclaurst_query::compact_conversationin a background task. - Improve status messaging around auto-compaction initiation/completion.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+3054
to
3058
| let compact_model = | ||
| claurst_api::effective_model_for_config(&cmd_ctx.config, &model_registry); | ||
| let client_clone = client.clone(); | ||
| app.is_streaming = true; | ||
|
|
Comment on lines
3057
to
3058
| app.is_streaming = true; | ||
|
|
Comment on lines
+3060
to
3069
| if ct.is_cancelled() { | ||
| return QueryOutcome::Cancelled; | ||
| } | ||
|
|
||
| let msgs = msgs_arc_clone.lock().await.clone(); | ||
| match claurst_query::compact_conversation( | ||
| client_clone.as_ref(), | ||
| &mut msgs, | ||
| tools_arc_clone.as_slice(), | ||
| &ctx_clone, | ||
| &qcfg, | ||
| tracker, | ||
| Some(tx), | ||
| ct, | ||
| None, | ||
| &msgs, | ||
| &compact_model, | ||
| ) |
Comment on lines
+3032
to
+3036
| // Auto-compact: when enabled and context usage reaches the configured | ||
| // threshold with no query running, summarize through the dedicated | ||
| // no-tools compaction path instead of starting an agentic turn. | ||
| if app.auto_compact_enabled | ||
| && app.context_window_size > 0 |
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.
Motivation
Description
app.auto_compact_threshold) and respectapp.auto_compact_enabledbefore triggering compaction.run_query_loopwith a direct call to the non-agentic summarisercompact_conversation, which does not advertise or execute tools.app.is_streaming,app.auto_compact_running, status messages, session save).Testing
cargo check -p claurst --no-default-features— passed.cargo check --workspace— could not complete in this environment due to missing systemalsadev files required byalsa-sys/cpal(external system dependency).cargo clippy -p claurst --no-default-features --all-targets -- -D warnings— not green due to pre-existing clippy warnings outside the scope of this change.Codex Task