{"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":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":2103,"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":2085,"sourceCodeEnd":2121,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/tui/src/automation_manager.rs#L2085-L2121","documentation":"After confirming the dispatch belongs to the current task store, the library checks that the dispatch's execution_scope equals the task manager's execution scope. A mismatch means the admission's execution ownership is either unverified or belongs to a different Runtime instance, so the bound task cannot safely be dispatched here. This is the per-dispatch ownership check complementing the store-path check.","triggerScenarios":"Calling dispatch_bound_task where dispatch.execution_scope.as_deref() != Some(tasks.execution_scope()) — the scope is None (never verified) or names another Runtime's scope.","commonSituations":"Two Runtime processes sharing a data directory but with different execution scopes; a dispatch record copied from another environment; a legacy record with execution_scope stripped or unset; misconfigured scope in the Runtime that produced the admission.","solutions":["Ensure the Runtime that replays the dispatch is configured with the same execution_scope that admitted it","Re-admit the automation in the current Runtime so a matching scope is recorded","Fix the Runtime's execution-scope configuration if it was changed after the admission was created","Reject/discard foreign dispatch records rather than forcing dispatch"],"exampleFix":"// before\n// runtime scope changed after admission\ndispatch_bound_task(&mut dispatch, &task_id, &tasks).await?;\n// after\nassert_eq!(dispatch.execution_scope.as_deref(), Some(tasks.execution_scope()));\ndispatch_bound_task(&mut dispatch, &task_id, &tasks).await?;","handlingStrategy":"validation","validationCode":"if dispatch.execution_scope.as_deref() != Some(tasks.execution_scope()) {\n    return Err(anyhow!(\"dispatch scope mismatch; cannot dispatch here\"));\n}","typeGuard":"fn owned_by_current(d: &AutomationDispatch, tasks: &SharedTaskManager) -> bool {\n    d.execution_scope.as_deref() == Some(tasks.execution_scope())\n}","tryCatchPattern":null,"preventionTips":["Pin the Runtime's execution scope in config and never change it after admissions exist","Only replay admissions produced by the same Runtime scope","Detect scope drift at startup (compare stored scopes to configured scope) and fail fast","When running multiple Runtimes, partition the data directory per scope"],"tags":["rust","automation","ownership","runtime"],"backgroundTag":"permission-denied","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}