mirror of
https://github.com/openai/codex.git
synced 2026-11-19 23:05:23 +00: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:
1 parent
6f05d8d735
commit
b77fe8fefe
261 files changed
+2311
-1377
No files matched your search
+62
-39
@@ -236,10 +236,10 @@ fn emit_skill_load_warnings(app_event_tx: &AppEventSender, errors: &[SkillErrorI
|
||||
fn emit_project_config_warnings(app_event_tx: &AppEventSender, config: &Config) {
|
||||
let mut disabled_folders = Vec::new();
|
||||
|
||||
for layer in config
|
||||
.config_layer_stack
|
||||
.get_layers(ConfigLayerStackOrdering::LowestPrecedenceFirst, true)
|
||||
{
|
||||
for layer in config.config_layer_stack.get_layers(
|
||||
ConfigLayerStackOrdering::LowestPrecedenceFirst,
|
||||
/*include_disabled*/ true,
|
||||
) {
|
||||
let ConfigLayerSource::Project { dot_codex_folder } = &layer.name else {
|
||||
continue;
|
||||
};
|
||||
@@ -1127,8 +1127,10 @@ impl App {
|
||||
}
|
||||
|
||||
if let Some(label) = permissions_history_label {
|
||||
self.chat_widget
|
||||
.add_info_message(format!("Permissions updated to {label}"), None);
|
||||
self.chat_widget.add_info_message(
|
||||
format!("Permissions updated to {label}"),
|
||||
/*hint*/ None,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1140,7 +1142,7 @@ impl App {
|
||||
}
|
||||
|
||||
self.chat_widget
|
||||
.add_info_message(format!("Opened {url} in your browser."), None);
|
||||
.add_info_message(format!("Opened {url} in your browser."), /*hint*/ None);
|
||||
}
|
||||
|
||||
fn clear_ui_header_lines_with_version(
|
||||
@@ -1256,7 +1258,7 @@ impl App {
|
||||
if self.active_thread_id.is_some() {
|
||||
return;
|
||||
}
|
||||
self.set_thread_active(thread_id, true).await;
|
||||
self.set_thread_active(thread_id, /*active*/ true).await;
|
||||
let receiver = if let Some(channel) = self.thread_event_channels.get_mut(&thread_id) {
|
||||
channel.receiver.take()
|
||||
} else {
|
||||
@@ -1297,7 +1299,7 @@ impl App {
|
||||
|
||||
async fn clear_active_thread(&mut self) {
|
||||
if let Some(active_id) = self.active_thread_id.take() {
|
||||
self.set_thread_active(active_id, false).await;
|
||||
self.set_thread_active(active_id, /*active*/ false).await;
|
||||
}
|
||||
self.active_thread_rx = None;
|
||||
self.refresh_pending_thread_approvals().await;
|
||||
@@ -1578,7 +1580,10 @@ impl App {
|
||||
let thread_id = session.session_id;
|
||||
self.primary_thread_id = Some(thread_id);
|
||||
self.primary_session_configured = Some(session.clone());
|
||||
self.upsert_agent_picker_thread(thread_id, None, None, false);
|
||||
self.upsert_agent_picker_thread(
|
||||
thread_id, /*agent_nickname*/ None, /*agent_role*/ None,
|
||||
/*is_closed*/ false,
|
||||
);
|
||||
self.ensure_thread_channel(thread_id);
|
||||
self.activate_thread_channel(thread_id).await;
|
||||
self.enqueue_thread_event(thread_id, event).await?;
|
||||
@@ -1609,7 +1614,7 @@ impl App {
|
||||
thread_id,
|
||||
session_source.get_nickname(),
|
||||
session_source.get_agent_role(),
|
||||
false,
|
||||
/*is_closed*/ false,
|
||||
);
|
||||
}
|
||||
Err(_) => {
|
||||
@@ -1628,7 +1633,7 @@ impl App {
|
||||
|
||||
if self.agent_navigation.is_empty() {
|
||||
self.chat_widget
|
||||
.add_info_message("No agents available yet.".to_string(), None);
|
||||
.add_info_message("No agents available yet.".to_string(), /*hint*/ None);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1751,7 +1756,7 @@ impl App {
|
||||
if is_replay_only {
|
||||
self.chat_widget.add_info_message(
|
||||
format!("Agent thread {thread_id} is closed. Replaying saved transcript."),
|
||||
None,
|
||||
/*hint*/ None,
|
||||
);
|
||||
}
|
||||
self.drain_active_thread_events(tui).await?;
|
||||
@@ -1904,13 +1909,15 @@ impl App {
|
||||
if let Some(event) = snapshot.session_configured {
|
||||
self.handle_codex_event_replay(event);
|
||||
}
|
||||
self.chat_widget.set_queue_autosend_suppressed(true);
|
||||
self.chat_widget
|
||||
.set_queue_autosend_suppressed(/*suppressed*/ true);
|
||||
self.chat_widget
|
||||
.restore_thread_input_state(snapshot.input_state);
|
||||
for event in snapshot.events {
|
||||
self.handle_codex_event_replay(event);
|
||||
}
|
||||
self.chat_widget.set_queue_autosend_suppressed(false);
|
||||
self.chat_widget
|
||||
.set_queue_autosend_suppressed(/*suppressed*/ false);
|
||||
if resume_restored_queue {
|
||||
self.chat_widget.maybe_send_next_queued_input();
|
||||
}
|
||||
@@ -2025,7 +2032,7 @@ impl App {
|
||||
.as_ref()
|
||||
.is_some_and(|cmd| !cmd.is_empty())
|
||||
{
|
||||
session_telemetry.counter("codex.status_line", 1, &[]);
|
||||
session_telemetry.counter("codex.status_line", /*inc*/ 1, &[]);
|
||||
}
|
||||
|
||||
let status_line_invalid_items_warned = Arc::new(AtomicBool::new(false));
|
||||
@@ -2067,7 +2074,7 @@ impl App {
|
||||
config.clone(),
|
||||
target_session.path.clone(),
|
||||
auth_manager.clone(),
|
||||
None,
|
||||
/*parent_trace*/ None,
|
||||
)
|
||||
.await
|
||||
.wrap_err_with(|| {
|
||||
@@ -2098,14 +2105,18 @@ impl App {
|
||||
ChatWidget::new_from_existing(init, resumed.thread, resumed.session_configured)
|
||||
}
|
||||
SessionSelection::Fork(target_session) => {
|
||||
session_telemetry.counter("codex.thread.fork", 1, &[("source", "cli_subcommand")]);
|
||||
session_telemetry.counter(
|
||||
"codex.thread.fork",
|
||||
/*inc*/ 1,
|
||||
&[("source", "cli_subcommand")],
|
||||
);
|
||||
let forked = thread_manager
|
||||
.fork_thread(
|
||||
usize::MAX,
|
||||
config.clone(),
|
||||
target_session.path.clone(),
|
||||
false,
|
||||
None,
|
||||
/*persist_extended_history*/ false,
|
||||
/*parent_trace*/ None,
|
||||
)
|
||||
.await
|
||||
.wrap_err_with(|| {
|
||||
@@ -2406,13 +2417,19 @@ impl App {
|
||||
self.start_fresh_session_with_summary_hint(tui).await;
|
||||
}
|
||||
AppEvent::ClearUi => {
|
||||
self.clear_terminal_ui(tui, false)?;
|
||||
self.clear_terminal_ui(tui, /*redraw_header*/ false)?;
|
||||
self.reset_app_ui_state_after_clear();
|
||||
|
||||
self.start_fresh_session_with_summary_hint(tui).await;
|
||||
}
|
||||
AppEvent::OpenResumePicker => {
|
||||
match crate::resume_picker::run_resume_picker(tui, &self.config, false).await? {
|
||||
match crate::resume_picker::run_resume_picker(
|
||||
tui,
|
||||
&self.config,
|
||||
/*show_all*/ false,
|
||||
)
|
||||
.await?
|
||||
{
|
||||
SessionSelection::Resume(target_session) => {
|
||||
let current_cwd = self.config.cwd.clone();
|
||||
let resume_cwd = match crate::resolve_cwd_for_resume_or_fork(
|
||||
@@ -2422,7 +2439,7 @@ impl App {
|
||||
target_session.thread_id,
|
||||
&target_session.path,
|
||||
CwdPromptAction::Resume,
|
||||
true,
|
||||
/*allow_prompt*/ true,
|
||||
)
|
||||
.await?
|
||||
{
|
||||
@@ -2456,7 +2473,7 @@ impl App {
|
||||
resume_config.clone(),
|
||||
target_session.path.clone(),
|
||||
self.auth_manager.clone(),
|
||||
None,
|
||||
/*parent_trace*/ None,
|
||||
)
|
||||
.await
|
||||
{
|
||||
@@ -2507,7 +2524,7 @@ impl App {
|
||||
AppEvent::ForkCurrentSession => {
|
||||
self.session_telemetry.counter(
|
||||
"codex.thread.fork",
|
||||
1,
|
||||
/*inc*/ 1,
|
||||
&[("source", "slash_command")],
|
||||
);
|
||||
let summary = session_summary(
|
||||
@@ -2525,7 +2542,13 @@ impl App {
|
||||
if path.exists() {
|
||||
match self
|
||||
.server
|
||||
.fork_thread(usize::MAX, self.config.clone(), path.clone(), false, None)
|
||||
.fork_thread(
|
||||
usize::MAX,
|
||||
self.config.clone(),
|
||||
path.clone(),
|
||||
/*persist_extended_history*/ false,
|
||||
/*parent_trace*/ None,
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(forked) => {
|
||||
@@ -2777,7 +2800,7 @@ impl App {
|
||||
AppEvent::OpenWindowsSandboxFallbackPrompt { preset } => {
|
||||
self.session_telemetry.counter(
|
||||
"codex.windows_sandbox.fallback_prompt_shown",
|
||||
1,
|
||||
/*inc*/ 1,
|
||||
&[],
|
||||
);
|
||||
self.chat_widget.clear_windows_sandbox_setup_status();
|
||||
@@ -2971,7 +2994,7 @@ impl App {
|
||||
self.chat_widget
|
||||
.add_to_history(history_cell::new_info_event(
|
||||
format!("Sandbox read access granted for {}", path.display()),
|
||||
None,
|
||||
/*hint*/ None,
|
||||
));
|
||||
}
|
||||
},
|
||||
@@ -3106,7 +3129,7 @@ impl App {
|
||||
message.push_str(profile);
|
||||
message.push_str(" profile");
|
||||
}
|
||||
self.chat_widget.add_info_message(message, None);
|
||||
self.chat_widget.add_info_message(message, /*hint*/ None);
|
||||
}
|
||||
Err(err) => {
|
||||
tracing::error!(
|
||||
@@ -3140,7 +3163,7 @@ impl App {
|
||||
message.push_str(profile);
|
||||
message.push_str(" profile");
|
||||
}
|
||||
self.chat_widget.add_info_message(message, None);
|
||||
self.chat_widget.add_info_message(message, /*hint*/ None);
|
||||
}
|
||||
Err(err) => {
|
||||
tracing::error!(
|
||||
@@ -3176,7 +3199,7 @@ impl App {
|
||||
message.push_str(profile);
|
||||
message.push_str(" profile");
|
||||
}
|
||||
self.chat_widget.add_info_message(message, None);
|
||||
self.chat_widget.add_info_message(message, /*hint*/ None);
|
||||
}
|
||||
Err(err) => {
|
||||
tracing::error!(error = %err, "failed to persist fast mode selection");
|
||||
@@ -3223,7 +3246,7 @@ impl App {
|
||||
let selection = name.unwrap_or_else(|| "System default".to_string());
|
||||
self.chat_widget.add_info_message(
|
||||
format!("Realtime {} set to {selection}", kind.noun()),
|
||||
None,
|
||||
/*hint*/ None,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3369,7 +3392,7 @@ impl App {
|
||||
}
|
||||
AppEvent::PersistFullAccessWarningAcknowledged => {
|
||||
if let Err(err) = ConfigEditsBuilder::new(&self.config.codex_home)
|
||||
.set_hide_full_access_warning(true)
|
||||
.set_hide_full_access_warning(/*acknowledged*/ true)
|
||||
.apply()
|
||||
.await
|
||||
{
|
||||
@@ -3384,7 +3407,7 @@ impl App {
|
||||
}
|
||||
AppEvent::PersistWorldWritableWarningAcknowledged => {
|
||||
if let Err(err) = ConfigEditsBuilder::new(&self.config.codex_home)
|
||||
.set_hide_world_writable_warning(true)
|
||||
.set_hide_world_writable_warning(/*acknowledged*/ true)
|
||||
.apply()
|
||||
.await
|
||||
{
|
||||
@@ -3399,7 +3422,7 @@ impl App {
|
||||
}
|
||||
AppEvent::PersistRateLimitSwitchPromptHidden => {
|
||||
if let Err(err) = ConfigEditsBuilder::new(&self.config.codex_home)
|
||||
.set_hide_rate_limit_model_nudge(true)
|
||||
.set_hide_rate_limit_model_nudge(/*acknowledged*/ true)
|
||||
.apply()
|
||||
.await
|
||||
{
|
||||
@@ -3795,7 +3818,7 @@ impl App {
|
||||
format!(
|
||||
"Agent thread {closed_thread_id} closed. Switched back to main thread."
|
||||
),
|
||||
None,
|
||||
/*hint*/ None,
|
||||
);
|
||||
} else {
|
||||
self.clear_active_thread().await;
|
||||
@@ -3834,7 +3857,7 @@ impl App {
|
||||
thread_id,
|
||||
config_snapshot.session_source.get_nickname(),
|
||||
config_snapshot.session_source.get_agent_role(),
|
||||
false,
|
||||
/*is_closed*/ false,
|
||||
);
|
||||
let event = Event {
|
||||
id: String::new(),
|
||||
@@ -4002,7 +4025,7 @@ impl App {
|
||||
fn reset_external_editor_state(&mut self, tui: &mut tui::Tui) {
|
||||
self.chat_widget
|
||||
.set_external_editor_state(ExternalEditorState::Closed);
|
||||
self.chat_widget.set_footer_hint_override(None);
|
||||
self.chat_widget.set_footer_hint_override(/*items*/ None);
|
||||
tui.frame_requester().schedule_frame();
|
||||
}
|
||||
|
||||
@@ -4066,7 +4089,7 @@ impl App {
|
||||
if !self.chat_widget.can_run_ctrl_l_clear_now() {
|
||||
return;
|
||||
}
|
||||
if let Err(err) = self.clear_terminal_ui(tui, false) {
|
||||
if let Err(err) = self.clear_terminal_ui(tui, /*redraw_header*/ false) {
|
||||
tracing::warn!(error = %err, "failed to clear terminal UI");
|
||||
self.chat_widget
|
||||
.add_error_message(format!("Failed to clear terminal UI: {err}"));
|
||||
|
||||
Reference in new issue
Block a user