{"record":{"id":"9fb96339ca996945","repo":"astrid-runtime/astrid","slug":"daemon-did-not-return-an-agent-readiness-response","errorCode":null,"errorMessage":"daemon did not return an agent-readiness response","messagePattern":"daemon did not return an agent-readiness response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/doctor.rs","lineNumber":271,"sourceCode":"async fn agent_readiness() -> Result<astrid_core::kernel_api::AgentLoopReadiness> {\n    let mut client = tokio::time::timeout(\n        Duration::from_secs(5),\n        crate::socket_client::connect_kernel_for_workspace(None),\n    )\n    .await\n    .map_err(|_| anyhow::anyhow!(\"connection timed out after 5s\"))??;\n    match tokio::time::timeout(\n        Duration::from_secs(5),\n        client.request(KernelRequest::GetAgentReadiness),\n    )\n    .await\n    .map_err(|_| anyhow::anyhow!(\"daemon response timed out after 5s\"))??\n    {\n        KernelResponse::AgentReadiness(readiness) => Ok(readiness),\n        KernelResponse::Error(msg) => {\n            Err(anyhow::anyhow!(\"daemon rejected readiness query: {msg}\"))\n        },\n        _ => Err(anyhow::anyhow!(\n            \"daemon did not return an agent-readiness response\"\n        )),\n    }\n}\n\nasync fn projection_name_diagnostic(\n    policy: ProjectionNamePolicyPreset,\n) -> Result<ProjectionNameDiagnostic> {\n    let mut client = tokio::time::timeout(\n        Duration::from_secs(5),\n        crate::socket_client::connect_kernel_for_workspace(None),\n    )\n    .await\n    .map_err(|_| anyhow::anyhow!(\"connection timed out after 5s\"))??;\n    tokio::time::timeout(\n        Duration::from_secs(30),\n        client.projection_name_diagnostic(policy),\n    )","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/doctor.rs#L253-L289","documentation":"agent_readiness expects KernelResponse::AgentReadiness or KernelResponse::Error. Any other response variant falls into the catch-all arm and raises this error. The daemon answered within the deadline but with a type that cannot carry readiness data.","triggerScenarios":"A daemon responding to GetAgentReadiness with a variant like Status or Pong — usually a CLI/daemon version skew where the old daemon doesn't know GetAgentReadiness and replies with a generic acknowledgment.","commonSituations":"Mixed-version deployments after upgrading the CLI without restarting/rebuilding the daemon; protocol evolution adding new request types.","solutions":["Restart the daemon to match the CLI's protocol version","Rebuild CLI and daemon together from the same commit","Verify the daemon supports GetAgentReadiness (check its request dispatcher)","Include the received variant name in the error message for easier diagnosis"],"exampleFix":"// before\n_ => Err(anyhow::anyhow!(\"daemon did not return an agent-readiness response\")),\n// after\nother => Err(anyhow::anyhow!(\n    \"daemon did not return an agent-readiness response (got {other:?}) — CLI/daemon version mismatch?\"\n)),","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"fn as_agent_readiness(resp: &KernelResponse) -> Option<&astrid_core::kernel_api::AgentLoopReadiness> {\n    match resp {\n        KernelResponse::AgentReadiness(r) => Some(r),\n        _ => None,\n    }\n}","tryCatchPattern":"match agent_readiness().await {\n    Err(e) if e.to_string().contains(\"agent-readiness response\") => {\n        // CLI/daemon version skew: restart daemon and retry\n        restart_daemon().await?;\n        agent_readiness().await?;\n    }\n    other => other?,\n}","preventionTips":["Always rebuild and restart daemon together with the CLI","Add a version/feature handshake before issuing new request types","Log the unexpected variant in the catch-all error arm"],"tags":["daemon","ipc","protocol-mismatch","readiness"],"backgroundTag":"unexpected-response-shape","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}