Skip to content
Open
Show file tree
Hide file tree
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: 4 additions & 7 deletions crates/tui/src/commands/groups/session/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ pub(in crate::commands) fn compact_pure(arg: Option<&str>) -> CommandResult {
.filter(|focus| !focus.is_empty())
.map(str::to_string);
let receipt = match focus.as_deref() {
Some(focus) => format!("Context compaction triggered (focus: {focus})..."),
None => "Context compaction triggered...".to_string(),
Some(focus) => format!("Making room (focus: {focus})"),
None => "Making room…".to_string(),
};
CommandResult::with_message_and_action(receipt, AppAction::CompactContext { focus })
}
Expand All @@ -55,10 +55,7 @@ mod tests {
#[test]
fn pure_compact_matches_baseline_receipts() {
let none = compact_pure(None);
assert_eq!(
none.message.as_deref(),
Some("Context compaction triggered...")
);
assert_eq!(none.message.as_deref(), Some("Making room…"));
assert!(matches!(
none.action,
Some(AppAction::CompactContext { focus: None })
Expand All @@ -74,7 +71,7 @@ mod tests {
let focus = compact_pure(Some(" the auth refactor "));
assert_eq!(
focus.message.as_deref(),
Some("Context compaction triggered (focus: the auth refactor)...")
Some("Making room (focus: the auth refactor)")
);
assert!(matches!(
focus.action,
Expand Down
2 changes: 1 addition & 1 deletion crates/tui/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2881,7 +2881,7 @@ mod tests {
let compact = execute("/compact the auth refactor", &mut app);
assert_eq!(
compact.message.as_deref(),
Some("Context compaction triggered (focus: the auth refactor)...")
Some("Making room (focus: the auth refactor)")
);
assert!(matches!(
compact.action,
Expand Down
5 changes: 1 addition & 4 deletions crates/tui/src/commands/session_acceptance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,10 +569,7 @@ fn codewhale_triggers_context_compaction(world: &mut SessionCommandWorld) {
world.last_action.as_ref(),
Some(AppAction::CompactContext { .. })
));
assert_eq!(
world.last_message.as_deref(),
Some("Context compaction triggered...")
);
assert_eq!(world.last_message.as_deref(), Some("Making room…"));
}

#[then("CodeWhale should trigger context purge")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ fn test_compact_toggles_state() {
let result = compact(&mut app, None);
assert!(result.message.is_some());
let msg = result.message.unwrap();
assert!(msg.contains("compaction") || msg.contains("Compact"));
assert!(msg.contains("Making room"), "{msg}");
assert!(matches!(
result.action,
Some(AppAction::CompactContext { focus: None })
Expand Down
22 changes: 11 additions & 11 deletions crates/tui/src/compaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1056,28 +1056,28 @@ pub fn report_compaction_failure(
.to_string()
}
Some(crate::llm_client::LlmError::RateLimited { .. }) => {
"provider rate limit blocked compaction — retry after the limit resets or switch provider/model"
"provider rate limit blocked making room — retry after the limit resets or switch provider/model"
.to_string()
}
Some(crate::llm_client::LlmError::AuthenticationError(_)) => {
"provider authentication failed — sign in or replace the credential, then retry"
.to_string()
}
Some(crate::llm_client::LlmError::AuthorizationError(_)) => {
"provider authorization rejected compaction — verify account access or switch provider/model"
"provider authorization rejected making room — verify account access or switch provider/model"
.to_string()
}
_ => match crate::error_taxonomy::classify_error_message(&raw) {
crate::error_taxonomy::ErrorCategory::RateLimit => {
"provider rate limit blocked compaction — retry after the limit resets or switch provider/model"
"provider rate limit blocked making room — retry after the limit resets or switch provider/model"
.to_string()
}
crate::error_taxonomy::ErrorCategory::Authentication => {
"provider authentication failed — sign in or replace the credential, then retry"
.to_string()
}
crate::error_taxonomy::ErrorCategory::Authorization => {
"provider authorization rejected compaction — verify account access or switch provider/model"
"provider authorization rejected making room — verify account access or switch provider/model"
.to_string()
}
_ => safe_raw,
Expand Down Expand Up @@ -1235,7 +1235,7 @@ pub async fn compact_messages_safe(
>= estimate_input_tokens_for_pressure(messages, system_prompt)
{
anyhow::bail!(
"Compaction did not reduce context; original conversation was preserved."
"Making room did not shrink the context; the original conversation was preserved."
);
}
let keep: CompactionKeep = inspect_compaction_keep(&kept);
Expand Down Expand Up @@ -1274,7 +1274,7 @@ pub async fn compact_messages_safe(
}

Err(last_error
.unwrap_or_else(|| anyhow::anyhow!("Compaction failed after {MAX_RETRIES} retries")))
.unwrap_or_else(|| anyhow::anyhow!("Making room failed after {MAX_RETRIES} retries")))
}

pub(crate) fn build_compaction_summary_block_text(summary: &str, anchors: &str) -> String {
Expand Down Expand Up @@ -1516,7 +1516,7 @@ checkpoint machinery, or return a placeholder. {COMPACTION_LANGUAGE_CONTRACT}"
fn validate_compaction_summary(summary: &str) -> Result<()> {
let trimmed = summary.trim();
if trimmed.is_empty() {
anyhow::bail!("Compaction summary response was unusable: no text was returned.");
anyhow::bail!("The summary for making room was unusable: no text was returned.");
}

// Strip every non-word edge, not just ASCII punctuation. Providers can
Expand All @@ -1529,7 +1529,7 @@ fn validate_compaction_summary(summary: &str) -> Result<()> {
.to_ascii_lowercase();
if normalized.is_empty() {
anyhow::bail!(
"Compaction summary response was unusable: only whitespace or punctuation was returned."
"The summary for making room was unusable: only whitespace or punctuation was returned."
);
}
if matches!(
Expand All @@ -1544,7 +1544,7 @@ fn validate_compaction_summary(summary: &str) -> Result<()> {
| "i can't provide a summary"
| "unable to provide a summary"
) {
anyhow::bail!("Compaction summary response was unusable: a placeholder was returned.");
anyhow::bail!("The summary for making room was unusable: a placeholder was returned.");
}
Ok(())
}
Expand Down Expand Up @@ -1673,7 +1673,7 @@ async fn create_summary(
// with a fragment.
if codewhale_models::is_incomplete_stop_reason(response.stop_reason.as_deref()) {
anyhow::bail!(
"Compaction summary response incomplete: provider stop reason `{}`; the partial summary was not accepted.",
"The summary for making room was incomplete: provider stop reason `{}`; the partial summary was not accepted.",
codewhale_models::stop_reason_detail(response.stop_reason.as_deref())
);
}
Expand All @@ -1683,7 +1683,7 @@ async fn create_summary(
.any(|block| matches!(block, ContentBlock::ToolUse { .. }))
{
anyhow::bail!(
"Compaction returned a tool call instead of a completed handoff; original conversation was preserved."
"Making room returned a tool call instead of a summary; the original conversation was preserved."
);
}

Expand Down
16 changes: 8 additions & 8 deletions crates/tui/src/compaction/last_round.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ pub(crate) fn validate_last_round_coverage(
for text in last_round.iter().copied().filter_map(user_prompt_text_of) {
if !survives(&text, replacement, user_prompt_text_of) {
anyhow::bail!(
"Compaction coverage floor: a last-round user message was dropped; history was not replaced."
"Making room stopped: a last-round user message was dropped; history was not replaced."
);
}
}
Expand All @@ -379,7 +379,7 @@ pub(crate) fn validate_last_round_coverage(
.any(|message| has_tool_result_id(message, &id))
{
anyhow::bail!(
"Compaction coverage floor: last-round tool result {id} was dropped; history was not replaced."
"Making room stopped: last-round tool result {id} was dropped; history was not replaced."
);
}
}
Expand All @@ -391,7 +391,7 @@ pub(crate) fn validate_last_round_coverage(
.any(|message| has_tool_use_id(message, &id))
{
anyhow::bail!(
"Compaction coverage floor: last-round tool call {id} was dropped; history was not replaced."
"Making room stopped: last-round tool call {id} was dropped; history was not replaced."
);
}
}
Expand All @@ -401,7 +401,7 @@ pub(crate) fn validate_last_round_coverage(
for text in last_round.iter().copied().filter_map(assistant_text_of) {
if !survives(&text, replacement, assistant_text_of) {
anyhow::bail!(
"Compaction coverage floor: last-round assistant output was dropped; history was not replaced."
"Making room stopped: last-round assistant output was dropped; history was not replaced."
);
}
}
Expand All @@ -413,7 +413,7 @@ pub(crate) fn validate_last_round_coverage(
.any(|message| message.role.is_assistant_like())
{
anyhow::bail!(
"Compaction coverage floor: last-round assistant output was dropped; history was not replaced."
"Making room stopped: last-round assistant output was dropped; history was not replaced."
);
}
Ok(())
Expand All @@ -436,7 +436,7 @@ pub(crate) fn require_text_survives(
})
});
if !kept {
anyhow::bail!("Compaction coverage floor: {label} was dropped; history was not replaced.");
anyhow::bail!("Making room stopped: {label} was dropped; history was not replaced.");
}
Ok(())
}
Expand All @@ -453,12 +453,12 @@ pub(crate) fn validate_survival_contract(
.count();
if checkpoints == 0 {
anyhow::bail!(
"Compaction coverage floor: checkpoint receipt was dropped; history was not replaced."
"Making room stopped: checkpoint receipt was dropped; history was not replaced."
);
}
if checkpoints > 1 {
anyhow::bail!(
"Compaction coverage floor: prior summaries were duplicated; history was not replaced."
"Making room stopped: prior summaries were duplicated; history was not replaced."
);
}
if let Some(anchors) = anchors {
Expand Down
4 changes: 2 additions & 2 deletions crates/tui/src/compaction/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ fn untyped_usage_limit_text_never_becomes_quota_exhaustion() {
"[auth] Authorization failed: You've reached your usage limit for this billing cycle"
);
let message = report(&error);
assert!(message.contains("provider rate limit blocked compaction"));
assert!(message.contains("provider rate limit blocked making room"));
assert!(!message.contains("quota exhausted"));
}

Expand All @@ -133,7 +133,7 @@ fn typed_rate_limit_stays_transient_and_does_not_become_quota() {
message: "Too Many Requests".into(),
retry_after: None,
});
assert!(report(&error).contains("provider rate limit blocked compaction"));
assert!(report(&error).contains("provider rate limit blocked making room"));
assert!(is_transient_error(&error));
}

Expand Down
4 changes: 2 additions & 2 deletions crates/tui/src/core/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3152,8 +3152,8 @@ impl Engine {
let _ = self
.tx_event
.send(Event::status(format!(
"Auto-compaction {}",
if enabled { "enabled" } else { "disabled" }
"Make room automatically: {}",
if enabled { "on" } else { "off" }
)))
.await;
}
Expand Down
Loading
Loading