aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorJJ Liebig <jonathan.liebig@gmail.com>2026-09-24 02:23:42 +0200
committerGitHub <noreply@github.com>2026-09-24 02:23:42 +0200
commit9c96f7ddb3be2cc575a159d4d1f1d49fb10d7006 (patch)
tree182e89183981160397af301c075ab11316b15850 /src/app
parent21fd121a63db53ff44b947bbe38c47bbf35e632c (diff)
fix: avoid inferring codex idle from terminal output (#4563)
refs #4507
Diffstat (limited to 'src/app')
-rw-r--r--src/app/actions.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/app/actions.rs b/src/app/actions.rs
index e1bedd26..26bdf0e4 100644
--- a/src/app/actions.rs
+++ b/src/app/actions.rs
@@ -1442,6 +1442,12 @@ impl AppState {
})
.into_iter()
.collect(),
+ AppEvent::CodexPromptObserved { pane_id, ready } => self
+ .update_terminal_state(pane_id, |terminal| {
+ terminal.observe_codex_prompt_ready(ready)
+ })
+ .into_iter()
+ .collect(),
AppEvent::StateChanged {
pane_id,
agent,
@@ -3124,6 +3130,42 @@ mod tests {
}
#[test]
+ fn codex_prompt_observation_changes_readiness_without_completing_a_turn() {
+ let mut app = app_with_workspaces(&["active", "background"]);
+ let pane_id = app.workspaces[1].tabs[0].root_pane;
+ let terminal_id = app.workspaces[1].panes[&pane_id]
+ .attached_terminal_id
+ .clone();
+ app.terminals
+ .get_mut(&terminal_id)
+ .unwrap()
+ .begin_managed_agent(
+ "reviewer".into(),
+ Agent::Codex,
+ Instant::now(),
+ std::time::Duration::ZERO,
+ std::time::Duration::from_secs(60),
+ );
+ app.handle_app_event(AppEvent::StateChanged {
+ pane_id,
+ agent: Some(Agent::Codex),
+ state: AgentState::Unknown,
+ visible_blocker: false,
+ visible_working: false,
+ process_exited: false,
+ observed_at: Instant::now(),
+ });
+ app.handle_app_event(AppEvent::CodexPromptObserved {
+ pane_id,
+ ready: true,
+ });
+ let terminal = &app.terminals[&terminal_id];
+ assert!(terminal.managed_agent_interactive_ready());
+ assert_eq!(terminal.state, AgentState::Unknown);
+ assert!(terminal.last_agent_completion_seq.is_none());
+ }
+
+ #[test]
fn completion_guard_same_state_agent_replacement_clears_old_work() {
let mut app = app_with_workspaces(&["active", "background"]);
app.active = Some(0);