diff options
| author | akbash <akbash@herdr.dev> | 2026-08-14 01:22:46 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-14 01:22:46 +0300 |
| commit | 9351b058f34973016a5d5973297d0567513e67a4 (patch) | |
| tree | 6b31e2700258170685297e08c03084e21d459e44 /tests | |
| parent | 2075de5db083f1d1f4a9c67f6b36a8eeb250754e (diff) | |
fix: reject prompts to blocked agents (#2790)
* fix: reject prompts to blocked agents
refs #2788
* docs: clarify agent prompt timing
refs #2788
---------
Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/cli/agents.rs | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/cli/agents.rs b/tests/cli/agents.rs index f5affc87..3164b802 100644 --- a/tests/cli/agents.rs +++ b/tests/cli/agents.rs @@ -326,6 +326,61 @@ fn agent_start_command_works() { let after = run_cli_json(&socket_path, &["pane", "list"]); assert_eq!(pane_topology_snapshot(&after), before_topology); + let prompts_before_blocked = fs::read(&captured_prompts).unwrap(); + let blocked_report = run_cli( + &socket_path, + &[ + "pane", + "report-agent", + &pane_id, + "--source", + "custom:fake-pi", + "--agent", + "pi", + "--state", + "blocked", + ], + ); + assert!(blocked_report.status.success()); + assert_eq!( + run_cli_json(&socket_path, &["agent", "get", "main"])["result"]["agent"]["agent_status"], + "blocked" + ); + + let blocked_prompt = run_cli( + &socket_path, + &[ + "agent", + "prompt", + "main", + "must not be submitted", + "--wait", + "--timeout", + "2000", + ], + ); + assert_eq!(blocked_prompt.status.code(), Some(1)); + let blocked_prompt: serde_json::Value = serde_json::from_slice(&blocked_prompt.stderr).unwrap(); + assert_eq!(blocked_prompt["error"]["code"], "agent_blocked"); + thread::sleep(Duration::from_millis(400)); + assert_eq!(fs::read(&captured_prompts).unwrap(), prompts_before_blocked); + + let idle_report = run_cli( + &socket_path, + &[ + "pane", + "report-agent", + &pane_id, + "--source", + "custom:fake-pi", + "--agent", + "pi", + "--state", + "idle", + ], + ); + assert!(idle_report.status.success()); + let stale_idle = run_cli( &socket_path, &[ |
