MCPcopy Create free account
hub / github.com/GCWing/BitFun / ensure_backend_session_alive

Method ensure_backend_session_alive

src/apps/cli/src/agent/core_adapter.rs:116–150  ·  view source on GitHub ↗
(&self, session_id: &str, agent_type: &str)

Source from the content-addressed store, hash-verified

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,

Callers 2

ensure_sessionMethod · 0.80
send_messageMethod · 0.80

Calls 5

get_session_managerMethod · 0.80
get_sessionMethod · 0.45
workspace_path_bufMethod · 0.45
restore_sessionMethod · 0.45

Tested by

no test coverage detected