chore: clean up argument-comment lint and roll out all-target CI on macOS (#16054)

## Why

`argument-comment-lint` was green in CI even though the repo still had
many uncommented literal arguments. The main gap was target coverage:
the repo wrapper did not force Cargo to inspect test-only call sites, so
examples like the `latest_session_lookup_params(true, ...)` tests in
`codex-rs/tui_app_server/src/lib.rs` never entered the blocking CI path.

This change cleans up the existing backlog, makes the default repo lint
path cover all Cargo targets, and starts rolling that stricter CI
enforcement out on the platform where it is currently validated.

## What changed

- mechanically fixed existing `argument-comment-lint` violations across
the `codex-rs` workspace, including tests, examples, and benches
- updated `tools/argument-comment-lint/run-prebuilt-linter.sh` and
`tools/argument-comment-lint/run.sh` so non-`--fix` runs default to
`--all-targets` unless the caller explicitly narrows the target set
- fixed both wrappers so forwarded cargo arguments after `--` are
preserved with a single separator
- documented the new default behavior in
`tools/argument-comment-lint/README.md`
- updated `rust-ci` so the macOS lint lane keeps the plain wrapper
invocation and therefore enforces `--all-targets`, while Linux and
Windows temporarily pass `-- --lib --bins`

That temporary CI split keeps the stricter all-targets check where it is
already cleaned up, while leaving room to finish the remaining Linux-
and Windows-specific target-gated cleanup before enabling
`--all-targets` on those runners. The Linux and Windows failures on the
intermediate revision were caused by the wrapper forwarding bug, not by
additional lint findings in those lanes.

## Validation

- `bash -n tools/argument-comment-lint/run.sh`
- `bash -n tools/argument-comment-lint/run-prebuilt-linter.sh`
- shell-level wrapper forwarding check for `-- --lib --bins`
- shell-level wrapper forwarding check for `-- --tests`
- `just argument-comment-lint`
- `cargo test` in `tools/argument-comment-lint`
- `cargo test -p codex-terminal-detection`

## Follow-up

- Clean up remaining Linux-only target-gated callsites, then switch the
Linux lint lane back to the plain wrapper invocation.
- Clean up remaining Windows-only target-gated callsites, then switch
the Windows lint lane back to the plain wrapper invocation.
This commit is contained in:
Michael Bolin
2026-03-27 19:00:44 -07:00
committed by GitHub
parent ed977b42ac
commit 61dfe0b86c
307 changed files with 7724 additions and 4710 deletions

View File

@@ -252,7 +252,7 @@ async fn code_mode_can_return_exec_command_output() -> Result<()> {
r#"
text(JSON.stringify(await tools.exec_command({ cmd: "printf code_mode_exec_marker" })));
"#,
false,
/*include_apply_patch*/ false,
)
.await?;
@@ -264,9 +264,9 @@ text(JSON.stringify(await tools.exec_command({ cmd: "printf code_mode_exec_marke
r"(?s)\A",
r"Script completed\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&items, 0),
text_item(&items, /*index*/ 0),
);
let parsed: Value = serde_json::from_str(text_item(&items, 1))?;
let parsed: Value = serde_json::from_str(text_item(&items, /*index*/ 1))?;
assert!(
parsed
.get("chunk_id")
@@ -378,7 +378,7 @@ const result = await tools.update_plan({
});
text(JSON.stringify(result));
"#,
false,
/*include_apply_patch*/ false,
)
.await?;
@@ -483,7 +483,7 @@ text(JSON.stringify(results));
.expect("parallel code mode run should send a completion request");
let items = custom_tool_output_items(&req, "call-1");
assert_eq!(items.len(), 2);
assert_eq!(text_item(&items, 1), "[\"ok\",\"ok\"]");
assert_eq!(text_item(&items, /*index*/ 1), "[\"ok\",\"ok\"]");
Ok(())
}
@@ -503,7 +503,7 @@ text(JSON.stringify(await tools.exec_command({
max_output_tokens: 100
})));
"#,
false,
/*include_apply_patch*/ false,
)
.await?;
@@ -515,7 +515,7 @@ text(JSON.stringify(await tools.exec_command({
r"(?s)\A",
r"Script completed\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&items, 0),
text_item(&items, /*index*/ 0),
);
let expected_pattern = r#"(?sx)
\A
@@ -524,7 +524,7 @@ Total\ output\ lines:\ 1\n
.*…\d+\ tokens\ truncated….*
\z
"#;
assert_regex_match(expected_pattern, text_item(&items, 1));
assert_regex_match(expected_pattern, text_item(&items, /*index*/ 1));
Ok(())
}
@@ -542,7 +542,7 @@ text("before crash");
text("still before crash");
throw new Error("boom");
"#,
false,
/*include_apply_patch*/ false,
)
.await?;
@@ -554,10 +554,10 @@ throw new Error("boom");
r"(?s)\A",
r"Script failed\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&items, 0),
text_item(&items, /*index*/ 0),
);
assert_eq!(text_item(&items, 1), "before crash");
assert_eq!(text_item(&items, 2), "still before crash");
assert_eq!(text_item(&items, /*index*/ 1), "before crash");
assert_eq!(text_item(&items, /*index*/ 2), "still before crash");
assert_regex_match(
r#"(?sx)
\A
@@ -566,7 +566,7 @@ Error:\ boom\n
(?:\s+at\ .+\n?)+
\z
"#,
text_item(&items, 3),
text_item(&items, /*index*/ 3),
);
Ok(())
@@ -589,7 +589,7 @@ try {
text(`caught:${error?.message ?? String(error)}`);
}
"#,
false,
/*include_apply_patch*/ false,
)
.await?;
@@ -666,10 +666,10 @@ text("phase 3");
r"(?s)\A",
r"Script running with cell ID \d+\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&first_items, 0),
text_item(&first_items, /*index*/ 0),
);
assert_eq!(text_item(&first_items, 1), "phase 1");
let cell_id = extract_running_cell_id(text_item(&first_items, 0));
assert_eq!(text_item(&first_items, /*index*/ 1), "phase 1");
let cell_id = extract_running_cell_id(text_item(&first_items, /*index*/ 0));
responses::mount_sse_once(
&server,
@@ -707,13 +707,13 @@ text("phase 3");
r"(?s)\A",
r"Script running with cell ID \d+\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&second_items, 0),
text_item(&second_items, /*index*/ 0),
);
assert_eq!(
extract_running_cell_id(text_item(&second_items, 0)),
extract_running_cell_id(text_item(&second_items, /*index*/ 0)),
cell_id
);
assert_eq!(text_item(&second_items, 1), "phase 2");
assert_eq!(text_item(&second_items, /*index*/ 1), "phase 2");
responses::mount_sse_once(
&server,
@@ -751,9 +751,9 @@ text("phase 3");
r"(?s)\A",
r"Script completed\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&third_items, 0),
text_item(&third_items, /*index*/ 0),
);
assert_eq!(text_item(&third_items, 1), "phase 3");
assert_eq!(text_item(&third_items, /*index*/ 1), "phase 3");
Ok(())
}
@@ -806,10 +806,10 @@ while (true) {}
r"(?s)\A",
r"Script running with cell ID \d+\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&first_items, 0),
text_item(&first_items, /*index*/ 0),
);
assert_eq!(text_item(&first_items, 1), "phase 1");
let cell_id = extract_running_cell_id(text_item(&first_items, 0));
assert_eq!(text_item(&first_items, /*index*/ 1), "phase 1");
let cell_id = extract_running_cell_id(text_item(&first_items, /*index*/ 0));
responses::mount_sse_once(
&server,
@@ -846,7 +846,7 @@ while (true) {}
r"(?s)\A",
r"Script terminated\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&second_items, 0),
text_item(&second_items, /*index*/ 0),
);
Ok(())
@@ -907,8 +907,8 @@ text("session b done");
let first_request = first_completion.single_request();
let first_items = custom_tool_output_items(&first_request, "call-1");
assert_eq!(first_items.len(), 2);
let session_a_id = extract_running_cell_id(text_item(&first_items, 0));
assert_eq!(text_item(&first_items, 1), "session a start");
let session_a_id = extract_running_cell_id(text_item(&first_items, /*index*/ 0));
assert_eq!(text_item(&first_items, /*index*/ 1), "session a start");
responses::mount_sse_once(
&server,
@@ -933,8 +933,8 @@ text("session b done");
let second_request = second_completion.single_request();
let second_items = custom_tool_output_items(&second_request, "call-2");
assert_eq!(second_items.len(), 2);
let session_b_id = extract_running_cell_id(text_item(&second_items, 0));
assert_eq!(text_item(&second_items, 1), "session b start");
let session_b_id = extract_running_cell_id(text_item(&second_items, /*index*/ 0));
assert_eq!(text_item(&second_items, /*index*/ 1), "session b start");
assert_ne!(session_a_id, session_b_id);
fs::write(&session_a_gate, "ready")?;
@@ -973,9 +973,9 @@ text("session b done");
r"(?s)\A",
r"Script completed\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&third_items, 0),
text_item(&third_items, /*index*/ 0),
);
assert_eq!(text_item(&third_items, 1), "session a done");
assert_eq!(text_item(&third_items, /*index*/ 1), "session a done");
fs::write(&session_b_gate, "ready")?;
responses::mount_sse_once(
@@ -1013,9 +1013,9 @@ text("session b done");
r"(?s)\A",
r"Script completed\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&fourth_items, 0),
text_item(&fourth_items, /*index*/ 0),
);
assert_eq!(text_item(&fourth_items, 1), "session b done");
assert_eq!(text_item(&fourth_items, /*index*/ 1), "session b done");
Ok(())
}
@@ -1065,8 +1065,8 @@ text("phase 2");
let first_request = first_completion.single_request();
let first_items = custom_tool_output_items(&first_request, "call-1");
assert_eq!(first_items.len(), 2);
let cell_id = extract_running_cell_id(text_item(&first_items, 0));
assert_eq!(text_item(&first_items, 1), "phase 1");
let cell_id = extract_running_cell_id(text_item(&first_items, /*index*/ 0));
assert_eq!(text_item(&first_items, /*index*/ 1), "phase 1");
responses::mount_sse_once(
&server,
@@ -1103,7 +1103,7 @@ text("phase 2");
r"(?s)\A",
r"Script terminated\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&second_items, 0),
text_item(&second_items, /*index*/ 0),
);
responses::mount_sse_once(
@@ -1140,9 +1140,9 @@ text("after terminate");
r"(?s)\A",
r"Script completed\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&third_items, 0),
text_item(&third_items, /*index*/ 0),
);
assert_eq!(text_item(&third_items, 1), "after terminate");
assert_eq!(text_item(&third_items, /*index*/ 1), "after terminate");
Ok(())
}
@@ -1197,10 +1197,10 @@ async fn code_mode_wait_returns_error_for_unknown_session() -> Result<()> {
r"(?s)\A",
r"Script failed\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&items, 0),
text_item(&items, /*index*/ 0),
);
assert_eq!(
text_item(&items, 1),
text_item(&items, /*index*/ 1),
"Script error:\nexec cell 999999 not found"
);
@@ -1268,8 +1268,8 @@ text("session b done");
let first_request = first_completion.single_request();
let first_items = custom_tool_output_items(&first_request, "call-1");
assert_eq!(first_items.len(), 2);
let session_a_id = extract_running_cell_id(text_item(&first_items, 0));
assert_eq!(text_item(&first_items, 1), "session a start");
let session_a_id = extract_running_cell_id(text_item(&first_items, /*index*/ 0));
assert_eq!(text_item(&first_items, /*index*/ 1), "session a start");
responses::mount_sse_once(
&server,
@@ -1294,8 +1294,8 @@ text("session b done");
let second_request = second_completion.single_request();
let second_items = custom_tool_output_items(&second_request, "call-2");
assert_eq!(second_items.len(), 2);
let session_b_id = extract_running_cell_id(text_item(&second_items, 0));
assert_eq!(text_item(&second_items, 1), "session b start");
let session_b_id = extract_running_cell_id(text_item(&second_items, /*index*/ 0));
assert_eq!(text_item(&second_items, /*index*/ 1), "session b start");
fs::write(&session_a_gate, "ready")?;
responses::mount_sse_once(
@@ -1333,10 +1333,10 @@ text("session b done");
r"(?s)\A",
r"Script running with cell ID \d+\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&third_items, 0),
text_item(&third_items, /*index*/ 0),
);
assert_eq!(
extract_running_cell_id(text_item(&third_items, 0)),
extract_running_cell_id(text_item(&third_items, /*index*/ 0)),
session_b_id
);
@@ -1384,7 +1384,7 @@ text("session b done");
r"(?s)\A",
r"Script terminated\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&fourth_items, 0),
text_item(&fourth_items, /*index*/ 0),
);
}
2 => {
@@ -1393,9 +1393,9 @@ text("session b done");
r"(?s)\A",
r"Script (?:completed|terminated)\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&fourth_items, 0),
text_item(&fourth_items, /*index*/ 0),
);
assert_eq!(text_item(&fourth_items, 1), "session a done");
assert_eq!(text_item(&fourth_items, /*index*/ 1), "session a done");
}
other => panic!("unexpected number of content items: {other}"),
}
@@ -1455,9 +1455,9 @@ text("after yield");
r"(?s)\A",
r"Script running with cell ID \d+\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&first_items, 0),
text_item(&first_items, /*index*/ 0),
);
assert_eq!(text_item(&first_items, 1), "before yield");
assert_eq!(text_item(&first_items, /*index*/ 1), "before yield");
responses::mount_sse_once(
&server,
@@ -1541,8 +1541,8 @@ text("token one token two token three token four token five token six token seve
let first_request = first_completion.single_request();
let first_items = custom_tool_output_items(&first_request, "call-1");
assert_eq!(first_items.len(), 2);
assert_eq!(text_item(&first_items, 1), "phase 1");
let cell_id = extract_running_cell_id(text_item(&first_items, 0));
assert_eq!(text_item(&first_items, /*index*/ 1), "phase 1");
let cell_id = extract_running_cell_id(text_item(&first_items, /*index*/ 0));
fs::write(&completion_gate, "ready")?;
responses::mount_sse_once(
@@ -1581,7 +1581,7 @@ text("token one token two token three token four token five token six token seve
r"(?s)\A",
r"Script completed\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&second_items, 0),
text_item(&second_items, /*index*/ 0),
);
let expected_pattern = r#"(?sx)
\A
@@ -1590,7 +1590,7 @@ Total\ output\ lines:\ 1\n
.*…\d+\ tokens\ truncated….*
\z
"#;
assert_regex_match(expected_pattern, text_item(&second_items, 1));
assert_regex_match(expected_pattern, text_item(&second_items, /*index*/ 1));
Ok(())
}
@@ -1606,7 +1606,7 @@ async fn code_mode_can_output_serialized_text_via_global_helper() -> Result<()>
r#"
text({ json: true });
"#,
false,
/*include_apply_patch*/ false,
)
.await?;
@@ -1639,7 +1639,7 @@ notify("code_mode_notify_marker");
await tools.test_sync_tool({});
text("done");
"#,
false,
/*include_apply_patch*/ false,
)
.await?;
@@ -1677,7 +1677,7 @@ text("before");
exit();
text("after");
"#,
false,
/*include_apply_patch*/ false,
)
.await?;
@@ -1695,9 +1695,9 @@ text("after");
r"(?s)\A",
r"Script completed\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&items, 0),
text_item(&items, /*index*/ 0),
);
assert_eq!(text_item(&items, 1), "before");
assert_eq!(text_item(&items, /*index*/ 1), "before");
assert_eq!(output, "before");
Ok(())
@@ -1716,7 +1716,7 @@ const circular = {};
circular.self = circular;
text(circular);
"#,
false,
/*include_apply_patch*/ false,
)
.await?;
@@ -1736,10 +1736,10 @@ text(circular);
r"(?s)\A",
r"Script failed\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&items, 0),
text_item(&items, /*index*/ 0),
);
assert!(text_item(&items, 1).contains("Script error:"));
assert!(text_item(&items, 1).contains("Converting circular structure to JSON"));
assert!(text_item(&items, /*index*/ 1).contains("Script error:"));
assert!(text_item(&items, /*index*/ 1).contains("Converting circular structure to JSON"));
Ok(())
}
@@ -1756,7 +1756,7 @@ async fn code_mode_can_output_images_via_global_helper() -> Result<()> {
image("https://example.com/image.jpg");
image("data:image/png;base64,AAA");
"#,
false,
/*include_apply_patch*/ false,
)
.await?;
@@ -1774,7 +1774,7 @@ image("data:image/png;base64,AAA");
r"(?s)\A",
r"Script completed\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&items, 0),
text_item(&items, /*index*/ 0),
);
assert_eq!(
items[1],
@@ -1857,7 +1857,7 @@ image(out);
r"(?s)\A",
r"Script completed\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&items, 0),
text_item(&items, /*index*/ 0),
);
assert_eq!(
@@ -1889,8 +1889,13 @@ async fn code_mode_can_apply_patch_via_nested_tool() -> Result<()> {
);
let code = format!("text(await tools.apply_patch({patch:?}));\n");
let (test, second_mock) =
run_code_mode_turn(&server, "use exec to run apply_patch", &code, true).await?;
let (test, second_mock) = run_code_mode_turn(
&server,
"use exec to run apply_patch",
&code,
/*include_apply_patch*/ true,
)
.await?;
let req = second_mock.single_request();
let items = custom_tool_output_items(&req, "call-1");
@@ -1908,9 +1913,9 @@ async fn code_mode_can_apply_patch_via_nested_tool() -> Result<()> {
r"(?s)\A",
r"Script completed\nWall time \d+\.\d seconds\nOutput:\n\z"
),
text_item(&items, 0),
text_item(&items, /*index*/ 0),
);
assert_eq!(text_item(&items, 1), "{}");
assert_eq!(text_item(&items, /*index*/ 1), "{}");
let file_path = test.cwd_path().join(file_name);
assert_eq!(fs::read_to_string(&file_path)?, "hello from code_mode\n");
@@ -2183,8 +2188,13 @@ const tool = ALL_TOOLS.find(({ name }) => name === "view_image");
text(JSON.stringify(tool));
"#;
let (_test, second_mock) =
run_code_mode_turn(&server, "use exec to inspect ALL_TOOLS", code, false).await?;
let (_test, second_mock) = run_code_mode_turn(
&server,
"use exec to inspect ALL_TOOLS",
code,
/*include_apply_patch*/ false,
)
.await?;
let req = second_mock.single_request();
let (output, success) = custom_tool_output_body_and_success(&req, "call-1");
@@ -2273,7 +2283,7 @@ async fn code_mode_can_call_hidden_dynamic_tools() -> Result<()> {
}),
defer_loading: true,
}],
false,
/*persist_extended_history*/ false,
)
.await?;
let mut test = base_test;