{"record":{"id":"383bce5c3a14da51","repo":"Hmbown/CodeWhale","slug":"checkpoint-continuation-requires-a-source-agent","errorCode":null,"errorMessage":"Checkpoint continuation requires a source agent","messagePattern":"Checkpoint continuation requires a source agent","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/subagent/mod.rs","lineNumber":6949,"sourceCode":"            .as_deref()\n            .and_then(|id| self.worker_records.get(id))\n            .and_then(|record| record.spec.runtime_profile.wall_deadline_ms);\n        let deadline_ms =\n            narrow_optional_limit(runtime.worker_profile.wall_deadline_ms, source_deadline)\n                .map_or(requested_deadline, |deadline| {\n                    deadline.min(requested_deadline)\n                });\n        if deadline_ms <= now_ms {\n            return Err(anyhow!(\n                \"child wall-time budget exhausted; continuation cannot reset its deadline\"\n            ));\n        }\n        let wall_time = Duration::from_millis(deadline_ms - now_ms);\n        let continuation_from = if options.checkpoint_continuation {\n            let source = options\n                .resume_from_agent_id\n                .as_deref()\n                .ok_or_else(|| anyhow!(\"Checkpoint continuation requires a source agent\"))?;\n            let source =\n                self.resolve_agent_ref_for_session(&runtime.context.state_namespace, source)?;\n            if self.resume_targets.contains_key(&source) {\n                return Err(anyhow!(\n                    \"Source already has a continuation; address it with followup\"\n                ));\n            }\n            Some(source)\n        } else {\n            None\n        };\n\n        if let Some(model) = options.model.as_deref() {\n            runtime.model = model.to_string();\n        }\n        let effective_model = runtime.model.clone();\n        let agent_id = format!(\"agent_{}\", &Uuid::new_v4().to_string()[..8]);\n        // Admission into the turn-owned barrier happens before worker records,","sourceCodeStart":6931,"sourceCodeEnd":6967,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/subagent/mod.rs#L6931-L6967","documentation":"The sub-agent launcher refuses a checkpoint continuation when `checkpoint_continuation` is set but `resume_from_agent_id` is absent. A continuation must know which prior agent to resume from, so the library treats a missing source as an invalid request and fails before any child process is spawned. This is a validation guard inside the agent-spawn path, not a runtime fault.","triggerScenarios":"Calling the sub-agent spawn API with options.checkpoint_continuation = true while options.resume_from_agent_id is None/unset. No other combination triggers it.","commonSituations":"Model or caller code enables the checkpoint-continuation flag after copying option defaults, but forgets to carry over the source agent id from the prior spawn; tool-argument schemas that allow the flag and the id independently so one can be set without the other.","solutions":["Pass the source agent: set options.resume_from_agent_id to the agent_id (or session name) of the agent being continued.","If you did not intend a continuation, set options.checkpoint_continuation = false instead of leaving the id unset.","If the source id was lost, look it up first via the sub-agent listing/status tool and retry with a valid id."],"exampleFix":"// before\nlet opts = AgentSpawnOptions { checkpoint_continuation: true, ..Default::default() };\n// after\nlet opts = AgentSpawnOptions {\n    checkpoint_continuation: true,\n    resume_from_agent_id: Some(source_agent_id.to_string()),\n    ..Default::default()\n};","handlingStrategy":"validation","validationCode":"if (options.checkpointContinuation && !options.resumeFromAgentId) {\n  throw new Error(\"checkpoint_continuation requires resume_from_agent_id\");\n}","typeGuard":"function hasResumeSource(o) {\n  return !(o.checkpointContinuation === true) || typeof o.resumeFromAgentId === \"string\" && o.resumeFromAgentId.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Treat checkpoint_continuation and resume_from_agent_id as one atomic pair; set them together in a single constructor/helper.","Default checkpoint_continuation to false unless a source id is already in hand."],"tags":["subagent","validation","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T16:17:23.217Z"}