{"record":{"id":"5cde7e36d231a36c","repo":"Hmbown/CodeWhale","slug":"automation-admission-execution-ownership-is-unverified-or","errorCode":null,"errorMessage":"Automation admission execution ownership is unverified or belongs to another Runtime","messagePattern":"Automation admission execution ownership is unverified or belongs to another Runtime","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":2119,"sourceCode":"    });\n    Ok(())\n}\n\nfn check_dispatch_store(dispatch: &AutomationDispatch, tasks: &SharedTaskManager) -> Result<()> {\n    if tasks.data_dir().canonicalize()? != dispatch.task_data_dir.canonicalize()? {\n        bail!(\"Automation admission belongs to a different task store; it cannot be replayed here\");\n    }\n    Ok(())\n}\n\nasync fn dispatch_bound_task(\n    dispatch: &mut AutomationDispatch,\n    task_id: &str,\n    tasks: &SharedTaskManager,\n) -> Result<crate::task_manager::TaskRecord> {\n    check_dispatch_store(dispatch, tasks)?;\n    if dispatch.execution_scope.as_deref() != Some(tasks.execution_scope()) {\n        bail!(\n            \"Automation admission execution ownership is unverified or belongs to another Runtime\"\n        );\n    }\n    let task = if dispatch.accepted {\n        tasks\n            .read_bound_task(task_id)?\n            .context(\"Accepted automation task is missing; refusing to replay it\")?\n    } else {\n        tasks\n            .recover_task_admission(dispatch.request.clone(), task_id.to_owned())\n            .await?\n    };\n    crate::task_manager::validate_bound_task_request(&task, &dispatch.request)?;\n    dispatch.accepted = true;\n    dispatch.suppress_report = dispatch.delivery_mode == AutomationDeliveryMode::Watcher\n        && task.status == TaskStatus::Completed\n        && task\n            .result_summary","sourceCodeStart":2101,"sourceCodeEnd":2137,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/automation_manager.rs#L2101-L2137","documentation":"After the task store matches, dispatch_bound_task checks that the dispatch's execution_scope equals the SharedTaskManager's execution_scope(). This proves the dispatch was claimed by (and its task is owned by) the current Runtime. A missing or mismatched scope means ownership is unverified or the dispatch belongs to another Runtime, so executing it here could run a task owned elsewhere.","triggerScenarios":"dispatch_bound_task called when dispatch.execution_scope is None, or differs from the string returned by tasks.execution_scope() — e.g. a dispatch persisted by Runtime A being replayed inside Runtime B, or a hand-built dispatch without a scope set.","commonSituations":"Running multiple Runtime instances (dev + prod) sharing one data dir; replaying serialized dispatches across sessions; older persisted automation records written before execution_scope existed.","solutions":["Replay the dispatch inside the Runtime whose execution_scope matches dispatch.execution_scope.","If this Runtime should own it, re-claim/re-admit the automation in this Runtime so a fresh dispatch with the correct scope is created.","Regenerate or migrate the dispatch record so execution_scope is populated with tasks.execution_scope()."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if dispatch.execution_scope.as_deref() != Some(tasks.execution_scope()) {\n    // not owned by this Runtime; re-admit instead of replaying\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = dispatch_bound_task(&mut dispatch, task_id, &tasks).await {\n    if e.to_string().contains(\"execution ownership\") {\n        re_admit_in_current_runtime(&tasks).await?;\n    } else { return Err(e); }\n}","preventionTips":["Only replay dispatches obtained from the same Runtime instance.","Persist execution_scope with every dispatch and treat scope mismatches as re-admission, not errors to work around.","Avoid sharing one data directory between concurrently running Runtimes."],"tags":["automation","ownership","runtime"],"backgroundTag":"invalid-state-transition","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}