Skip to content

Commit 61efff3

Browse files
nirajchowdharyNiraj Chowdhary
andauthored
fix(chat): reset pending tool state when clearing conversation (#2855)
Reset tool_uses, pending_tool_index, and tool_turn_start_time to prevent orphaned tool approval prompts after conversation history is cleared. Co-authored-by: Niraj Chowdhary <[email protected]>
1 parent 5d0c62b commit 61efff3

File tree

1 file changed

+6
-0
lines changed
  • crates/chat-cli/src/cli/chat/cli

1 file changed

+6
-0
lines changed

crates/chat-cli/src/cli/chat/cli/clear.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ impl ClearArgs {
5252
if let Some(cm) = session.conversation.context_manager.as_mut() {
5353
cm.hook_executor.cache.clear();
5454
}
55+
56+
// Reset pending tool state to prevent orphaned tool approval prompts
57+
session.tool_uses.clear();
58+
session.pending_tool_index = None;
59+
session.tool_turn_start_time = None;
60+
5561
execute!(
5662
session.stderr,
5763
style::SetForegroundColor(Color::Green),

0 commit comments

Comments
 (0)