Hmbown/CodeWhale · warning
worker record
Error message
worker record
What it means
Test assertion `manager.get_worker_record(&agent_id).expect("worker record")` at `crates/tui/src/tools/subagent/tests.rs:6628` in the coordination-interrupt test. After draining completion events, the test expects the cancelled worker's record to still be stored so it can verify terminal event counts. A panic means the record is absent from the manager's store.
Solutions
- Verify the same manager and identical agent_id are used for registration, interrupt, and lookup.
- Check that get_worker_record / the cancel-interrupt path retains records for terminal (Cancelled) workers.
- If terminal pruning is now intended, rewrite the assertion to capture the record before termination instead.
- Log available worker ids on failure to spot id mismatches quickly.
Example fix
// before
let worker = manager.get_worker_record(&agent_id).expect("worker record");
// after
let worker = manager.get_worker_record(&agent_id)
.unwrap_or_else(|| panic!("worker record for {agent_id} missing; known ids: {:?}", manager.worker_ids())); Defensive patterns
Strategy: type-guard
Validate before calling
if manager.get_worker_record(&agent_id).is_none() {
panic!("worker record for {agent_id} absent before terminal assertions");
} Type guard
fn worker_status(m: &SubAgentManager, id: &str) -> Option<AgentWorkerStatus> { m.get_worker_record(id).map(|r| r.status) } Prevention
- Use the same manager instance and id constant across setup, interrupt, and lookup.
- Retain terminal worker records; if pruning is added, update inspecting tests in the same commit.
- Include known worker ids in the failure message.
When it happens
Trigger: get_worker_record returns None because the record was removed on termination, the manager instance is not the one that owned the agent, or the agent id used for lookup differs from the one registered.
Common situations: Lifecycle refactors that prune terminal workers from the record map; switching the manager's backing store or path so the lookup hits a different instance; copy-paste of agent ids between tests.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- worker record remains inspectable
- first coordination interrupt
- first Stop
- agent should stay registered
- first timed-out API attempt should reach the test server
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/8e7022bbf516e374.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/tools/subagent/tests.rs:6628
envelope.message,
MailboxMessage::Completed { .. }
| MailboxMessage::Failed { .. }
| MailboxMessage::Interrupted { .. }
| MailboxMessage::Cancelled { .. }
)
})
.collect::<Vec<_>>();
assert_eq!(terminal_mail.len(), 1);
assert!(matches!(
terminal_mail[0].message,
MailboxMessage::Cancelled { ref agent_id } if agent_id == "agent_model_wait_cancel"
));
let complete_events = std::iter::from_fn(|| event_rx.try_recv().ok())
.filter(|event| matches!(event, Event::AgentComplete { .. }))
.count();
assert_eq!(complete_events, 1);
let worker = manager.get_worker_record(&agent_id).expect("worker record");
assert_eq!(worker.status, AgentWorkerStatus::Cancelled);
assert_eq!(
worker
.events
.iter()
.filter(|event| event.status.is_terminal())
.count(),
1
);
}
#[tokio::test]
async fn coordination_interrupt_fans_in_once_and_preserves_checkpoint() {
use tokio_util::sync::CancellationToken;
let tmp = tempdir().expect("tempdir");
let mut manager = SubAgentManager::new(tmp.path().to_path_buf(), 2);
let agent_id = "agent_coordination_interrupt".to_string();View on GitHub (pinned to 73e0f67d83)