{"record":{"id":"d54c3bf9a0a7311d","repo":"Hmbown/CodeWhale","slug":"needs-input-should-be-projected","errorCode":null,"errorMessage":"needs_input should be projected","messagePattern":"needs_input should be projected","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/subagent/tests.rs","lineNumber":9062,"sourceCode":"    );\n    assert!(interrupted.needs_input.is_some());\n\n    let ctx = runtime.context.clone();\n    let worker_record = {\n        let manager = manager.read().await;\n        manager.get_worker_record(&agent_id)\n    };\n    let projection =\n        subagent_session_projection(interrupted.clone(), false, &ctx, worker_record).await;\n    assert_eq!(projection.status, \"waiting_for_user\");\n    assert!(projection.continuable);\n    assert!(projection.needs_continuation);\n    assert!(projection.checkpoint.is_some());\n    assert!(\n        projection\n            .needs_input\n            .as_ref()\n            .expect(\"needs_input should be projected\")\n            .question\n            .contains(\"Re-dispatch this worker\"),\n        \"projection should tell the parent how to wake/re-dispatch: {:?}\",\n        projection.needs_input\n    );\n    assert_eq!(\n        projection\n            .worker_record\n            .as_ref()\n            .expect(\"worker record\")\n            .status,\n        AgentWorkerStatus::WaitingForUser\n    );\n    assert_eq!(\n        projection\n            .worker_record\n            .as_ref()\n            .expect(\"worker record\")","sourceCodeStart":9044,"sourceCodeEnd":9080,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/tui/src/tools/subagent/tests.rs#L9044-L9080","documentation":"Panic from `.expect(\"needs_input should be projected\")`: the projection built for the parent has `needs_input: None`. The projection must translate the interrupted checkpoint into a NeedsInput question telling the parent to 'Re-dispatch this worker'; without it the parent cannot wake the worker.","triggerScenarios":"Building the projection from an Interrupted result with an api_timeout checkpoint when the needs_input synthesis step is skipped, the checkpoint reason isn't recognized, or projection.needs_continuation is false so no question is generated.","commonSituations":"Projection code only maps user-checkpoints to needs_input and misses api_timeout; question template changed so the contains(\"Re-dispatch this worker\") assert also fails; checkpoint omitted from projection input.","solutions":["Ensure projection synthesizes needs_input whenever checkpoint.continuable and needs_continuation are true","Check the api_timeout reason is handled in the question template selection","Verify the question text still includes \"Re-dispatch this worker\"","Log the projection fields on failure to see which precondition was false"],"exampleFix":"// before\n.expect(\"needs_input should be projected\")\n// after\n.unwrap_or_else(|| panic!(\"projection missing needs_input; continuation={} ckpt={}\",\n    projection.needs_continuation, projection.checkpoint.is_some()))","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"fn has_redispatch_question(p: &Projection) -> bool {\n    p.needs_input.as_ref().map_or(false, |n| n.question.contains(\"Re-dispatch this worker\"))\n}","tryCatchPattern":"let needs = projection.needs_input.as_ref()\n    .unwrap_or_else(|| panic!(\"no needs_input projected for continuable checkpoint\"));","preventionTips":["Drive needs_input synthesis from checkpoint presence, not from specific reasons","Keep wake/re-dispatch wording in a shared constant used by both code and tests","Cover api_timeout checkpoints in projection unit tests"],"tags":["rust","subagent","projection","needs-input"],"backgroundTag":"unexpected-response-shape","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}