clear running commands in various places (#2325)
we have a very unclear lifecycle for the chatwidget—this should only have to be added in one place! but this fixes the "hanging commands" issue where the active_exec_cell wasn't correctly cleared when commands finished. To repro w/o this PR: 1. prompt "run sleep 10" 2. once the command starts running, press <kbd>Esc</kbd> 3. prompt "run echo hi" Expected: ``` ✓ Completed └ ⌨️ echo hi codex hi ``` Actual: ``` ⚙︎ Working └ ⌨️ echo hi ▌ Ask Codex to do anything ``` i.e. the "Working" never changes to "Completed". The bug is fixed with this PR.
This commit is contained in:
@@ -182,6 +182,7 @@ impl ChatWidget<'_> {
|
||||
}
|
||||
// Mark task stopped and request redraw now that all content is in history.
|
||||
self.bottom_pane.set_task_running(false);
|
||||
self.running_commands.clear();
|
||||
self.mark_needs_redraw();
|
||||
}
|
||||
|
||||
@@ -198,6 +199,7 @@ impl ChatWidget<'_> {
|
||||
fn on_error(&mut self, message: String) {
|
||||
self.add_to_history(&history_cell::new_error_event(message));
|
||||
self.bottom_pane.set_task_running(false);
|
||||
self.running_commands.clear();
|
||||
self.stream.clear_all();
|
||||
self.mark_needs_redraw();
|
||||
}
|
||||
@@ -473,6 +475,7 @@ impl ChatWidget<'_> {
|
||||
fn interrupt_running_task(&mut self) {
|
||||
if self.bottom_pane.is_task_running() {
|
||||
self.active_exec_cell = None;
|
||||
self.running_commands.clear();
|
||||
self.bottom_pane.clear_ctrl_c_quit_hint();
|
||||
self.submit_op(Op::Interrupt);
|
||||
self.bottom_pane.set_task_running(false);
|
||||
|
||||
Reference in New Issue
Block a user