{"record":{"id":"4523abaa7cad44f2","repo":"Hmbown/CodeWhale","slug":"session-session-id-is-open-in-an-interactive-c","errorCode":null,"errorMessage":"session '{session_id}' is open in an interactive Codewhale session; change it there instead — an external write would be reverted by its next autosave","messagePattern":"session '(.+?)' is open in an interactive Codewhale session; change it there instead — an external write would be reverted by its next autosave","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/session_manager.rs","lineNumber":281,"sourceCode":"}\n\n/// Is this session currently owned by **this process's** interactive surface?\n///\n/// The registry is process-local. Reclamation must not treat a missing entry\n/// here as proof that no other Codewhale process still owns the directory.\n#[must_use]\npub fn is_live_session(session_id: &str) -> bool {\n    live_sessions()\n        .read()\n        .is_ok_and(|live| live.contains(session_id))\n}\n\n/// The error an external writer gets when the session is live.\n///\n/// `ResourceBusy` so callers can map it to a typed conflict rather than\n/// pattern-matching on a message.\nfn live_session_conflict(session_id: &str) -> std::io::Error {\n    std::io::Error::new(\n        std::io::ErrorKind::ResourceBusy,\n        format!(\n            \"session '{session_id}' is open in an interactive Codewhale session; \\\n             change it there instead — an external write would be reverted by its next autosave\"\n        ),\n    )\n}\n\n/// File-name stem of the sidecar mapping session ids to the session\n/// instance (process boot) that created their persisted record. Lives in\n/// the sessions directory next to the `<id>.json` records it describes.\nconst SESSION_BOOT_OWNERS_STEM: &str = \"session_boot_owners\";\n\nstatic SESSION_BOOT_ID: std::sync::OnceLock<String> = std::sync::OnceLock::new();\n\n/// Identity of this running session instance (one per process boot).\n///\n/// Mirrors the `SubAgentManager` boot id from #405: persisted records are","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/session_manager.rs#L263-L299","documentation":"live_session_conflict is the sentinel the session manager returns (io::ErrorKind::ResourceBusy) when an external writer tries to rename or archive a session that a live interactive Codewhale process currently owns; the write is refused because the owning session's autosave would revert it.","triggerScenarios":"Thrown at crates/tui/src/session_manager.rs:281 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Perform the rename/archive inside the interactive session that owns it.","Close the interactive session first, then retry the external change.","Treat the ResourceBusy error as a typed conflict and surface it rather than retrying blindly."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}