mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Make unified exec session_id numeric (#14279)
It's a number on the write_stdin input, make it a number on the output and also internally.
This commit is contained in:
committed by
Michael Bolin
Unverified
parent
01792a4c61
commit
31bf1dbe63
@@ -159,7 +159,7 @@ pub struct ExecCommandToolOutput {
|
||||
/// Raw bytes returned for this unified exec call before any truncation.
|
||||
pub raw_output: Vec<u8>,
|
||||
pub max_output_tokens: Option<usize>,
|
||||
pub process_id: Option<String>,
|
||||
pub process_id: Option<i32>,
|
||||
pub exit_code: Option<i32>,
|
||||
pub original_token_count: Option<usize>,
|
||||
pub session_command: Option<Vec<String>>,
|
||||
@@ -194,7 +194,7 @@ impl ToolOutput for ExecCommandToolOutput {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
exit_code: Option<i32>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
session_id: Option<String>,
|
||||
session_id: Option<i32>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
original_token_count: Option<usize>,
|
||||
output: String,
|
||||
@@ -204,7 +204,7 @@ impl ToolOutput for ExecCommandToolOutput {
|
||||
chunk_id: (!self.chunk_id.is_empty()).then(|| self.chunk_id.clone()),
|
||||
wall_time_seconds: self.wall_time.as_secs_f64(),
|
||||
exit_code: self.exit_code,
|
||||
session_id: self.process_id.clone(),
|
||||
session_id: self.process_id,
|
||||
original_token_count: self.original_token_count,
|
||||
output: self.truncated_output(),
|
||||
};
|
||||
|
||||
@@ -190,7 +190,7 @@ impl ToolHandler for UnifiedExecHandler {
|
||||
)
|
||||
{
|
||||
let approval_policy = context.turn.approval_policy.value();
|
||||
manager.release_process_id(&process_id).await;
|
||||
manager.release_process_id(process_id).await;
|
||||
return Err(FunctionCallError::RespondToModel(format!(
|
||||
"approval policy is {approval_policy:?}; reject command — you cannot ask for escalated permissions if the approval policy is {approval_policy:?}"
|
||||
)));
|
||||
@@ -211,7 +211,7 @@ impl ToolHandler for UnifiedExecHandler {
|
||||
) {
|
||||
Ok(normalized) => normalized,
|
||||
Err(err) => {
|
||||
manager.release_process_id(&process_id).await;
|
||||
manager.release_process_id(process_id).await;
|
||||
return Err(FunctionCallError::RespondToModel(err));
|
||||
}
|
||||
};
|
||||
@@ -228,7 +228,7 @@ impl ToolHandler for UnifiedExecHandler {
|
||||
)
|
||||
.await?
|
||||
{
|
||||
manager.release_process_id(&process_id).await;
|
||||
manager.release_process_id(process_id).await;
|
||||
return Ok(ExecCommandToolOutput {
|
||||
event_call_id: String::new(),
|
||||
chunk_id: String::new(),
|
||||
@@ -271,7 +271,7 @@ impl ToolHandler for UnifiedExecHandler {
|
||||
let args: WriteStdinArgs = parse_arguments(&arguments)?;
|
||||
let response = manager
|
||||
.write_stdin(WriteStdinRequest {
|
||||
process_id: &args.session_id.to_string(),
|
||||
process_id: args.session_id,
|
||||
input: &args.chars,
|
||||
yield_time_ms: args.yield_time_ms,
|
||||
max_output_tokens: args.max_output_tokens,
|
||||
|
||||
@@ -59,7 +59,7 @@ fn unified_exec_output_schema() -> JsonValue {
|
||||
"description": "Process exit code when the command finished during this call."
|
||||
},
|
||||
"session_id": {
|
||||
"type": "string",
|
||||
"type": "number",
|
||||
"description": "Session identifier to pass to write_stdin when the process is still running."
|
||||
},
|
||||
"original_token_count": {
|
||||
|
||||
Reference in New Issue
Block a user