mirror of
https://github.com/openai/codex.git
synced 2026-11-21 07:09:23 +00:00
fix: release session ID when not used (#7592)
This commit is contained in:
1 parent
1b2509f05a
commit
36edb412b1
2 files changed
+17
-1
No files matched your search
@@ -146,6 +146,7 @@ impl ToolHandler for UnifiedExecHandler {
|
|||||||
codex_protocol::protocol::AskForApproval::OnRequest
|
codex_protocol::protocol::AskForApproval::OnRequest
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
manager.release_process_id(&process_id).await;
|
||||||
return Err(FunctionCallError::RespondToModel(format!(
|
return Err(FunctionCallError::RespondToModel(format!(
|
||||||
"approval policy is {policy:?}; reject command — you cannot ask for escalated permissions if the approval policy is {policy:?}",
|
"approval policy is {policy:?}; reject command — you cannot ask for escalated permissions if the approval policy is {policy:?}",
|
||||||
policy = context.turn.approval_policy
|
policy = context.turn.approval_policy
|
||||||
@@ -169,6 +170,7 @@ impl ToolHandler for UnifiedExecHandler {
|
|||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
{
|
{
|
||||||
|
manager.release_process_id(&process_id).await;
|
||||||
return Ok(output);
|
return Ok(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,6 +111,11 @@ impl UnifiedExecSessionManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) async fn release_process_id(&self, process_id: &str) {
|
||||||
|
let mut store = self.session_store.lock().await;
|
||||||
|
store.remove(process_id);
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) async fn exec_command(
|
pub(crate) async fn exec_command(
|
||||||
&self,
|
&self,
|
||||||
request: ExecCommandRequest,
|
request: ExecCommandRequest,
|
||||||
@@ -129,7 +134,15 @@ impl UnifiedExecSessionManager {
|
|||||||
request.justification,
|
request.justification,
|
||||||
context,
|
context,
|
||||||
)
|
)
|
||||||
.await?;
|
.await;
|
||||||
|
|
||||||
|
let session = match session {
|
||||||
|
Ok(session) => session,
|
||||||
|
Err(err) => {
|
||||||
|
self.release_process_id(&request.process_id).await;
|
||||||
|
return Err(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let max_tokens = resolve_max_tokens(request.max_output_tokens);
|
let max_tokens = resolve_max_tokens(request.max_output_tokens);
|
||||||
let yield_time_ms = clamp_yield_time(request.yield_time_ms);
|
let yield_time_ms = clamp_yield_time(request.yield_time_ms);
|
||||||
@@ -157,6 +170,7 @@ impl UnifiedExecSessionManager {
|
|||||||
let chunk_id = generate_chunk_id();
|
let chunk_id = generate_chunk_id();
|
||||||
let process_id = request.process_id.clone();
|
let process_id = request.process_id.clone();
|
||||||
if has_exited {
|
if has_exited {
|
||||||
|
self.release_process_id(&request.process_id).await;
|
||||||
let exit = exit_code.unwrap_or(-1);
|
let exit = exit_code.unwrap_or(-1);
|
||||||
Self::emit_exec_end_from_context(
|
Self::emit_exec_end_from_context(
|
||||||
context,
|
context,
|
||||||
|
|||||||
Reference in new issue
Block a user