Revert "Only show Worked for after the final assistant message" (#7884)

Reverts openai/codex#7854
This commit is contained in:
pakrym-oai
2025-12-11 09:11:42 -08:00
committed by GitHub
parent 238ce7dfad
commit bb8fdb20dc
5 changed files with 13 additions and 24 deletions

View File

@@ -4,7 +4,6 @@ use std::collections::VecDeque;
use std::path::PathBuf;
use std::sync::Arc;
use std::time::Duration;
use std::time::Instant;
use codex_app_server_protocol::AuthMode;
use codex_backend_client::Client as BackendClient;
@@ -334,8 +333,6 @@ pub(crate) struct ChatWidget {
feedback: codex_feedback::CodexFeedback,
// Current session rollout path (if known)
current_rollout_path: Option<PathBuf>,
// Current task start time
task_started_at: Option<Instant>,
}
struct UserMessage {
@@ -521,20 +518,17 @@ impl ChatWidget {
self.set_status_header(String::from("Working"));
self.full_reasoning_buffer.clear();
self.reasoning_buffer.clear();
self.task_started_at = Some(Instant::now());
self.request_redraw();
}
fn on_task_complete(&mut self, last_agent_message: Option<String>) {
// If a stream is currently active, finalize it.
self.flush_answer_stream_with_separator();
self.add_final_message_separator();
// 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.suppressed_exec_calls.clear();
self.last_unified_wait = None;
self.task_started_at = None;
self.request_redraw();
// If there is a queued user message, send exactly one now to begin the next turn.
@@ -670,7 +664,6 @@ impl ChatWidget {
self.suppressed_exec_calls.clear();
self.last_unified_wait = None;
self.stream_controller = None;
self.task_started_at = None;
self.maybe_show_pending_rate_limit_prompt();
}
pub(crate) fn get_model_family(&self) -> ModelFamily {
@@ -1014,6 +1007,14 @@ impl ChatWidget {
self.flush_active_cell();
if self.stream_controller.is_none() {
if self.needs_final_message_separator {
let elapsed_seconds = self
.bottom_pane
.status_widget()
.map(super::status_indicator_widget::StatusIndicatorWidget::elapsed_seconds);
self.add_to_history(history_cell::FinalMessageSeparator::new(elapsed_seconds));
self.needs_final_message_separator = false;
}
self.stream_controller = Some(StreamController::new(
self.last_rendered_width.get().map(|w| w.saturating_sub(2)),
));
@@ -1026,16 +1027,6 @@ impl ChatWidget {
self.request_redraw();
}
fn add_final_message_separator(&mut self) {
if self.needs_final_message_separator {
let elapsed_seconds = self
.task_started_at
.map(|start_time| start_time.elapsed().as_secs());
self.add_to_history(history_cell::FinalMessageSeparator::new(elapsed_seconds));
self.needs_final_message_separator = false;
}
}
pub(crate) fn handle_exec_end_now(&mut self, ev: ExecCommandEndEvent) {
let running = self.running_commands.remove(&ev.call_id);
if self.suppressed_exec_calls.remove(&ev.call_id) {
@@ -1339,7 +1330,6 @@ impl ChatWidget {
last_rendered_width: std::cell::Cell::new(None),
feedback,
current_rollout_path: None,
task_started_at: None,
};
widget.prefetch_rate_limits();
@@ -1425,7 +1415,6 @@ impl ChatWidget {
last_rendered_width: std::cell::Cell::new(None),
feedback,
current_rollout_path: None,
task_started_at: None,
};
widget.prefetch_rate_limits();