mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Apply argument comment lint across codex-rs (#14652)
## Why Once the repo-local lint exists, `codex-rs` needs to follow the checked-in convention and CI needs to keep it from drifting. This commit applies the fallback `/*param*/` style consistently across existing positional literal call sites without changing those APIs. The longer-term preference is still to avoid APIs that require comments by choosing clearer parameter types and call shapes. This PR is intentionally the mechanical follow-through for the places where the existing signatures stay in place. After rebasing onto newer `main`, the rollout also had to cover newly introduced `tui_app_server` call sites. That made it clear the first cut of the CI job was too expensive for the common path: it was spending almost as much time installing `cargo-dylint` and re-testing the lint crate as a representative test job spends running product tests. The CI update keeps the full workspace enforcement but trims that extra overhead from ordinary `codex-rs` PRs. ## What changed - keep a dedicated `argument_comment_lint` job in `rust-ci` - mechanically annotate remaining opaque positional literals across `codex-rs` with exact `/*param*/` comments, including the rebased `tui_app_server` call sites that now fall under the lint - keep the checked-in style aligned with the lint policy by using `/*param*/` and leaving string and char literals uncommented - cache `cargo-dylint`, `dylint-link`, and the relevant Cargo registry/git metadata in the lint job - split changed-path detection so the lint crate's own `cargo test` step runs only when `tools/argument-comment-lint/*` or `rust-ci.yml` changes - continue to run the repo wrapper over the `codex-rs` workspace, so product-code enforcement is unchanged Most of the code changes in this commit are intentionally mechanical comment rewrites or insertions driven by the lint itself. ## Verification - `./tools/argument-comment-lint/run.sh --workspace` - `cargo test -p codex-tui-app-server -p codex-tui` - parsed `.github/workflows/rust-ci.yml` locally with PyYAML --- * -> #14652 * #14651
This commit is contained in:
committed by
GitHub
Unverified
parent
6f05d8d735
commit
b77fe8fefe
@@ -84,7 +84,10 @@ impl CodeModeExecuteHandler {
|
||||
Ok(message) => message,
|
||||
Err(error) => return Err(FunctionCallError::RespondToModel(error)),
|
||||
};
|
||||
handle_node_message(&exec, cell_id, message, None, started_at).await
|
||||
handle_node_message(
|
||||
&exec, cell_id, message, /*poll_max_output_tokens*/ None, started_at,
|
||||
)
|
||||
.await
|
||||
};
|
||||
match result {
|
||||
Ok(CodeModeSessionProgress::Finished(output))
|
||||
|
||||
@@ -230,7 +230,7 @@ async fn build_enabled_tools(exec: &ExecContext) -> Vec<protocol::EnabledTool> {
|
||||
let mut out = router
|
||||
.specs()
|
||||
.into_iter()
|
||||
.map(|spec| augment_tool_spec_for_code_mode(spec, true))
|
||||
.map(|spec| augment_tool_spec_for_code_mode(spec, /*code_mode_enabled*/ true))
|
||||
.filter_map(enabled_tool_from_spec)
|
||||
.collect::<Vec<_>>();
|
||||
out.sort_by(|left, right| left.tool_name.cmp(&right.tool_name));
|
||||
|
||||
@@ -230,7 +230,7 @@ impl ToolOutput for AbortedToolOutput {
|
||||
vec![FunctionCallOutputContentItem::InputText {
|
||||
text: self.message.clone(),
|
||||
}],
|
||||
None,
|
||||
/*success*/ None,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,14 @@ impl ToolEmitter {
|
||||
) => {
|
||||
emit_exec_stage(
|
||||
ctx,
|
||||
ExecCommandInput::new(command, cwd.as_path(), parsed_cmd, *source, None, None),
|
||||
ExecCommandInput::new(
|
||||
command,
|
||||
cwd.as_path(),
|
||||
parsed_cmd,
|
||||
*source,
|
||||
/*interaction_input*/ None,
|
||||
/*process_id*/ None,
|
||||
),
|
||||
stage,
|
||||
)
|
||||
.await;
|
||||
@@ -233,7 +240,7 @@ impl ToolEmitter {
|
||||
changes.clone(),
|
||||
String::new(),
|
||||
(*message).to_string(),
|
||||
false,
|
||||
/*success*/ false,
|
||||
PatchApplyStatus::Failed,
|
||||
)
|
||||
.await;
|
||||
@@ -247,7 +254,7 @@ impl ToolEmitter {
|
||||
changes.clone(),
|
||||
String::new(),
|
||||
(*message).to_string(),
|
||||
false,
|
||||
/*success*/ false,
|
||||
PatchApplyStatus::Declined,
|
||||
)
|
||||
.await;
|
||||
@@ -269,7 +276,7 @@ impl ToolEmitter {
|
||||
cwd.as_path(),
|
||||
parsed_cmd,
|
||||
*source,
|
||||
None,
|
||||
/*interaction_input*/ None,
|
||||
process_id.as_deref(),
|
||||
),
|
||||
stage,
|
||||
|
||||
@@ -584,7 +584,13 @@ async fn run_agent_job_loop(
|
||||
.await?;
|
||||
let initial_progress = db.get_agent_job_progress(job_id.as_str()).await?;
|
||||
progress_emitter
|
||||
.maybe_emit(&session, &turn, job_id.as_str(), &initial_progress, true)
|
||||
.maybe_emit(
|
||||
&session,
|
||||
&turn,
|
||||
job_id.as_str(),
|
||||
&initial_progress,
|
||||
/*force*/ true,
|
||||
)
|
||||
.await?;
|
||||
|
||||
let mut cancel_requested = db.is_agent_job_cancelled(job_id.as_str()).await?;
|
||||
@@ -633,7 +639,7 @@ async fn run_agent_job_loop(
|
||||
db.mark_agent_job_item_pending(
|
||||
job_id.as_str(),
|
||||
item.item_id.as_str(),
|
||||
None,
|
||||
/*error_message*/ None,
|
||||
)
|
||||
.await?;
|
||||
break;
|
||||
@@ -719,7 +725,13 @@ async fn run_agent_job_loop(
|
||||
active_items.remove(&thread_id);
|
||||
let progress = db.get_agent_job_progress(job_id.as_str()).await?;
|
||||
progress_emitter
|
||||
.maybe_emit(&session, &turn, job_id.as_str(), &progress, false)
|
||||
.maybe_emit(
|
||||
&session,
|
||||
&turn,
|
||||
job_id.as_str(),
|
||||
&progress,
|
||||
/*force*/ false,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
@@ -738,7 +750,13 @@ async fn run_agent_job_loop(
|
||||
format!("agent job {job_id} cancelled with {pending_items} unprocessed items");
|
||||
let _ = session.notify_background_event(&turn, message).await;
|
||||
progress_emitter
|
||||
.maybe_emit(&session, &turn, job_id.as_str(), &progress, true)
|
||||
.maybe_emit(
|
||||
&session,
|
||||
&turn,
|
||||
job_id.as_str(),
|
||||
&progress,
|
||||
/*force*/ true,
|
||||
)
|
||||
.await?;
|
||||
return Ok(());
|
||||
}
|
||||
@@ -750,7 +768,13 @@ async fn run_agent_job_loop(
|
||||
db.mark_agent_job_completed(job_id.as_str()).await?;
|
||||
let progress = db.get_agent_job_progress(job_id.as_str()).await?;
|
||||
progress_emitter
|
||||
.maybe_emit(&session, &turn, job_id.as_str(), &progress, true)
|
||||
.maybe_emit(
|
||||
&session,
|
||||
&turn,
|
||||
job_id.as_str(),
|
||||
&progress,
|
||||
/*force*/ true,
|
||||
)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -759,7 +783,9 @@ async fn export_job_csv_snapshot(
|
||||
db: Arc<codex_state::StateRuntime>,
|
||||
job: &codex_state::AgentJob,
|
||||
) -> anyhow::Result<()> {
|
||||
let items = db.list_agent_job_items(job.id.as_str(), None, None).await?;
|
||||
let items = db
|
||||
.list_agent_job_items(job.id.as_str(), /*status*/ None, /*limit*/ None)
|
||||
.await?;
|
||||
let csv_content = render_job_csv(job.input_headers.as_slice(), items.as_slice())
|
||||
.map_err(|err| anyhow::anyhow!("failed to render job csv for auto-export: {err}"))?;
|
||||
let output_path = PathBuf::from(job.output_csv_path.clone());
|
||||
@@ -778,7 +804,11 @@ async fn recover_running_items(
|
||||
runtime_timeout: Duration,
|
||||
) -> anyhow::Result<()> {
|
||||
let running_items = db
|
||||
.list_agent_job_items(job_id, Some(codex_state::AgentJobItemStatus::Running), None)
|
||||
.list_agent_job_items(
|
||||
job_id,
|
||||
Some(codex_state::AgentJobItemStatus::Running),
|
||||
/*limit*/ None,
|
||||
)
|
||||
.await?;
|
||||
for item in running_items {
|
||||
if is_item_stale(&item, runtime_timeout) {
|
||||
|
||||
@@ -225,9 +225,9 @@ async fn emit_exec_begin(session: &Session, turn: &TurnContext, call_id: &str) {
|
||||
vec![ARTIFACTS_TOOL_NAME.to_string()],
|
||||
turn.cwd.clone(),
|
||||
ExecCommandSource::Agent,
|
||||
true,
|
||||
/*freeform*/ true,
|
||||
);
|
||||
let ctx = ToolEventCtx::new(session, turn, call_id, None);
|
||||
let ctx = ToolEventCtx::new(session, turn, call_id, /*turn_diff_tracker*/ None);
|
||||
emitter.emit(ctx, ToolEventStage::Begin).await;
|
||||
}
|
||||
|
||||
@@ -251,9 +251,9 @@ async fn emit_exec_end(
|
||||
vec![ARTIFACTS_TOOL_NAME.to_string()],
|
||||
turn.cwd.clone(),
|
||||
ExecCommandSource::Agent,
|
||||
true,
|
||||
/*freeform*/ true,
|
||||
);
|
||||
let ctx = ToolEventCtx::new(session, turn, call_id, None);
|
||||
let ctx = ToolEventCtx::new(session, turn, call_id, /*turn_diff_tracker*/ None);
|
||||
let stage = if success {
|
||||
ToolEventStage::Success(exec_output)
|
||||
} else {
|
||||
|
||||
@@ -63,9 +63,9 @@ async fn emit_js_repl_exec_begin(
|
||||
vec!["js_repl".to_string()],
|
||||
turn.cwd.clone(),
|
||||
ExecCommandSource::Agent,
|
||||
false,
|
||||
/*freeform*/ false,
|
||||
);
|
||||
let ctx = ToolEventCtx::new(session, turn, call_id, None);
|
||||
let ctx = ToolEventCtx::new(session, turn, call_id, /*turn_diff_tracker*/ None);
|
||||
emitter.emit(ctx, ToolEventStage::Begin).await;
|
||||
}
|
||||
|
||||
@@ -82,9 +82,9 @@ async fn emit_js_repl_exec_end(
|
||||
vec!["js_repl".to_string()],
|
||||
turn.cwd.clone(),
|
||||
ExecCommandSource::Agent,
|
||||
false,
|
||||
/*freeform*/ false,
|
||||
);
|
||||
let ctx = ToolEventCtx::new(session, turn, call_id, None);
|
||||
let ctx = ToolEventCtx::new(session, turn, call_id, /*turn_diff_tracker*/ None);
|
||||
let stage = if error.is_some() {
|
||||
ToolEventStage::Failure(ToolEventFailure::Output(exec_output))
|
||||
} else {
|
||||
@@ -169,7 +169,7 @@ impl ToolHandler for JsReplHandler {
|
||||
turn.as_ref(),
|
||||
&call_id,
|
||||
&content,
|
||||
None,
|
||||
/*error*/ None,
|
||||
started_at.elapsed(),
|
||||
)
|
||||
.await;
|
||||
|
||||
@@ -103,7 +103,7 @@ impl ToolHandler for Handler {
|
||||
return Err(err);
|
||||
}
|
||||
turn.session_telemetry
|
||||
.counter("codex.multi_agent.resume", 1, &[]);
|
||||
.counter("codex.multi_agent.resume", /*inc*/ 1, &[]);
|
||||
|
||||
Ok(ResumeAgentResult { status })
|
||||
}
|
||||
@@ -150,7 +150,11 @@ async fn try_resume_closed_agent(
|
||||
.resume_agent_from_rollout(
|
||||
config,
|
||||
receiver_thread_id,
|
||||
thread_spawn_source(session.conversation_id, child_depth, None),
|
||||
thread_spawn_source(
|
||||
session.conversation_id,
|
||||
child_depth,
|
||||
/*agent_role*/ None,
|
||||
),
|
||||
)
|
||||
.await
|
||||
.map_err(|err| collab_agent_error(receiver_thread_id, err))?;
|
||||
|
||||
@@ -127,8 +127,11 @@ impl ToolHandler for Handler {
|
||||
.await;
|
||||
let new_thread_id = result?;
|
||||
let role_tag = role_name.unwrap_or(DEFAULT_ROLE_NAME);
|
||||
turn.session_telemetry
|
||||
.counter("codex.multi_agent.spawn", 1, &[("role", role_tag)]);
|
||||
turn.session_telemetry.counter(
|
||||
"codex.multi_agent.spawn",
|
||||
/*inc*/ 1,
|
||||
&[("role", role_tag)],
|
||||
);
|
||||
|
||||
Ok(SpawnAgentResult {
|
||||
agent_id: new_thread_id.to_string(),
|
||||
|
||||
@@ -197,7 +197,7 @@ impl ToolOutput for WaitAgentResult {
|
||||
}
|
||||
|
||||
fn to_response_item(&self, call_id: &str, payload: &ToolPayload) -> ResponseInputItem {
|
||||
tool_output_response_item(call_id, payload, self, None, "wait_agent")
|
||||
tool_output_response_item(call_id, payload, self, /*success*/ None, "wait_agent")
|
||||
}
|
||||
|
||||
fn code_mode_result(&self, _payload: &ToolPayload) -> JsonValue {
|
||||
|
||||
@@ -417,7 +417,12 @@ impl ShellHandler {
|
||||
source,
|
||||
freeform,
|
||||
);
|
||||
let event_ctx = ToolEventCtx::new(session.as_ref(), turn.as_ref(), &call_id, None);
|
||||
let event_ctx = ToolEventCtx::new(
|
||||
session.as_ref(),
|
||||
turn.as_ref(),
|
||||
&call_id,
|
||||
/*turn_diff_tracker*/ None,
|
||||
);
|
||||
emitter.begin(event_ctx).await;
|
||||
|
||||
let exec_approval_requirement = session
|
||||
@@ -478,7 +483,12 @@ impl ShellHandler {
|
||||
)
|
||||
.await
|
||||
.map(|result| result.output);
|
||||
let event_ctx = ToolEventCtx::new(session.as_ref(), turn.as_ref(), &call_id, None);
|
||||
let event_ctx = ToolEventCtx::new(
|
||||
session.as_ref(),
|
||||
turn.as_ref(),
|
||||
&call_id,
|
||||
/*turn_diff_tracker*/ None,
|
||||
);
|
||||
let content = emitter.finish(event_ctx, out).await?;
|
||||
Ok(FunctionToolOutput::from_text(content, Some(true)))
|
||||
}
|
||||
|
||||
@@ -115,23 +115,19 @@ impl ToolHandler for ViewImageHandler {
|
||||
};
|
||||
let image_detail = use_original_detail.then_some(ImageDetail::Original);
|
||||
|
||||
let content = local_image_content_items_with_label_number(&abs_path, None, image_mode)
|
||||
.into_iter()
|
||||
.map(|item| match item {
|
||||
ContentItem::InputText { text } => {
|
||||
FunctionCallOutputContentItem::InputText { text }
|
||||
}
|
||||
ContentItem::InputImage { image_url } => {
|
||||
FunctionCallOutputContentItem::InputImage {
|
||||
image_url,
|
||||
detail: image_detail,
|
||||
}
|
||||
}
|
||||
ContentItem::OutputText { text } => {
|
||||
FunctionCallOutputContentItem::InputText { text }
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
let content = local_image_content_items_with_label_number(
|
||||
&abs_path, /*label_number*/ None, image_mode,
|
||||
)
|
||||
.into_iter()
|
||||
.map(|item| match item {
|
||||
ContentItem::InputText { text } => FunctionCallOutputContentItem::InputText { text },
|
||||
ContentItem::InputImage { image_url } => FunctionCallOutputContentItem::InputImage {
|
||||
image_url,
|
||||
detail: image_detail,
|
||||
},
|
||||
ContentItem::OutputText { text } => FunctionCallOutputContentItem::InputText { text },
|
||||
})
|
||||
.collect();
|
||||
|
||||
session
|
||||
.send_event(
|
||||
|
||||
@@ -792,7 +792,11 @@ impl JsReplManager {
|
||||
}
|
||||
|
||||
fn summarize_tool_call_error(error: &str) -> JsReplToolCallResponseSummary {
|
||||
Self::summarize_text_payload(None, JsReplToolCallPayloadKind::Error, error)
|
||||
Self::summarize_text_payload(
|
||||
/*response_type*/ None,
|
||||
JsReplToolCallPayloadKind::Error,
|
||||
error,
|
||||
)
|
||||
}
|
||||
|
||||
pub async fn reset(&self) -> Result<(), FunctionCallError> {
|
||||
@@ -962,7 +966,7 @@ impl JsReplManager {
|
||||
with_model_kernel_failure_message(
|
||||
"js_repl kernel closed unexpectedly",
|
||||
"response_channel_closed",
|
||||
None,
|
||||
/*stream_error*/ None,
|
||||
&snapshot,
|
||||
)
|
||||
} else {
|
||||
@@ -1531,7 +1535,13 @@ impl JsReplManager {
|
||||
if is_js_repl_internal_tool(&req.tool_name) {
|
||||
let error = "js_repl cannot invoke itself".to_string();
|
||||
let summary = Self::summarize_tool_call_error(&error);
|
||||
Self::log_tool_call_response(&req, false, &summary, None, Some(&error));
|
||||
Self::log_tool_call_response(
|
||||
&req,
|
||||
/*ok*/ false,
|
||||
&summary,
|
||||
/*response*/ None,
|
||||
Some(&error),
|
||||
);
|
||||
return RunToolResult {
|
||||
id: req.id,
|
||||
ok: false,
|
||||
@@ -1610,7 +1620,13 @@ impl JsReplManager {
|
||||
let summary = Self::summarize_tool_call_response(&response);
|
||||
match serde_json::to_value(response) {
|
||||
Ok(value) => {
|
||||
Self::log_tool_call_response(&req, true, &summary, Some(&value), None);
|
||||
Self::log_tool_call_response(
|
||||
&req,
|
||||
/*ok*/ true,
|
||||
&summary,
|
||||
Some(&value),
|
||||
/*error*/ None,
|
||||
);
|
||||
RunToolResult {
|
||||
id: req.id,
|
||||
ok: true,
|
||||
@@ -1621,7 +1637,13 @@ impl JsReplManager {
|
||||
Err(err) => {
|
||||
let error = format!("failed to serialize tool output: {err}");
|
||||
let summary = Self::summarize_tool_call_error(&error);
|
||||
Self::log_tool_call_response(&req, false, &summary, None, Some(&error));
|
||||
Self::log_tool_call_response(
|
||||
&req,
|
||||
/*ok*/ false,
|
||||
&summary,
|
||||
/*response*/ None,
|
||||
Some(&error),
|
||||
);
|
||||
RunToolResult {
|
||||
id: req.id,
|
||||
ok: false,
|
||||
@@ -1634,7 +1656,13 @@ impl JsReplManager {
|
||||
Err(err) => {
|
||||
let error = err.to_string();
|
||||
let summary = Self::summarize_tool_call_error(&error);
|
||||
Self::log_tool_call_response(&req, false, &summary, None, Some(&error));
|
||||
Self::log_tool_call_response(
|
||||
&req,
|
||||
/*ok*/ false,
|
||||
&summary,
|
||||
/*response*/ None,
|
||||
Some(&error),
|
||||
);
|
||||
RunToolResult {
|
||||
id: req.id,
|
||||
ok: false,
|
||||
|
||||
@@ -377,14 +377,14 @@ impl NetworkApprovalService {
|
||||
.request_command_approval(
|
||||
turn_context.as_ref(),
|
||||
approval_id,
|
||||
None,
|
||||
/*approval_id*/ None,
|
||||
prompt_command,
|
||||
turn_context.cwd.clone(),
|
||||
Some(prompt_reason),
|
||||
Some(network_approval_context.clone()),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
/*proposed_execpolicy_amendment*/ None,
|
||||
/*additional_permissions*/ None,
|
||||
/*skill_metadata*/ None,
|
||||
available_decisions,
|
||||
)
|
||||
.await
|
||||
|
||||
@@ -217,7 +217,7 @@ impl ToolRegistry {
|
||||
&call_id_owned,
|
||||
log_payload.as_ref(),
|
||||
Duration::ZERO,
|
||||
false,
|
||||
/*success*/ false,
|
||||
&message,
|
||||
&metric_tags,
|
||||
mcp_server_ref,
|
||||
@@ -234,7 +234,7 @@ impl ToolRegistry {
|
||||
&call_id_owned,
|
||||
log_payload.as_ref(),
|
||||
Duration::ZERO,
|
||||
false,
|
||||
/*success*/ false,
|
||||
&message,
|
||||
&metric_tags,
|
||||
mcp_server_ref,
|
||||
@@ -341,7 +341,7 @@ impl ToolRegistryBuilder {
|
||||
}
|
||||
|
||||
pub fn push_spec(&mut self, spec: ToolSpec) {
|
||||
self.push_spec_with_parallel_support(spec, false);
|
||||
self.push_spec_with_parallel_support(spec, /*supports_parallel_tool_calls*/ false);
|
||||
}
|
||||
|
||||
pub fn push_spec_with_parallel_support(
|
||||
|
||||
@@ -147,7 +147,13 @@ impl Approvable<ApplyPatchRequest> for ApplyPatchRuntime {
|
||||
}
|
||||
if let Some(reason) = retry_reason {
|
||||
let rx_approve = session
|
||||
.request_patch_approval(turn, call_id, changes.clone(), Some(reason), None)
|
||||
.request_patch_approval(
|
||||
turn,
|
||||
call_id,
|
||||
changes.clone(),
|
||||
Some(reason),
|
||||
/*grant_root*/ None,
|
||||
)
|
||||
.await;
|
||||
return rx_approve.await.unwrap_or_default();
|
||||
}
|
||||
@@ -158,7 +164,9 @@ impl Approvable<ApplyPatchRequest> for ApplyPatchRuntime {
|
||||
approval_keys,
|
||||
|| async move {
|
||||
let rx_approve = session
|
||||
.request_patch_approval(turn, call_id, changes, None, None)
|
||||
.request_patch_approval(
|
||||
turn, call_id, changes, /*reason*/ None, /*grant_root*/ None,
|
||||
)
|
||||
.await;
|
||||
rx_approve.await.unwrap_or_default()
|
||||
},
|
||||
@@ -198,7 +206,7 @@ impl ToolRuntime<ApplyPatchRequest, ExecToolCallOutput> for ApplyPatchRuntime {
|
||||
) -> Result<ExecToolCallOutput, ToolError> {
|
||||
let spec = Self::build_command_spec(req, &ctx.turn.config.codex_home)?;
|
||||
let env = attempt
|
||||
.env_for(spec, None)
|
||||
.env_for(spec, /*network*/ None)
|
||||
.map_err(|err| ToolError::Codex(err.into()))?;
|
||||
let out = execute_env(env, Self::stdout_stream(ctx))
|
||||
.await
|
||||
|
||||
@@ -174,7 +174,7 @@ impl Approvable<ShellRequest> for ShellRuntime {
|
||||
.request_command_approval(
|
||||
turn,
|
||||
call_id,
|
||||
None,
|
||||
/*approval_id*/ None,
|
||||
command,
|
||||
cwd,
|
||||
reason,
|
||||
@@ -183,7 +183,7 @@ impl Approvable<ShellRequest> for ShellRuntime {
|
||||
.proposed_execpolicy_amendment()
|
||||
.cloned(),
|
||||
req.additional_permissions.clone(),
|
||||
None,
|
||||
/*skill_metadata*/ None,
|
||||
available_decisions,
|
||||
)
|
||||
.await
|
||||
|
||||
@@ -435,7 +435,7 @@ impl CoreShellActionProvider {
|
||||
cwd: workdir,
|
||||
additional_permissions,
|
||||
},
|
||||
None,
|
||||
/*retry_reason*/ None,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
@@ -468,9 +468,9 @@ impl CoreShellActionProvider {
|
||||
approval_id,
|
||||
command,
|
||||
workdir,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
/*reason*/ None,
|
||||
/*network_approval_context*/ None,
|
||||
/*proposed_execpolicy_amendment*/ None,
|
||||
additional_permissions,
|
||||
skill_metadata,
|
||||
Some(available_decisions),
|
||||
@@ -913,7 +913,7 @@ impl ShellCommandExecutor for CoreShellCommandExecutor {
|
||||
justification: self.justification.clone(),
|
||||
arg0: self.arg0.clone(),
|
||||
},
|
||||
None,
|
||||
/*stdout_stream*/ None,
|
||||
after_spawn,
|
||||
)
|
||||
.await?;
|
||||
|
||||
@@ -143,7 +143,7 @@ impl Approvable<UnifiedExecRequest> for UnifiedExecRuntime<'_> {
|
||||
.request_command_approval(
|
||||
turn,
|
||||
call_id,
|
||||
None,
|
||||
/*approval_id*/ None,
|
||||
command,
|
||||
cwd,
|
||||
reason,
|
||||
@@ -152,7 +152,7 @@ impl Approvable<UnifiedExecRequest> for UnifiedExecRuntime<'_> {
|
||||
.proposed_execpolicy_amendment()
|
||||
.cloned(),
|
||||
req.additional_permissions.clone(),
|
||||
None,
|
||||
/*skill_metadata*/ None,
|
||||
available_decisions,
|
||||
)
|
||||
.await
|
||||
|
||||
@@ -94,7 +94,7 @@ where
|
||||
|
||||
services.session_telemetry.counter(
|
||||
"codex.approval.requested",
|
||||
1,
|
||||
/*inc*/ 1,
|
||||
&[
|
||||
("tool", tool_name),
|
||||
("approved", decision.to_opaque_string()),
|
||||
|
||||
@@ -2258,7 +2258,7 @@ fn push_tool_spec(
|
||||
) {
|
||||
let spec = augment_tool_spec_for_code_mode(spec, code_mode_enabled);
|
||||
if supports_parallel_tool_calls {
|
||||
builder.push_spec_with_parallel_support(spec, true);
|
||||
builder.push_spec_with_parallel_support(spec, /*supports_parallel_tool_calls*/ true);
|
||||
} else {
|
||||
builder.push_spec(spec);
|
||||
}
|
||||
@@ -2566,14 +2566,16 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
&nested_config,
|
||||
mcp_tools.clone(),
|
||||
app_tools.clone(),
|
||||
None,
|
||||
/*discoverable_tools*/ None,
|
||||
dynamic_tools,
|
||||
)
|
||||
.build();
|
||||
let mut enabled_tools = nested_specs
|
||||
.into_iter()
|
||||
.filter_map(|spec| {
|
||||
let (name, description) = match augment_tool_spec_for_code_mode(spec.spec, true) {
|
||||
let (name, description) = match augment_tool_spec_for_code_mode(
|
||||
spec.spec, /*code_mode_enabled*/ true,
|
||||
) {
|
||||
ToolSpec::Function(tool) => (tool.name, tool.description),
|
||||
ToolSpec::Freeform(tool) => (tool.name, tool.description),
|
||||
_ => return None,
|
||||
@@ -2586,14 +2588,14 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_code_mode_tool(&enabled_tools, config.code_mode_only_enabled),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler(PUBLIC_TOOL_NAME, code_mode_handler);
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_exec_wait_tool(),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler(WAIT_TOOL_NAME, code_mode_wait_handler);
|
||||
@@ -2604,7 +2606,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_shell_tool(exec_permission_approvals_enabled),
|
||||
true,
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
}
|
||||
@@ -2612,7 +2614,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
ToolSpec::LocalShell {},
|
||||
true,
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
}
|
||||
@@ -2623,13 +2625,13 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
config.allow_login_shell,
|
||||
exec_permission_approvals_enabled,
|
||||
),
|
||||
true,
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_write_stdin_tool(),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler("exec_command", unified_exec_handler.clone());
|
||||
@@ -2645,7 +2647,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
config.allow_login_shell,
|
||||
exec_permission_approvals_enabled,
|
||||
),
|
||||
true,
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
}
|
||||
@@ -2663,19 +2665,19 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_list_mcp_resources_tool(),
|
||||
true,
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_list_mcp_resource_templates_tool(),
|
||||
true,
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_read_mcp_resource_tool(),
|
||||
true,
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler("list_mcp_resources", mcp_resource_handler.clone());
|
||||
@@ -2686,7 +2688,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
PLAN_TOOL.clone(),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler("update_plan", plan_handler);
|
||||
@@ -2695,13 +2697,13 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_js_repl_tool(),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_js_repl_reset_tool(),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler("js_repl", js_repl_handler);
|
||||
@@ -2714,7 +2716,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
create_request_user_input_tool(CollaborationModesConfig {
|
||||
default_mode_request_user_input: config.default_mode_request_user_input,
|
||||
}),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler("request_user_input", request_user_input_handler);
|
||||
@@ -2724,7 +2726,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_request_permissions_tool(),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler("request_permissions", request_permissions_handler);
|
||||
@@ -2737,7 +2739,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_tool_search_tool(&app_tools),
|
||||
true,
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler(TOOL_SEARCH_TOOL_NAME, search_tool_handler);
|
||||
@@ -2755,7 +2757,10 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
.as_ref()
|
||||
.filter(|tools| !tools.is_empty())
|
||||
{
|
||||
builder.push_spec_with_parallel_support(create_tool_suggest_tool(discoverable_tools), true);
|
||||
builder.push_spec_with_parallel_support(
|
||||
create_tool_suggest_tool(discoverable_tools),
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
);
|
||||
builder.register_handler(TOOL_SUGGEST_TOOL_NAME, tool_suggest_handler);
|
||||
}
|
||||
|
||||
@@ -2765,7 +2770,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_apply_patch_freeform_tool(),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
}
|
||||
@@ -2773,7 +2778,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_apply_patch_json_tool(),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
}
|
||||
@@ -2789,7 +2794,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_grep_files_tool(),
|
||||
true,
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler("grep_files", grep_files_handler);
|
||||
@@ -2803,7 +2808,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_read_file_tool(),
|
||||
true,
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler("read_file", read_file_handler);
|
||||
@@ -2818,7 +2823,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_list_dir_tool(),
|
||||
true,
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler("list_dir", list_dir_handler);
|
||||
@@ -2832,7 +2837,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_test_sync_tool(),
|
||||
true,
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler("test_sync_tool", test_sync_handler);
|
||||
@@ -2873,7 +2878,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
.and_then(|cfg| cfg.search_context_size),
|
||||
search_content_types,
|
||||
},
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
}
|
||||
@@ -2884,7 +2889,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
ToolSpec::ImageGeneration {
|
||||
output_format: "png".to_string(),
|
||||
},
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
}
|
||||
@@ -2892,7 +2897,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_view_image_tool(config.can_request_original_image_detail),
|
||||
true,
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler("view_image", view_image_handler);
|
||||
@@ -2901,7 +2906,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_artifacts_tool(),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler("artifacts", artifacts_handler);
|
||||
@@ -2911,31 +2916,31 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_spawn_agent_tool(config),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_send_input_tool(),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_resume_agent_tool(),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_wait_agent_tool(),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_close_agent_tool(),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler("spawn_agent", Arc::new(SpawnAgentHandler));
|
||||
@@ -2950,7 +2955,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_spawn_agents_on_csv_tool(),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler("spawn_agents_on_csv", agent_jobs_handler.clone());
|
||||
@@ -2958,7 +2963,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
create_report_agent_job_result_tool(),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler("report_agent_job_result", agent_jobs_handler);
|
||||
@@ -2975,7 +2980,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
ToolSpec::Function(converted_tool),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler(name, mcp_handler.clone());
|
||||
@@ -2994,7 +2999,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_tool_spec(
|
||||
&mut builder,
|
||||
ToolSpec::Function(converted_tool),
|
||||
false,
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler(tool.name.clone(), dynamic_tool_handler.clone());
|
||||
|
||||
Reference in New Issue
Block a user