(&self, session_id: &str, agent_type: &str)
| 114 | } |
| 115 | |
| 116 | async fn ensure_backend_session_alive(&self, session_id: &str, agent_type: &str) -> Result<()> { |
| 117 | if self |
| 118 | .coordinator |
| 119 | .get_session_manager() |
| 120 | .get_session(session_id) |
| 121 | .is_some() |
| 122 | { |
| 123 | return Ok(()); |
| 124 | } |
| 125 | |
| 126 | tracing::warn!( |
| 127 | "Backend session not present in memory, attempting restore: {}", |
| 128 | session_id |
| 129 | ); |
| 130 | |
| 131 | let workspace = self.workspace_path_buf(); |
| 132 | match self |
| 133 | .coordinator |
| 134 | .restore_session(&workspace, session_id) |
| 135 | .await |
| 136 | { |
| 137 | Ok(_) => { |
| 138 | tracing::info!("Backend session restored: {}", session_id); |
| 139 | Ok(()) |
| 140 | } |
| 141 | Err(restore_err) => { |
| 142 | tracing::warn!( |
| 143 | "Restore failed, recreating backend session: {}, error={}", |
| 144 | session_id, |
| 145 | restore_err |
| 146 | ); |
| 147 | self.recreate_session_with_id(session_id, agent_type).await |
| 148 | } |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | pub async fn create_session_with_id( |
| 153 | &self, |
no test coverage detected