fix: avoid runtime for missing code mode waits

This commit is contained in:
starr-openai
2026-06-02 22:52:42 -07:00
parent 2cc054b0e0
commit f726d0cac3

View File

@@ -86,14 +86,24 @@ impl CodeModeService {
&self,
request: codex_code_mode::WaitRequest,
) -> Result<codex_code_mode::WaitOutcome, String> {
self.session().await?.wait(request).await
match self.session.get() {
Some(session) => session.wait(request).await,
None => Ok(codex_code_mode::WaitOutcome::MissingCell(
missing_cell_response(request.cell_id),
)),
}
}
pub(crate) async fn terminate(
&self,
cell_id: CellId,
) -> Result<codex_code_mode::WaitOutcome, String> {
self.session().await?.terminate(cell_id).await
match self.session.get() {
Some(session) => session.terminate(cell_id).await,
None => Ok(codex_code_mode::WaitOutcome::MissingCell(
missing_cell_response(cell_id),
)),
}
}
pub(crate) async fn shutdown(&self) -> Result<(), String> {
@@ -142,6 +152,14 @@ impl CodeModeService {
}
}
fn missing_cell_response(cell_id: CellId) -> RuntimeResponse {
RuntimeResponse::Result {
error_text: Some(format!("exec cell {cell_id} not found")),
cell_id,
content_items: Vec::new(),
}
}
pub(super) async fn handle_runtime_response(
exec: &ExecContext,
response: RuntimeResponse,