Hmbown/CodeWhale · error
Operate keepalive belongs to another Runtime execution scope
Error message
Operate keepalive belongs to another Runtime execution scope
What it means
keepalive_readiness checks the persisted Operate keepalive automation record's execution_scope against the current manager scope. If the keepalive record was created under a different Runtime execution scope (workspace/session), the library refuses to read or reuse it rather than acting on automation owned elsewhere.
Solutions
- Clear or re-create the operate keepalive automation record in the current scope
- Run the operate mode from the execution scope that created the keepalive
- Remove the stale execution_scope value (or the whole record) so it is re-bound to the current scope on next use
Defensive patterns
Strategy: try-catch
Validate before calling
let scope_ok = manager.lookup(OPERATE_KEEPALIVE_ID).and_then(|r| r.execution_scope).map(|s| Some(&s) == manager.execution_scope().as_deref().map(|x| x).as_ref()).unwrap_or(true);
Type guard
fn scope_matches(record: Option<&AutomationRecord>, scope: Option<&str>) -> bool { record.and_then(|r| r.execution_scope.as_deref()).map_or(true, |s| Some(s) == scope) } Try / catch
match keepalive_readiness(...) { Err(e) if e.to_string().contains("another Runtime execution scope") => { manager.remove_automation(OPERATE_KEEPALIVE_ID); rebind_keepalive(); } other => other?, } Prevention
- Clear keepalive records when switching workspace/scope
- Store automation state per scope, not in shared paths
- Log scope identity at record creation to ease diagnosis
When it happens
Trigger: Reading keepalive readiness when the stored OPERATE_KEEPALIVE_ID record has an execution_scope that no longer matches manager.execution_scope() — typically after switching workspaces, restoring a different session, or moving the config between scopes.
Common situations: Resuming the TUI in a different workspace or profile where an old keepalive record survives in shared automation state; copying automation state between machines/containers; scope identity changed after a Runtime upgrade.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- A cancelled Operation cannot be edited.
- Automation admission belongs to a different task store; it…
- Automation admission execution ownership is unverified or…
- Automation name is required
- Automation prompt is required
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/9aa007b5da9b8dea.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/operate.rs:727
let credentials = crate::config::has_api_key_for(&route.config, route.identity.provider);
Ok((route.identity, route.model, credentials))
}
/// Inspect the same saved route used by the scheduler. Credential presence is
/// a local readiness observation, not proof of provider execution.
pub(crate) fn keepalive_readiness(
manager: &AutomationManager,
config: &crate::config::Config,
selection: Option<(&crate::config::ProviderIdentity, &str)>,
) -> Result<(String, bool)> {
let mut readiness = (String::new(), false);
manager.edit_automation(OPERATE_KEEPALIVE_ID, |current| {
if current
.as_ref()
.and_then(|record| record.execution_scope.as_deref())
.is_some_and(|scope| Some(scope) != manager.execution_scope())
{
bail!("Operate keepalive belongs to another Runtime execution scope");
}
let (_, model, credentials) = keepalive_route(config, current.as_ref(), selection)?;
readiness = (model, credentials);
Ok(None)
})?;
Ok(readiness)
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AutoMergeRequest<'a> {
pub pr: &'a str,
pub role: &'a str,
pub repo: &'a str,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum AutoMergeDecision {
Allow,View on GitHub (pinned to 73e0f67d83)