Hmbown/CodeWhale · error
repeated coordination interrupt
Error message
repeated coordination interrupt
What it means
This is a test panic from `Option::expect`/`Result::expect`: `interrupt_child` returned None/Err on the second call, so the test asserting that repeated coordination interrupts from the same parent succeed never got a value. The library throws expect panics like this when an internal manager API that the test contract requires to succeed does not.
Solutions
- Ensure `interrupt_child` is idempotent: a repeated interrupt on an already-Interrupted agent returns the same checkpoint rather than failing.
- Check that the agent_id was inserted into `manager.agents` before the first interrupt and was not removed by the first interrupt.
- Run the failing test to inspect which call returned None/Err and diff against recent changes in the interrupt implementation.
Example fix
// before: second call errors on already-interrupted agent
// after: idempotent interrupt in manager
if matches!(self.agents.get(id).map(|a| &a.status), Some(SubAgentStatus::Interrupted(_))) {
return self.last_interrupt_checkpoint(id).ok_or_else(|| anyhow!("unknown agent"));
} Defensive patterns
Strategy: try-catch
Validate before calling
// before calling assert!(manager.agents.contains_key(&agent_id), "agent must exist before interrupt");
Type guard
fn is_interrupted(s: &SubAgentStatus) -> bool { matches!(s, SubAgentStatus::Interrupted(_)) } Try / catch
match manager.interrupt_child(&agent_id, Some("agent_parent"), reason.clone()) {
Ok(cp) => cp,
Err(e) => panic!("repeated coordination interrupt failed: {e:#}"),
} Prevention
- Design interrupt_child to be idempotent for repeated interrupts from the same parent
- Add a unit test for the double-interrupt path whenever status transitions change
- Never remove an agent from the registry as a side effect of interrupt
When it happens
Trigger: Calling `SubAgentManager::interrupt_child(&agent_id, Some("agent_parent"), reason)` a second time for an already-interrupted or non-existent agent, when the implementation fails to treat a repeated interrupt as idempotent.
Common situations: Regression in the subagent manager's interrupt path after refactoring terminal-state transitions; running the subagent test suite in crates/tui/src/tools/subagent/tests.rs after changing status handling so the second interrupt errors instead of returning the same Interrupted checkpoint.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- parent interruption fan-in
- cancel wins race
- cancelled snapshot exists
- Expected Ok for scoped npm package via
- Expected Ok when cwd anchors relative path, got
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/75035539cda40d23.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/tools/subagent/tests.rs:6708
.interrupt_child(&agent_id, Some(caller), "forbidden".into())
.is_err()
);
}
manager.record_worker_event(
&agent_id,
AgentWorkerStatus::RunningTool,
Some("step 2/8: running tool 'read_file'".to_string()),
Some(2),
Some("read_file".to_string()),
);
let reason = "parent rerouted this lane".to_string();
let (prior, first) = manager
.interrupt_child(&agent_id, Some("agent_parent"), reason.clone())
.expect("first coordination interrupt");
let (_, second) = manager
.interrupt_child(&agent_id, Some("agent_parent"), reason.clone())
.expect("repeated coordination interrupt");
assert_eq!(prior.status, SubAgentStatus::Running);
assert!(matches!(
first.status,
SubAgentStatus::Interrupted(ref actual) if actual == &reason
));
assert_eq!(second.status, first.status);
assert_eq!(
first
.checkpoint
.as_ref()
.map(|checkpoint| (checkpoint.reason.as_str(), checkpoint.steps_taken)),
Some(("test_checkpoint", 2))
);
let completion = completion_rx
.try_recv()
.expect("parent interruption fan-in");
assert!(completion.payload.contains(r#""status":"interrupted""#));View on GitHub (pinned to 73e0f67d83)