mirror of
https://github.com/openai/codex.git
synced 2026-09-07 15:40:00 +00:00
fix: avoid runtime for missing code mode waits
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user