fix: resolve CI failures — fmt + remove unused function
- Run cargo fmt to fix trailing whitespace and formatting - Remove unused `get_compaction_instruction()` that triggered -D warnings
This commit is contained in:
@@ -326,10 +326,7 @@ mod tests {
|
||||
assert!(result.message.is_some());
|
||||
let msg = result.message.unwrap();
|
||||
assert!(msg.contains("compaction") || msg.contains("Compact"));
|
||||
assert!(matches!(
|
||||
result.action,
|
||||
Some(AppAction::CompactContext)
|
||||
));
|
||||
assert!(matches!(result.action, Some(AppAction::CompactContext)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
+10
-10
@@ -770,13 +770,13 @@ fn extract_workflow_context(messages: &[Message], workspace: Option<&Path>) -> S
|
||||
let mut files_touched: Vec<String> = Vec::new();
|
||||
let mut tools_used: Vec<String> = Vec::new();
|
||||
let mut tasks_identified: Vec<String> = Vec::new();
|
||||
|
||||
|
||||
for msg in messages {
|
||||
for block in &msg.content {
|
||||
match block {
|
||||
ContentBlock::ToolUse { name, input, .. } => {
|
||||
tools_used.push(name.clone());
|
||||
|
||||
|
||||
// Extract file paths from tool inputs
|
||||
if let Some(path) = extract_path_from_input(input) {
|
||||
if !files_touched.contains(&path) {
|
||||
@@ -797,9 +797,9 @@ fn extract_workflow_context(messages: &[Message], workspace: Option<&Path>) -> S
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let mut context = String::new();
|
||||
|
||||
|
||||
if !files_touched.is_empty() {
|
||||
context.push_str("**Files Modified/Read:**\n");
|
||||
for file in &files_touched {
|
||||
@@ -815,13 +815,13 @@ fn extract_workflow_context(messages: &[Message], workspace: Option<&Path>) -> S
|
||||
}
|
||||
context.push('\n');
|
||||
}
|
||||
|
||||
|
||||
if !tools_used.is_empty() {
|
||||
context.push_str("**Tools Used:** ");
|
||||
context.push_str(&tools_used.join(", "));
|
||||
context.push_str("\n\n");
|
||||
}
|
||||
|
||||
|
||||
if !tasks_identified.is_empty() {
|
||||
context.push_str("**Tasks/TODOs Identified:**\n");
|
||||
for task in &tasks_identified {
|
||||
@@ -829,11 +829,11 @@ fn extract_workflow_context(messages: &[Message], workspace: Option<&Path>) -> S
|
||||
}
|
||||
context.push('\n');
|
||||
}
|
||||
|
||||
|
||||
if context.is_empty() {
|
||||
context.push_str("No specific workflow context detected. Continue assisting the user with their current task.\n");
|
||||
}
|
||||
|
||||
|
||||
context
|
||||
}
|
||||
|
||||
@@ -845,7 +845,7 @@ fn extract_path_from_input(input: &serde_json::Value) -> Option<String> {
|
||||
return Some(path.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Try to find path in nested objects
|
||||
if let Some(obj) = input.as_object() {
|
||||
for (_, value) in obj {
|
||||
@@ -856,7 +856,7 @@ fn extract_path_from_input(input: &serde_json::Value) -> Option<String> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
|
||||
@@ -46,17 +46,6 @@ fn format_welcome_banner(model: &str, workspace: &PathBuf, yolo: bool) -> String
|
||||
)
|
||||
}
|
||||
|
||||
/// Get the agent-facing instruction about context compaction.
|
||||
/// This encourages the agent to request compaction when context gets long.
|
||||
fn get_compaction_instruction() -> &'static str {
|
||||
"## Context Management\n\n\
|
||||
When the conversation gets long (you'll see a context usage indicator), you can:\n\
|
||||
1. Use `/compact` to summarize earlier context and free up space\n\
|
||||
2. The system will preserve important information (files you're working on, recent messages, tool results)\n\
|
||||
3. After compaction, you'll see a summary of what was discussed and can continue seamlessly\n\n\
|
||||
If you notice context is getting long (>80%), proactively suggest using `/compact` to the user."
|
||||
}
|
||||
|
||||
// === Types ===
|
||||
|
||||
/// State machine for onboarding new users.
|
||||
|
||||
+2
-1
@@ -1126,7 +1126,8 @@ async fn run_event_loop(
|
||||
.await;
|
||||
}
|
||||
AppAction::CompactContext => {
|
||||
app.status_message = Some("Compacting context...".to_string());
|
||||
app.status_message =
|
||||
Some("Compacting context...".to_string());
|
||||
let _ = engine_handle.send(Op::CompactContext).await;
|
||||
}
|
||||
AppAction::TaskAdd { prompt } => {
|
||||
|
||||
Reference in New Issue
Block a user