mirror of
https://github.com/openai/codex.git
synced 2026-10-23 18:08:45 +00:00
## Why A subagent stopped by repeated Guardian denials remained interrupted without notifying its parent. The parent needs guidance to report the stop and wait for explicit user confirmation before continuing the blocked work. ## What changed Forward `TooManyDenials` interruptions from `MultiAgentV2` children to their parents with Guardian-specific guidance to inform the user and avoid resuming or retrying until the user explicitly confirms. Preserve the child's `Interrupted` status and keep ordinary interruptions silent. ## Testing Add integration coverage for parent notifications under `CircuitBreakAction::Strict`, silence under `CircuitBreakAction::Default`, and preservation of the child's interrupted status. Add a unit test ensuring long denial messages stay within the notification token limit while retaining the guidance. GitOrigin-RevId: c9bb90827393068d9c92edaf0443a52e6ff57f9f
35 lines
1.2 KiB
Rust
35 lines
1.2 KiB
Rust
use codex_protocol::AgentPath;
|
|
use codex_protocol::protocol::AgentStatus;
|
|
use codex_utils_output_truncation::approx_token_count;
|
|
|
|
use super::COMPLETION_MESSAGE_MAX_TOKENS;
|
|
use super::ERROR_NEXT_ACTION;
|
|
use super::GUARDIAN_NEXT_ACTION;
|
|
use super::format_guardian_interruption_message;
|
|
use super::format_inter_agent_completion_message;
|
|
|
|
#[test]
|
|
fn error_completion_message_stays_below_manual_review_threshold() {
|
|
let message = format_inter_agent_completion_message(
|
|
AgentPath::root(),
|
|
AgentPath::try_from("/root/worker").expect("valid agent path"),
|
|
&AgentStatus::Errored("stream disconnected ".repeat(1_000)),
|
|
)
|
|
.expect("error status should produce a completion message");
|
|
|
|
assert!(approx_token_count(&message) < COMPLETION_MESSAGE_MAX_TOKENS);
|
|
assert!(message.contains(ERROR_NEXT_ACTION));
|
|
}
|
|
|
|
#[test]
|
|
fn guardian_interruption_message_stays_below_manual_review_threshold() {
|
|
let message = format_guardian_interruption_message(
|
|
AgentPath::root(),
|
|
AgentPath::try_from("/root/worker").expect("valid agent path"),
|
|
&"Action is not authorized. ".repeat(1_000),
|
|
);
|
|
|
|
assert!(approx_token_count(&message) < COMPLETION_MESSAGE_MAX_TOKENS);
|
|
assert!(message.contains(GUARDIAN_NEXT_ACTION));
|
|
}
|