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:
@@ -32,14 +32,14 @@ impl SessionTask for CompactTask {
|
||||
let _ = if crate::compact::should_use_remote_compact_task(&ctx.provider) {
|
||||
let _ = session.services.session_telemetry.counter(
|
||||
"codex.task.compact",
|
||||
1,
|
||||
/*inc*/ 1,
|
||||
&[("type", "remote")],
|
||||
);
|
||||
crate::compact_remote::run_remote_compact_task(session.clone(), ctx).await
|
||||
} else {
|
||||
let _ = session.services.session_telemetry.counter(
|
||||
"codex.task.compact",
|
||||
1,
|
||||
/*inc*/ 1,
|
||||
&[("type", "local")],
|
||||
);
|
||||
crate::compact::run_compact_task(session.clone(), ctx, input).await
|
||||
|
||||
@@ -68,7 +68,11 @@ fn emit_turn_network_proxy_metric(
|
||||
} else {
|
||||
"false"
|
||||
};
|
||||
session_telemetry.counter(TURN_NETWORK_PROXY_METRIC, 1, &[("active", active), tmp_mem]);
|
||||
session_telemetry.counter(
|
||||
TURN_NETWORK_PROXY_METRIC,
|
||||
/*inc*/ 1,
|
||||
&[("active", active), tmp_mem],
|
||||
);
|
||||
}
|
||||
|
||||
/// Thin wrapper that exposes the parts of [`Session`] task runners need.
|
||||
|
||||
@@ -81,7 +81,7 @@ impl SessionTask for RegularTask {
|
||||
) -> Option<String> {
|
||||
let sess = session.clone_session();
|
||||
let run_turn_span = trace_span!("run_turn");
|
||||
sess.set_server_reasoning_included(false).await;
|
||||
sess.set_server_reasoning_included(/*included*/ false).await;
|
||||
let prewarmed_client_session = self.take_prewarmed_session().await;
|
||||
run_turn(
|
||||
sess,
|
||||
|
||||
@@ -55,11 +55,11 @@ impl SessionTask for ReviewTask {
|
||||
input: Vec<UserInput>,
|
||||
cancellation_token: CancellationToken,
|
||||
) -> Option<String> {
|
||||
let _ = session
|
||||
.session
|
||||
.services
|
||||
.session_telemetry
|
||||
.counter("codex.task.review", 1, &[]);
|
||||
let _ = session.session.services.session_telemetry.counter(
|
||||
"codex.task.review",
|
||||
/*inc*/ 1,
|
||||
&[],
|
||||
);
|
||||
|
||||
// Start sub-codex conversation and get the receiver for events.
|
||||
let output = match start_review_conversation(
|
||||
@@ -80,7 +80,7 @@ impl SessionTask for ReviewTask {
|
||||
}
|
||||
|
||||
async fn abort(&self, session: Arc<SessionTaskContext>, ctx: Arc<TurnContext>) {
|
||||
exit_review_mode(session.clone_session(), None, ctx).await;
|
||||
exit_review_mode(session.clone_session(), /*review_output*/ None, ctx).await;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,8 +121,8 @@ async fn start_review_conversation(
|
||||
ctx.clone(),
|
||||
cancellation_token,
|
||||
SubAgentSource::Review,
|
||||
None,
|
||||
None,
|
||||
/*final_output_json_schema*/ None,
|
||||
/*initial_history*/ None,
|
||||
)
|
||||
.await)
|
||||
.ok()
|
||||
@@ -217,7 +217,7 @@ pub(crate) async fn exit_review_mode(
|
||||
findings_str.push_str(text);
|
||||
}
|
||||
if !out.findings.is_empty() {
|
||||
let block = format_review_findings_block(&out.findings, None);
|
||||
let block = format_review_findings_block(&out.findings, /*selection*/ None);
|
||||
findings_str.push_str(&format!("\n{block}"));
|
||||
}
|
||||
let rendered =
|
||||
|
||||
@@ -42,11 +42,11 @@ impl SessionTask for UndoTask {
|
||||
_input: Vec<UserInput>,
|
||||
cancellation_token: CancellationToken,
|
||||
) -> Option<String> {
|
||||
let _ = session
|
||||
.session
|
||||
.services
|
||||
.session_telemetry
|
||||
.counter("codex.task.undo", 1, &[]);
|
||||
let _ = session.session.services.session_telemetry.counter(
|
||||
"codex.task.undo",
|
||||
/*inc*/ 1,
|
||||
&[],
|
||||
);
|
||||
let sess = session.clone_session();
|
||||
sess.send_event(
|
||||
ctx.as_ref(),
|
||||
|
||||
@@ -101,7 +101,7 @@ pub(crate) async fn execute_user_shell_command(
|
||||
session
|
||||
.services
|
||||
.session_telemetry
|
||||
.counter("codex.task.user_shell", 1, &[]);
|
||||
.counter("codex.task.user_shell", /*inc*/ 1, &[]);
|
||||
|
||||
if mode == UserShellCommandMode::StandaloneTurn {
|
||||
// Auxiliary mode runs within an existing active turn. That turn already
|
||||
@@ -185,9 +185,14 @@ pub(crate) async fn execute_user_shell_command(
|
||||
tx_event: session.get_tx_event(),
|
||||
});
|
||||
|
||||
let exec_result = execute_exec_request(exec_env, &sandbox_policy, stdout_stream, None)
|
||||
.or_cancel(&cancellation_token)
|
||||
.await;
|
||||
let exec_result = execute_exec_request(
|
||||
exec_env,
|
||||
&sandbox_policy,
|
||||
stdout_stream,
|
||||
/*after_spawn*/ None,
|
||||
)
|
||||
.or_cancel(&cancellation_token)
|
||||
.await;
|
||||
|
||||
match exec_result {
|
||||
Err(CancelErr::Cancelled) => {
|
||||
|
||||
Reference in New Issue
Block a user