{"record":{"id":"a7cb56997cae5df6","repo":"Hmbown/CodeWhale","slug":"fleet-worker-persisted-launch-spec-does-not-mat","errorCode":null,"errorMessage":"Fleet worker {} persisted launch spec does not match the exact task lease and attempt","messagePattern":"Fleet worker (.+?) persisted launch spec does not match the exact task lease and attempt","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/manager.rs","lineNumber":2332,"sourceCode":"            registered.worker_id\n        );\n    }\n\n    // Coordination may append a bounded decision projection to the prompt.\n    // Every identity, route, permission, workspace, scope, and attempt field\n    // must otherwise match a fresh derivation from this exact leased task.\n    let mut registered_identity = registered.clone();\n    let mut expected_identity = expected.clone();\n    registered_identity.objective.clear();\n    expected_identity.objective.clear();\n    if let Some(manifest) = registered_identity.launch_manifest.as_mut() {\n        manifest.prompt.clear();\n    }\n    if let Some(manifest) = expected_identity.launch_manifest.as_mut() {\n        manifest.prompt.clear();\n    }\n    if registered_identity != expected_identity {\n        bail!(\n            \"Fleet worker {} persisted launch spec does not match the exact task lease and attempt\",\n            registered.worker_id\n        );\n    }\n    Ok(())\n}\n\nfn registered_prompt_matches_expected(registered: &str, expected: &str) -> bool {\n    const HEADER: &str = \"Accepted coordination decisions relevant to this child (bounded):\\n\";\n    if registered == expected {\n        return true;\n    }\n    let Some(projection) = registered\n        .strip_prefix(expected)\n        .and_then(|suffix| suffix.strip_prefix(\"\\n\\n\"))\n    else {\n        return false;\n    };","sourceCodeStart":2314,"sourceCodeEnd":2350,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/fleet/manager.rs#L2314-L2350","documentation":"After excluding prompts, every identity field of the registered spec (routes, permissions, workspace, scope, attempt fields) must equal a fresh derivation from the exact leased task. Inequality means the durable launch spec corresponds to a different lease/attempt or configuration than the one being validated, so the relaunch is rejected to prevent running with stale or foreign settings.","triggerScenarios":"Relaunching a worker whose registered spec was prepared for a previous attempt or a different task lease; configuration (model route, permissions, workspace) changed between registration and relaunch; ledger/coordination records restored from different points in time.","commonSituations":"Changing fleet exec config or profile settings and then restarting workers created under the old settings; resuming after a crash where only one of ledger/coordination state was flushed.","solutions":["Cancel the affected worker's task and let a new lease+spec pair be created under current config","Keep fleet configuration constant for the lifetime of a run; apply changes to new runs","Restore ledger and coordination state together, never separately","Reproducible on fresh runs with stable config: file a bug with both spec dumps"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"match validate_registered_launch_spec(&record.spec, &expected) {\n    Ok(()) => Ok(()),\n    Err(err) if err.to_string().contains(\"does not match the exact task lease and attempt\") => {\n        // stale spec for another lease/attempt: re-lease the task\n        Err(err)\n    }\n    Err(err) => Err(err),\n}","preventionTips":["Change fleet exec config, model routes, and permissions only between runs","Restore ledger and coordination state together, never one without the other"],"tags":["fleet","spec-integrity","state-validation","rust","codewhale"],"backgroundTag":"persisted-state-divergence","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}