{"record":{"id":"efaefe8a633ae100","repo":"Hmbown/CodeWhale","slug":"parent-interruption-fan-in","errorCode":null,"errorMessage":"parent interruption fan-in","messagePattern":"parent interruption fan-in","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/subagent/tests.rs","lineNumber":6725,"sourceCode":"        .interrupt_child(&agent_id, Some(\"agent_parent\"), reason.clone())\n        .expect(\"repeated coordination interrupt\");\n    assert_eq!(prior.status, SubAgentStatus::Running);\n    assert!(matches!(\n        first.status,\n        SubAgentStatus::Interrupted(ref actual) if actual == &reason\n    ));\n    assert_eq!(second.status, first.status);\n    assert_eq!(\n        first\n            .checkpoint\n            .as_ref()\n            .map(|checkpoint| (checkpoint.reason.as_str(), checkpoint.steps_taken)),\n        Some((\"test_checkpoint\", 2))\n    );\n\n    let completion = completion_rx\n        .try_recv()\n        .expect(\"parent interruption fan-in\");\n    assert!(completion.payload.contains(r#\"\"status\":\"interrupted\"\"#));\n    assert!(completion.payload.contains(&reason));\n    assert!(completion_rx.try_recv().is_err());\n\n    let terminal_mail = mailbox_rx\n        .drain()\n        .into_iter()\n        .filter(|envelope| {\n            matches!(\n                envelope.message,\n                MailboxMessage::Completed { .. }\n                    | MailboxMessage::Failed { .. }\n                    | MailboxMessage::Interrupted { .. }\n                    | MailboxMessage::Cancelled { .. }\n            )\n        })\n        .collect::<Vec<_>>();\n    assert_eq!(terminal_mail.len(), 1);","sourceCodeStart":6707,"sourceCodeEnd":6743,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/subagent/tests.rs#L6707-L6743","documentation":"Test panic from `try_recv().expect(...)`: the completion channel was empty when the test expected the parent-interruption fan-in to have delivered exactly one completion message. It indicates the interrupted child never sent its terminal completion payload on the channel.","triggerScenarios":"After a parent interrupt fans in, awaiting `completion_rx.try_recv()` when the child's completion event was not emitted (or was emitted with the wrong payload, failing the subsequent `contains` assertions).","commonSituations":"Changes to the subagent event loop dropping the completion emission on interrupt; channel closed or event consumed elsewhere; test racing a spawn that has not yet flushed its terminal event.","solutions":["Verify the interrupt path emits exactly one AgentComplete-style payload containing \"status\":\"interrupted\" and the reason.","Check the completion channel is the one wired to the agent under test and is not drained by another consumer.","Add a short await/poll loop instead of an immediate try_recv if the emission is asynchronous."],"exampleFix":"// before\nlet completion = completion_rx.try_recv().expect(\"parent interruption fan-in\");\n// after\nlet completion = completion_rx.recv().await.expect(\"parent interruption fan-in\");","handlingStrategy":"retry","validationCode":"// precheck: channel still open and agent registered\nassert!(!completion_rx.is_closed(), \"completion channel closed prematurely\");","typeGuard":null,"tryCatchPattern":"let completion = tokio::time::timeout(Duration::from_secs(2), completion_rx.recv())\n    .await\n    .expect(\"timed out\")\n    .expect(\"parent interruption fan-in\");","preventionTips":["Use await/timeout instead of try_recv when the completion is emitted asynchronously","Ensure exactly one consumer drains the completion channel","Assert the interrupt path always emits a terminal completion before returning"],"tags":["test-assertion","subagent","channel","panic"],"backgroundTag":"internal-invariant-violation","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}