Hmbown/CodeWhale · error · anyhow::Error
Automation belongs to another Runtime execution scope
Error message
Automation belongs to another Runtime execution scope
What it means
adopt_for_run requires the manager to have a verified execution ownership scope before adopting an unbound automation for a run; the bail fires when execution_scope is None, meaning runtime ownership of the definition could not be proven, so the run is refused rather than executed under unknown ownership.
Solutions
- Ensure adopt_for_run is only reached when the manager's execution_scope was set (not None) at bind time.
- Re-open the AutomationManager under the Runtime that owns the automation so the scope is present before adoption.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/tui/src/automation_manager.rs:1128 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/6cc33d56f78768e7.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/automation_manager.rs:1128
}
pub(crate) fn execution_scope(&self) -> Option<&str> {
self.execution_scope.as_deref()
}
fn eligible_scope(&self, scope: Option<&str>) -> bool {
scope.is_some() && scope == self.execution_scope()
}
/// Explicit control may bind an unbound definition; saved admissions never
/// read this field back from the definition during recovery.
fn adopt_for_run(&self, automation: &mut AutomationRecord) -> Result<()> {
let scope = self
.execution_scope()
.context("Automation execution ownership is unverified")?;
if let Some(bound) = &automation.execution_scope {
if bound != scope {
bail!("Automation belongs to another Runtime execution scope");
}
} else {
automation.execution_scope = Some(scope.to_string());
automation.schema_version = CURRENT_AUTOMATION_SCHEMA_VERSION;
automation.updated_at = Utc::now();
if automation.status == AutomationStatus::Active {
let schedule = AutomationSchedule::parse_rrule(&automation.rrule)?;
automation.next_run_at =
match schedule.next_after_with_anchor(Utc::now(), automation.created_at) {
Ok(next) => Some(next),
Err(_) if matches!(schedule, AutomationSchedule::Once { .. }) => {
automation.status = AutomationStatus::Paused;
None
}
Err(error) => return Err(error),
};
}
self.save_automation_unlocked(automation)?;View on GitHub (pinned to 73e0f67d83)