{"record":{"id":"b0c7e56dbfeb0056","repo":"Hmbown/CodeWhale","slug":"automation-service-belongs-to-another-runtime-scope","errorCode":null,"errorMessage":"Automation service belongs to another Runtime scope","messagePattern":"Automation service belongs to another Runtime scope","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":1106,"sourceCode":"    }\n\n    #[cfg(test)]\n    pub(crate) fn open_for_test(root: PathBuf) -> Result<Self> {\n        let mut manager = Self::open(root)?;\n        manager.execution_scope = Some(crate::task_manager::test_execution_scope(\"test\"));\n        Ok(manager)\n    }\n\n    pub(crate) fn bind_task_manager(\n        &mut self,\n        tasks: &crate::task_manager::TaskManager,\n    ) -> Result<()> {\n        if self\n            .execution_scope\n            .as_deref()\n            .is_some_and(|scope| scope != tasks.execution_scope())\n        {\n            bail!(\"Automation service belongs to another Runtime scope\");\n        }\n        self.execution_scope = Some(tasks.execution_scope().to_string());\n        Ok(())\n    }\n\n    pub(crate) fn execution_scope(&self) -> Option<&str> {\n        self.execution_scope.as_deref()\n    }\n\n    fn eligible_scope(&self, scope: Option<&str>) -> bool {\n        scope.is_some() && scope == self.execution_scope()\n    }\n\n    /// Explicit control may bind an unbound definition; saved admissions never\n    /// read this field back from the definition during recovery.\n    fn adopt_for_run(&self, automation: &mut AutomationRecord) -> Result<()> {\n        let scope = self\n            .execution_scope()","sourceCodeStart":1088,"sourceCodeEnd":1124,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/automation_manager.rs#L1088-L1124","documentation":"bind_task_manager refuses to attach the automation service to a TaskManager whose execution scope differs from the scope the service was opened with; the bail fires when execution_scope is set and mismatches, preventing automations from running tasks under another Runtime's isolation boundary.","triggerScenarios":"Thrown at crates/tui/src/automation_manager.rs:1106 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not share one AutomationManager across Runtime scopes; open a separate manager per scope.","Rebind the TaskManager whose execution_scope matches the manager's stored execution_scope.","If the manager was created via open_for_test, use a TaskManager bound to the same 'test' scope."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T06:17:15.046Z"}