Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions crates/goose/src/context_mgmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ use tracing::log::warn;

pub const DEFAULT_COMPACTION_THRESHOLD: f64 = 0.8;

/// Feature flag to enable/disable tool pair summarization.
/// Set to `false` to disable summarizing old tool call/response pairs.
/// TODO: Re-enable once tool summarization stability issues are resolved.
const ENABLE_TOOL_PAIR_SUMMARIZATION: bool = false;

const CONVERSATION_CONTINUATION_TEXT: &str =
"Your context was compacted. The previous message contains a summary of the conversation so far.
Do not mention that you read a summary or that conversation summarization occurred.
Expand Down Expand Up @@ -509,6 +514,12 @@ pub fn maybe_summarize_tool_pair(
cutoff: usize,
) -> JoinHandle<Option<(Message, String)>> {
tokio::spawn(async move {
// Tool pair summarization is currently disabled via feature flag.
// See ENABLE_TOOL_PAIR_SUMMARIZATION constant above.
if !ENABLE_TOOL_PAIR_SUMMARIZATION {
return None;
}
Comment on lines +517 to +521
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because ENABLE_TOOL_PAIR_SUMMARIZATION is a const set to false, the if !ENABLE_TOOL_PAIR_SUMMARIZATION { return None; } makes the rest of this async block statically unreachable, which will trigger an unreachable_code warning (and likely fail CI with -D warnings). Consider gating the code with #[cfg(feature = ...)]/#[cfg(not(...))] or making the flag non-const (e.g., env/config-driven, or an AtomicBool load) so the compiler doesn’t treat the remainder as unreachable.

Copilot uses AI. Check for mistakes.

if let Some(tool_id) = tool_id_to_summarize(&conversation, cutoff) {
match summarize_tool_call(provider.as_ref(), &session_id, &conversation, &tool_id).await
{
Expand Down
Loading