{"record":{"id":"1c358e71517a0224","repo":"Hmbown/CodeWhale","slug":"runtime-directory-override-conflicts-with-the-saved-session","errorCode":null,"errorMessage":"Runtime directory override conflicts with the saved session's Runtime store","messagePattern":"Runtime directory override conflicts with the saved session's Runtime store","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/runtime_threads.rs","lineNumber":5043,"sourceCode":"    pub fn open_with_plugin_registry(\n        config: Config,\n        workspace: PathBuf,\n        manager_cfg: RuntimeThreadManagerConfig,\n        plugin_registry: Arc<crate::plugins::PluginRegistry>,\n    ) -> Result<Self> {\n        Self::open_inner(config, workspace, manager_cfg, Some(plugin_registry), None)\n    }\n\n    pub(crate) fn open_for_session(\n        config: Config,\n        workspace: PathBuf,\n        mut manager_cfg: RuntimeThreadManagerConfig,\n        plugin_registry: Arc<crate::plugins::PluginRegistry>,\n        binding: Option<&RuntimeStoreBinding>,\n    ) -> Result<Self> {\n        if let Some(binding) = binding {\n            if let Some(override_dir) = runtime_dir_override() {\n                anyhow::ensure!(\n                    checked_runtime_store_root(override_dir)? == binding.data_dir,\n                    \"Runtime directory override conflicts with the saved session's Runtime store\"\n                );\n            }\n            if binding.is_missing_session_store()? {\n                // Never claim the missing owner's scope. A fresh store cannot\n                // execute its queued tasks, approvals, mail or automations.\n                // All recovery attempts for this conversation contend on the\n                // same host lock. Random paths would let two processes mint\n                // competing owners before either saves the repaired binding.\n                manager_cfg.data_dir = manager_cfg\n                    .data_dir\n                    .with_file_name(\"runtime-recovered-session\");\n                return Self::open_inner(\n                    config,\n                    workspace,\n                    manager_cfg,\n                    Some(plugin_registry),","sourceCodeStart":5025,"sourceCodeEnd":5061,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/runtime_threads.rs#L5025-L5061","documentation":"When constructing the runtime thread manager with a saved RuntimeStoreBinding, any runtime_dir_override() (e.g. from an environment variable or CLI flag) must resolve to exactly the store directory recorded in the binding. It throws 'Runtime directory override conflicts with the saved session's Runtime store' when the override's checked root differs from binding.data_dir, preventing the manager from silently reading/writing a different store than the session's.","triggerScenarios":"Starting the manager with Some(binding) while a runtime directory override is set whose checked_runtime_store_root != binding.data_dir — e.g. CODEWHALE-style runtime dir env var pointing elsewhere while resuming a saved session.","commonSituations":"Developer has a runtime-dir env var exported globally but resumes an old session saved under a different directory; switching between dev/prod store directories while reusing a session file; running a second checkout whose default override differs from the session's store.","solutions":["Unset the runtime directory override (env var / flag) so the session's saved data_dir is used.","Point the override at the exact directory recorded in the session binding (the path from the error context).","Delete/regenerate the session binding if you intend to migrate to the override directory as its new store.","Check checked_runtime_store_root's resolution of the override (symlinks/canonicalization can make paths that look equal differ)."],"exampleFix":"// before: override conflicts with saved session\nCODEWHALE_RUNTIME_DIR=/tmp/other-store app --resume session.json\n// after: match the saved store or drop the override\nunset CODEWHALE_RUNTIME_DIR && app --resume session.json","handlingStrategy":"validation","validationCode":"// compare override and binding roots before constructing the manager\nif let (Some(binding), Some(override_dir)) = (binding.as_ref(), runtime_dir_override()) {\n    anyhow::ensure!(\n        checked_runtime_store_root(override_dir)? == binding.data_dir,\n        \"runtime dir override conflicts with saved session store\"\n    );\n}\n","typeGuard":null,"tryCatchPattern":"match RuntimeThreadManager::new(manager_cfg, plugin_registry, binding.as_ref()).await {\n    Ok(m) => m,\n    Err(e) if e.to_string().contains(\"Runtime directory override conflicts\") => {\n        eprintln!(\"dropping override to honor the saved session store\");\n        RuntimeThreadManager::new(manager_cfg, plugin_registry, binding.as_ref()).await?\n    }\n    Err(e) => return Err(e),\n}\n","preventionTips":["Do not export runtime-dir overrides globally in shell profiles if you resume saved sessions.","Canonicalize override paths (checked_runtime_store_root) so symlinks don't create false conflicts.","Treat the session binding as authoritative: change the binding when migrating stores, not just the override.","Document the runtime-dir env var in docs/ENVIRONMENTS.md so users know its effect."],"tags":["configuration","conflict","runtime-store","session"],"backgroundTag":"conflicting-config-options","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"}