diff options
| author | JJ Liebig <jonathan.liebig@gmail.com> | 2026-08-11 02:24:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-11 03:24:02 +0300 |
| commit | 7ae4b056a0ca478e584fa282c45b528134cc80c9 (patch) | |
| tree | 5eb8da51353327f2bb1b7ef35f76cafe9b471dee /src/cli | |
| parent | 350f001320ec4a119f09c38157973126962a6121 (diff) | |
fix: wait for agent prompt readiness (#2537)
* fix: wait for agent prompt readiness
refs #2410
* fix: return pane updates after tab bar command
refs #2410
---------
Co-authored-by: Can Celik <ogulcancelik@gmail.com>
Diffstat (limited to 'src/cli')
| -rw-r--r-- | src/cli/agent.rs | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/cli/agent.rs b/src/cli/agent.rs index e1271f48..362c9ab1 100644 --- a/src/cli/agent.rs +++ b/src/cli/agent.rs @@ -543,16 +543,26 @@ fn wait_for_named_agent( ))) } else if agent["name"].as_str() != Some(name) { Some(Err(agent_name_lost_error("cli:agent:start", name))) - } else if agent["interactive_ready"].as_bool().unwrap_or(false) { - Some(Ok(agent.clone())) - } else if !agent["launch_pending"].as_bool().unwrap_or(false) { - Some(Err(cli_agent_error( - "cli:agent:start", - "agent_start_failed", - "agent process exited before becoming interactive", - ))) } else { - None + match agent["agent_status"].as_str() { + Some("blocked") => Some(Err(cli_agent_error( + "cli:agent:start", + "agent_not_ready", + format!("agent {name} is blocked during startup and is not ready for prompts"), + ))), + Some("working" | "unknown") => None, + Some("idle" | "done") if agent["interactive_ready"].as_bool() == Some(true) => { + Some(Ok(agent.clone())) + } + Some("idle" | "done") if !agent["launch_pending"].as_bool().unwrap_or(false) => { + Some(Err(cli_agent_error( + "cli:agent:start", + "agent_start_failed", + "agent process exited before becoming interactive", + ))) + } + _ => None, + } }; if let Some(outcome) = outcome { return Ok(outcome); |
