From b25c9d75e829fe94e9d8f4808e957bdbdf1fa22f Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Fri, 13 Mar 2026 17:34:58 -0700 Subject: [PATCH] Apply argument comment lint across codex-rs --- .github/workflows/rust-ci.yml | 44 ++++- codex-rs/app-server-protocol/src/export.rs | 4 +- .../src/protocol/thread_history.rs | 4 +- codex-rs/app-server-test-client/src/lib.rs | 4 +- codex-rs/app-server/src/app_server_tracing.rs | 2 +- .../app-server/src/bespoke_event_handling.rs | 4 +- .../app-server/src/codex_message_processor.rs | 66 ++++--- codex-rs/app-server/src/in_process.rs | 4 +- codex-rs/app-server/src/message_processor.rs | 8 +- codex-rs/app-server/src/outgoing_message.rs | 5 +- codex-rs/app-server/src/thread_state.rs | 2 +- codex-rs/app-server/src/thread_status.rs | 12 +- .../app-server/tests/common/mcp_process.rs | 5 +- codex-rs/apply-patch/src/lib.rs | 4 +- codex-rs/artifacts/src/runtime/js_runtime.rs | 2 +- codex-rs/backend-client/src/client.rs | 4 +- codex-rs/chatgpt/src/chatgpt_client.rs | 2 +- codex-rs/chatgpt/src/connectors.rs | 6 +- codex-rs/cli/src/debug_sandbox.rs | 4 +- codex-rs/cli/src/mcp_cmd.rs | 2 +- codex-rs/cloud-requirements/src/lib.rs | 8 +- codex-rs/cloud-tasks-client/src/http.rs | 12 +- codex-rs/cloud-tasks-client/src/mock.rs | 7 +- codex-rs/cloud-tasks/src/lib.rs | 23 ++- codex-rs/cloud-tasks/src/new_task.rs | 2 +- codex-rs/cloud-tasks/src/ui.rs | 5 +- codex-rs/codex-api/src/endpoint/models.rs | 12 +- codex-rs/codex-api/src/rate_limits.rs | 2 +- codex-rs/codex-api/src/sse/responses.rs | 7 +- .../codex-experimental-api-macros/src/lib.rs | 2 +- codex-rs/config/src/config_requirements.rs | 31 ++- codex-rs/config/src/diagnostics.rs | 5 +- codex-rs/config/src/state.rs | 15 +- codex-rs/core/src/agent/control.rs | 6 +- codex-rs/core/src/agent/guards.rs | 4 +- codex-rs/core/src/auth.rs | 8 +- codex-rs/core/src/client.rs | 14 +- codex-rs/core/src/codex.rs | 38 ++-- codex-rs/core/src/codex_thread.rs | 4 +- codex-rs/core/src/compact.rs | 4 +- codex-rs/core/src/compact_remote.rs | 2 +- codex-rs/core/src/config/agent_roles.rs | 15 +- codex-rs/core/src/config/managed_features.rs | 11 +- codex-rs/core/src/config_loader/layer_io.rs | 13 +- codex-rs/core/src/config_loader/mod.rs | 13 +- codex-rs/core/src/connectors.rs | 17 +- codex-rs/core/src/default_client.rs | 4 +- codex-rs/core/src/environment_context.rs | 13 +- codex-rs/core/src/exec.rs | 4 +- codex-rs/core/src/external_agent_config.rs | 10 +- codex-rs/core/src/guardian.rs | 2 +- codex-rs/core/src/landlock.rs | 2 +- codex-rs/core/src/mcp/mod.rs | 2 +- codex-rs/core/src/mcp/skill_dependencies.rs | 2 +- codex-rs/core/src/mcp_tool_call.rs | 2 +- codex-rs/core/src/network_proxy_loader.rs | 2 +- codex-rs/core/src/personality_migration.rs | 18 +- codex-rs/core/src/plugins/manager.rs | 6 +- codex-rs/core/src/realtime_context.rs | 2 +- codex-rs/core/src/review_format.rs | 2 +- codex-rs/core/src/rollout/recorder.rs | 10 +- codex-rs/core/src/sandboxing/mod.rs | 8 +- codex-rs/core/src/seatbelt.rs | 11 +- codex-rs/core/src/shell.rs | 12 +- codex-rs/core/src/shell_snapshot.rs | 23 ++- codex-rs/core/src/state_db.rs | 6 +- codex-rs/core/src/tasks/regular.rs | 3 +- codex-rs/core/src/tasks/review.rs | 8 +- codex-rs/core/src/tasks/user_shell.rs | 11 +- codex-rs/core/src/terminal.rs | 60 +++++- codex-rs/core/src/thread_manager.rs | 43 ++-- .../src/tools/code_mode/execute_handler.rs | 5 +- codex-rs/core/src/tools/code_mode/mod.rs | 2 +- codex-rs/core/src/tools/context.rs | 2 +- codex-rs/core/src/tools/events.rs | 15 +- .../core/src/tools/handlers/agent_jobs.rs | 32 ++- codex-rs/core/src/tools/handlers/artifacts.rs | 8 +- codex-rs/core/src/tools/handlers/js_repl.rs | 10 +- .../handlers/multi_agents/resume_agent.rs | 6 +- .../src/tools/handlers/multi_agents/wait.rs | 2 +- codex-rs/core/src/tools/handlers/shell.rs | 14 +- codex-rs/core/src/tools/js_repl/mod.rs | 40 +++- codex-rs/core/src/tools/network_approval.rs | 8 +- codex-rs/core/src/tools/registry.rs | 2 +- .../core/src/tools/runtimes/apply_patch.rs | 15 +- codex-rs/core/src/tools/runtimes/shell.rs | 4 +- .../tools/runtimes/shell/unix_escalation.rs | 10 +- .../core/src/tools/runtimes/unified_exec.rs | 4 +- codex-rs/core/src/tools/spec.rs | 83 ++++---- codex-rs/core/src/turn_metadata.rs | 9 +- .../core/src/unified_exec/async_watcher.rs | 7 +- .../core/src/unified_exec/process_manager.rs | 2 +- codex-rs/core/tests/common/lib.rs | 4 +- codex-rs/core/tests/common/streaming_sse.rs | 12 +- codex-rs/core/tests/common/test_codex.rs | 20 +- codex-rs/core/tests/common/zsh_fork.rs | 2 +- codex-rs/debug-client/src/main.rs | 2 +- .../src/event_processor_with_human_output.rs | 17 +- .../src/event_processor_with_jsonl_output.rs | 8 +- .../execpolicy-legacy/src/policy_parser.rs | 2 +- codex-rs/execpolicy/src/execpolicycheck.rs | 2 +- codex-rs/execpolicy/src/rule.rs | 4 +- codex-rs/file-search/src/lib.rs | 2 +- codex-rs/hooks/src/engine/discovery.rs | 2 +- codex-rs/hooks/src/events/stop.rs | 18 +- codex-rs/lmstudio/src/client.rs | 2 +- codex-rs/login/src/device_code_auth.rs | 2 +- codex-rs/login/src/server.rs | 8 +- codex-rs/mcp-server/src/codex_tool_runner.rs | 4 +- codex-rs/network-proxy/src/certs.rs | 4 +- codex-rs/network-proxy/src/config.rs | 4 +- codex-rs/network-proxy/src/http_proxy.rs | 18 +- codex-rs/network-proxy/src/policy.rs | 16 +- codex-rs/network-proxy/src/runtime.rs | 2 +- codex-rs/network-proxy/src/upstream.rs | 2 +- codex-rs/otel/src/events/session_telemetry.rs | 20 +- codex-rs/rmcp-client/src/auth_status.rs | 8 +- .../rmcp-client/src/perform_oauth_login.rs | 6 +- codex-rs/rmcp-client/src/rmcp_client.rs | 34 ++-- codex-rs/state/src/bin/logs_client.rs | 18 +- codex-rs/state/src/runtime/memories.rs | 14 +- codex-rs/state/src/runtime/threads.rs | 4 +- codex-rs/tui/src/app.rs | 57 +++--- codex-rs/tui/src/app/agent_navigation.rs | 11 +- codex-rs/tui/src/app_backtrack.rs | 2 +- codex-rs/tui/src/ascii_animation.rs | 2 +- codex-rs/tui/src/bottom_pane/app_link_view.rs | 2 +- codex-rs/tui/src/bottom_pane/chat_composer.rs | 28 ++- codex-rs/tui/src/bottom_pane/command_popup.rs | 4 +- .../bottom_pane/experimental_features_view.rs | 2 +- .../tui/src/bottom_pane/file_search_popup.rs | 4 +- codex-rs/tui/src/bottom_pane/footer.rs | 9 +- .../src/bottom_pane/mcp_server_elicitation.rs | 22 ++- codex-rs/tui/src/bottom_pane/mod.rs | 41 ++-- .../src/bottom_pane/multi_select_picker.rs | 2 +- .../src/bottom_pane/request_user_input/mod.rs | 26 +-- codex-rs/tui/src/bottom_pane/skill_popup.rs | 4 +- .../tui/src/bottom_pane/skills_toggle_view.rs | 2 +- .../tui/src/bottom_pane/status_line_setup.rs | 4 +- codex-rs/tui/src/bottom_pane/textarea.rs | 22 +-- codex-rs/tui/src/chatwidget.rs | 185 +++++++++++------- codex-rs/tui/src/chatwidget/realtime.rs | 15 +- codex-rs/tui/src/chatwidget/skills.rs | 4 +- codex-rs/tui/src/cwd_prompt.rs | 17 +- codex-rs/tui/src/debug_config.rs | 2 +- codex-rs/tui/src/diff_render.rs | 20 +- codex-rs/tui/src/exec_cell/render.rs | 4 +- codex-rs/tui/src/history_cell.rs | 17 +- codex-rs/tui/src/lib.rs | 66 ++++--- codex-rs/tui/src/live_wrap.rs | 4 +- codex-rs/tui/src/markdown_render.rs | 26 ++- codex-rs/tui/src/model_migration.rs | 19 +- codex-rs/tui/src/multi_agents.rs | 14 +- codex-rs/tui/src/onboarding/auth.rs | 10 +- .../tui/src/onboarding/trust_directory.rs | 10 +- codex-rs/tui/src/pager_overlay.rs | 24 ++- .../tui/src/public_widgets/composer_input.rs | 10 +- codex-rs/tui/src/resume_picker.rs | 12 +- codex-rs/tui/src/selection_list.rs | 2 +- codex-rs/tui/src/status_indicator_widget.rs | 2 +- codex-rs/tui/src/streaming/controller.rs | 12 +- codex-rs/tui/src/theme_picker.rs | 18 +- codex-rs/tui/src/wrapping.rs | 2 +- codex-rs/utils/git/src/branch.rs | 8 +- codex-rs/utils/git/src/ghost_commits.rs | 16 +- codex-rs/utils/git/src/operations.rs | 6 +- codex-rs/utils/pty/src/pipe.rs | 2 +- 167 files changed, 1321 insertions(+), 725 deletions(-) diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index 46de51bc69..666cce1d19 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -14,6 +14,7 @@ jobs: name: Detect changed areas runs-on: ubuntu-24.04 outputs: + argument_comment_lint: ${{ steps.detect.outputs.argument_comment_lint }} codex: ${{ steps.detect.outputs.codex }} workflows: ${{ steps.detect.outputs.workflows }} steps: @@ -39,12 +40,15 @@ jobs: fi codex=false + argument_comment_lint=false workflows=false for f in "${files[@]}"; do [[ $f == codex-rs/* ]] && codex=true + [[ $f == codex-rs/* || $f == tools/argument-comment-lint/* || $f == justfile ]] && argument_comment_lint=true [[ $f == .github/* ]] && workflows=true done + echo "argument_comment_lint=$argument_comment_lint" >> "$GITHUB_OUTPUT" echo "codex=$codex" >> "$GITHUB_OUTPUT" echo "workflows=$workflows" >> "$GITHUB_OUTPUT" @@ -83,6 +87,26 @@ jobs: - name: cargo shear run: cargo shear + argument_comment_lint: + name: Argument comment lint + runs-on: ubuntu-24.04 + needs: changed + if: ${{ needs.changed.outputs.argument_comment_lint == 'true' || needs.changed.outputs.workflows == 'true' || github.event_name == 'push' }} + steps: + - uses: actions/checkout@v6 + - uses: dtolnay/rust-toolchain@nightly-2025-09-18 + with: + components: llvm-tools-preview, rustc-dev, rust-src + - name: Install cargo-dylint tooling + run: cargo install --locked cargo-dylint dylint-link + - name: Test argument comment lint package + working-directory: tools/argument-comment-lint + run: cargo test + - name: Run argument comment lint on codex-rs + run: | + bash -n tools/argument-comment-lint/run.sh + ./tools/argument-comment-lint/run.sh + # --- CI to validate on different os/targets -------------------------------- lint_build: name: Lint/Build — ${{ matrix.runner }} - ${{ matrix.target }}${{ matrix.profile == 'release' && ' (release)' || '' }} @@ -657,13 +681,14 @@ jobs: # --- Gatherer job that you mark as the ONLY required status ----------------- results: name: CI results (required) - needs: [changed, general, cargo_shear, lint_build, tests] + needs: [changed, general, cargo_shear, argument_comment_lint, lint_build, tests] if: always() runs-on: ubuntu-24.04 steps: - name: Summarize shell: bash run: | + echo "arglint: ${{ needs.argument_comment_lint.result }}" echo "general: ${{ needs.general.result }}" echo "shear : ${{ needs.cargo_shear.result }}" echo "lint : ${{ needs.lint_build.result }}" @@ -671,16 +696,21 @@ jobs: # If nothing relevant changed (PR touching only root README, etc.), # declare success regardless of other jobs. - if [[ '${{ needs.changed.outputs.codex }}' != 'true' && '${{ needs.changed.outputs.workflows }}' != 'true' && '${{ github.event_name }}' != 'push' ]]; then + if [[ '${{ needs.changed.outputs.argument_comment_lint }}' != 'true' && '${{ needs.changed.outputs.codex }}' != 'true' && '${{ needs.changed.outputs.workflows }}' != 'true' && '${{ github.event_name }}' != 'push' ]]; then echo 'No relevant changes -> CI not required.' exit 0 fi - # Otherwise require the jobs to have succeeded - [[ '${{ needs.general.result }}' == 'success' ]] || { echo 'general failed'; exit 1; } - [[ '${{ needs.cargo_shear.result }}' == 'success' ]] || { echo 'cargo_shear failed'; exit 1; } - [[ '${{ needs.lint_build.result }}' == 'success' ]] || { echo 'lint_build failed'; exit 1; } - [[ '${{ needs.tests.result }}' == 'success' ]] || { echo 'tests failed'; exit 1; } + if [[ '${{ needs.changed.outputs.argument_comment_lint }}' == 'true' || '${{ needs.changed.outputs.workflows }}' == 'true' || '${{ github.event_name }}' == 'push' ]]; then + [[ '${{ needs.argument_comment_lint.result }}' == 'success' ]] || { echo 'argument_comment_lint failed'; exit 1; } + fi + + if [[ '${{ needs.changed.outputs.codex }}' == 'true' || '${{ needs.changed.outputs.workflows }}' == 'true' || '${{ github.event_name }}' == 'push' ]]; then + [[ '${{ needs.general.result }}' == 'success' ]] || { echo 'general failed'; exit 1; } + [[ '${{ needs.cargo_shear.result }}' == 'success' ]] || { echo 'cargo_shear failed'; exit 1; } + [[ '${{ needs.lint_build.result }}' == 'success' ]] || { echo 'lint_build failed'; exit 1; } + [[ '${{ needs.tests.result }}' == 'success' ]] || { echo 'tests failed'; exit 1; } + fi - name: sccache summary note if: always() diff --git a/codex-rs/app-server-protocol/src/export.rs b/codex-rs/app-server-protocol/src/export.rs index 35c4eb7763..236df7ffd7 100644 --- a/codex-rs/app-server-protocol/src/export.rs +++ b/codex-rs/app-server-protocol/src/export.rs @@ -182,7 +182,7 @@ pub fn generate_ts_with_options( } pub fn generate_json(out_dir: &Path) -> Result<()> { - generate_json_with_experimental(out_dir, false) + generate_json_with_experimental(out_dir, /*experimental_api=*/ false) } pub fn generate_json_with_experimental(out_dir: &Path, experimental_api: bool) -> Result<()> { @@ -1984,7 +1984,7 @@ pub(crate) fn generate_index_ts_tree(tree: &mut BTreeMap) { if !v2_entries.is_empty() { tree.insert( PathBuf::from("v2").join("index.ts"), - index_ts_entries(&v2_entries, false), + index_ts_entries(&v2_entries, /*has_v2_ts=*/ false), ); } } diff --git a/codex-rs/app-server-protocol/src/protocol/thread_history.rs b/codex-rs/app-server-protocol/src/protocol/thread_history.rs index 65f2d99ff5..306ada3c17 100644 --- a/codex-rs/app-server-protocol/src/protocol/thread_history.rs +++ b/codex-rs/app-server-protocol/src/protocol/thread_history.rs @@ -201,7 +201,7 @@ impl ThreadHistoryBuilder { let mut turn = self .current_turn .take() - .unwrap_or_else(|| self.new_turn(None)); + .unwrap_or_else(|| self.new_turn(/*id=*/ None)); let id = self.next_item_id(); let content = self.build_user_inputs(payload); turn.items.push(ThreadItem::UserMessage { id, content }); @@ -937,7 +937,7 @@ impl ThreadHistoryBuilder { fn ensure_turn(&mut self) -> &mut PendingTurn { if self.current_turn.is_none() { - let turn = self.new_turn(None); + let turn = self.new_turn(/*id=*/ None); return self.current_turn.insert(turn); } diff --git a/codex-rs/app-server-test-client/src/lib.rs b/codex-rs/app-server-test-client/src/lib.rs index 3547bc5f10..db5d69c748 100644 --- a/codex-rs/app-server-test-client/src/lib.rs +++ b/codex-rs/app-server-test-client/src/lib.rs @@ -657,7 +657,7 @@ pub async fn send_message_v2( &endpoint, config_overrides, user_message, - true, + /*experimental_api=*/ true, dynamic_tools, ) .await @@ -1510,7 +1510,7 @@ impl CodexClient { } fn initialize(&mut self) -> Result { - self.initialize_with_experimental_api(true) + self.initialize_with_experimental_api(/*experimental_api=*/ true) } fn initialize_with_experimental_api( diff --git a/codex-rs/app-server/src/app_server_tracing.rs b/codex-rs/app-server/src/app_server_tracing.rs index 564b2eb2d6..e70e1bc591 100644 --- a/codex-rs/app-server/src/app_server_tracing.rs +++ b/codex-rs/app-server/src/app_server_tracing.rs @@ -78,7 +78,7 @@ pub(crate) fn typed_request_span( .or(session.client_version.as_deref()), ); - attach_parent_context(&span, &method, request.id(), None); + attach_parent_context(&span, &method, request.id(), /*parent_trace=*/ None); span } diff --git a/codex-rs/app-server/src/bespoke_event_handling.rs b/codex-rs/app-server/src/bespoke_event_handling.rs index 3853a661ed..3c1e741261 100644 --- a/codex-rs/app-server/src/bespoke_event_handling.rs +++ b/codex-rs/app-server/src/bespoke_event_handling.rs @@ -1914,7 +1914,7 @@ async fn handle_turn_interrupted( conversation_id, event_turn_id, TurnStatus::Interrupted, - None, + /*error=*/ None, outgoing, ) .await; @@ -2503,7 +2503,7 @@ async fn on_command_execution_request_approval_response( item_id.clone(), completion_item.command, completion_item.cwd, - None, + /*process_id=*/ None, completion_item.command_actions, status, &outgoing, diff --git a/codex-rs/app-server/src/codex_message_processor.rs b/codex-rs/app-server/src/codex_message_processor.rs index 1da9d2d43d..8595b943ee 100644 --- a/codex-rs/app-server/src/codex_message_processor.rs +++ b/codex-rs/app-server/src/codex_message_processor.rs @@ -446,7 +446,7 @@ impl CodexMessageProcessor { } pub(crate) async fn maybe_start_curated_repo_sync_for_latest_config(&self) { - match self.load_latest_config(None).await { + match self.load_latest_config(/*fallback_cwd=*/ None).await { Ok(config) => self .thread_manager .plugins_manager() @@ -2085,7 +2085,7 @@ impl CodexMessageProcessor { otel.name = "app_server.thread_start.resolve_status", )) .await, - false, + /*has_in_progress_turn=*/ false, ); let response = ThreadStartResponse { @@ -2530,7 +2530,7 @@ impl CodexMessageProcessor { self.thread_watch_manager .loaded_status_for_thread(&thread.id) .await, - false, + /*has_in_progress_turn=*/ false, ); self.outgoing @@ -2842,7 +2842,7 @@ impl CodexMessageProcessor { self.thread_watch_manager .loaded_status_for_thread(&thread.id) .await, - false, + /*has_in_progress_turn=*/ false, ); self.attach_thread_name(thread_id, &mut thread).await; let thread_id = thread.id.clone(); @@ -3316,8 +3316,13 @@ impl CodexMessageProcessor { for connection_id in connection_ids { Self::log_listener_attach_result( - self.ensure_conversation_listener(thread_id, connection_id, false, ApiVersion::V2) - .await, + self.ensure_conversation_listener( + thread_id, + connection_id, + /*raw_events_enabled=*/ false, + ApiVersion::V2, + ) + .await, thread_id, connection_id, "thread", @@ -3450,7 +3455,7 @@ impl CodexMessageProcessor { self.ensure_conversation_listener( thread_id, request_id.connection_id, - false, + /*raw_events_enabled=*/ false, ApiVersion::V2, ) .await, @@ -3482,7 +3487,11 @@ impl CodexMessageProcessor { .loaded_status_for_thread(&thread.id) .await; - set_thread_status_and_interrupt_stale_turns(&mut thread, thread_status, false); + set_thread_status_and_interrupt_stale_turns( + &mut thread, + thread_status, + /*has_live_in_progress_turn=*/ false, + ); let response = ThreadResumeResponse { thread, @@ -3799,7 +3808,7 @@ impl CodexMessageProcessor { if let Err(message) = populate_thread_turns( &mut thread, ThreadTurnSource::HistoryItems(&history_items), - None, + /*active_turn=*/ None, ) .await { @@ -3914,7 +3923,7 @@ impl CodexMessageProcessor { sandbox, base_instructions, developer_instructions, - None, + /*personality=*/ None, ); typesafe_overrides.ephemeral = ephemeral.then_some(true); // Derive a Config using the same logic as new conversation, honoring overrides if provided. @@ -3985,7 +3994,7 @@ impl CodexMessageProcessor { self.ensure_conversation_listener( thread_id, request_id.connection_id, - false, + /*raw_events_enabled=*/ false, ApiVersion::V2, ) .await, @@ -4019,7 +4028,8 @@ impl CodexMessageProcessor { } else { let config_snapshot = forked_thread.config_snapshot().await; // forked thread names do not inherit the source thread name - let mut thread = build_thread_from_snapshot(thread_id, &config_snapshot, None); + let mut thread = + build_thread_from_snapshot(thread_id, &config_snapshot, /*path=*/ None); let history_items = match read_rollout_items_from_rollout(rollout_path.as_path()).await { Ok(items) => items, @@ -4039,7 +4049,7 @@ impl CodexMessageProcessor { if let Err(message) = populate_thread_turns( &mut thread, ThreadTurnSource::HistoryItems(&history_items), - None, + /*active_turn=*/ None, ) .await { @@ -4053,7 +4063,7 @@ impl CodexMessageProcessor { && let Err(message) = populate_thread_turns( &mut thread, ThreadTurnSource::RolloutPath(fork_rollout_path.as_path()), - None, + /*active_turn=*/ None, ) .await { @@ -4069,7 +4079,7 @@ impl CodexMessageProcessor { self.thread_watch_manager .loaded_status_for_thread(&thread.id) .await, - false, + /*has_in_progress_turn=*/ false, ); let response = ThreadForkResponse { @@ -4381,7 +4391,7 @@ impl CodexMessageProcessor { params: ExperimentalFeatureListParams, ) { let ExperimentalFeatureListParams { cursor, limit } = params; - let config = match self.load_latest_config(None).await { + let config = match self.load_latest_config(/*fallback_cwd=*/ None).await { Ok(config) => config, Err(error) => { self.outgoing.send_error(request_id, error).await; @@ -4496,7 +4506,7 @@ impl CodexMessageProcessor { } async fn mcp_server_refresh(&self, request_id: ConnectionRequestId, _params: Option<()>) { - let config = match self.load_latest_config(None).await { + let config = match self.load_latest_config(/*fallback_cwd=*/ None).await { Ok(config) => config, Err(error) => { self.outgoing.send_error(request_id, error).await; @@ -4555,7 +4565,7 @@ impl CodexMessageProcessor { request_id: ConnectionRequestId, params: McpServerOauthLoginParams, ) { - let config = match self.load_latest_config(None).await { + let config = match self.load_latest_config(/*fallback_cwd=*/ None).await { Ok(config) => config, Err(error) => { self.outgoing.send_error(request_id, error).await; @@ -4667,7 +4677,7 @@ impl CodexMessageProcessor { let request = request_id.clone(); let outgoing = Arc::clone(&self.outgoing); - let config = match self.load_latest_config(None).await { + let config = match self.load_latest_config(/*fallback_cwd=*/ None).await { Ok(config) => config, Err(error) => { self.outgoing.send_error(request, error).await; @@ -4839,7 +4849,7 @@ impl CodexMessageProcessor { async fn finalize_thread_teardown(&mut self, thread_id: ThreadId) { self.pending_thread_unloads.lock().await.remove(&thread_id); self.outgoing - .cancel_requests_for_thread(thread_id, None) + .cancel_requests_for_thread(thread_id, /*error=*/ None) .await; self.thread_state_manager .remove_thread_state(thread_id) @@ -4902,7 +4912,7 @@ impl CodexMessageProcessor { // Any pending app-server -> client requests for this thread can no longer be // answered; cancel their callbacks before shutdown/unload. self.outgoing - .cancel_requests_for_thread(thread_id, None) + .cancel_requests_for_thread(thread_id, /*error=*/ None) .await; self.thread_state_manager .remove_thread_state(thread_id) @@ -5075,7 +5085,7 @@ impl CodexMessageProcessor { } async fn apps_list(&self, request_id: ConnectionRequestId, params: AppsListParams) { - let mut config = match self.load_latest_config(None).await { + let mut config = match self.load_latest_config(/*fallback_cwd=*/ None).await { Ok(config) => config, Err(error) => { self.outgoing.send_error(request_id, error).await; @@ -5372,7 +5382,7 @@ impl CodexMessageProcessor { } = params; let roots = cwds.unwrap_or_default(); - let mut config = match self.load_latest_config(None).await { + let mut config = match self.load_latest_config(/*fallback_cwd=*/ None).await { Ok(config) => config, Err(err) => { self.outgoing.send_error(request_id, err).await; @@ -5405,7 +5415,7 @@ impl CodexMessageProcessor { } } - config = match self.load_latest_config(None).await { + config = match self.load_latest_config(/*fallback_cwd=*/ None).await { Ok(config) => config, Err(err) => { self.outgoing.send_error(request_id, err).await; @@ -6025,7 +6035,7 @@ impl CodexMessageProcessor { .ensure_conversation_listener( thread_id, request_id.connection_id, - false, + /*raw_events_enabled=*/ false, ApiVersion::V2, ) .await @@ -6320,7 +6330,7 @@ impl CodexMessageProcessor { self.ensure_conversation_listener( thread_id, request_id.connection_id, - false, + /*raw_events_enabled=*/ false, ApiVersion::V2, ) .await, @@ -6341,7 +6351,7 @@ impl CodexMessageProcessor { self.thread_watch_manager .loaded_status_for_thread(&thread.id) .await, - false, + /*has_in_progress_turn=*/ false, ); let notif = ThreadStartedNotification { thread }; self.outgoing @@ -7029,7 +7039,7 @@ impl CodexMessageProcessor { tokio::spawn(async move { let derived_config = derive_config_for_cwd( &cli_overrides, - None, + /*request_overrides=*/ None, ConfigOverrides { cwd: Some(command_cwd.clone()), ..Default::default() diff --git a/codex-rs/app-server/src/in_process.rs b/codex-rs/app-server/src/in_process.rs index 3a9286a5f4..ded018d582 100644 --- a/codex-rs/app-server/src/in_process.rs +++ b/codex-rs/app-server/src/in_process.rs @@ -390,8 +390,8 @@ fn start_uninitialized(args: InProcessStartArgs) -> InProcessClientHandle { Arc::clone(&outbound_initialized), Arc::clone(&outbound_experimental_api_enabled), Arc::clone(&outbound_opted_out_notification_methods), - true, - None, + /*allow_legacy_notifications=*/ true, + /*disconnect_sender=*/ None, ), ); let mut outbound_handle = tokio::spawn(async move { diff --git a/codex-rs/app-server/src/message_processor.rs b/codex-rs/app-server/src/message_processor.rs index e16e2e693e..ac292b2268 100644 --- a/codex-rs/app-server/src/message_processor.rs +++ b/codex-rs/app-server/src/message_processor.rs @@ -332,7 +332,7 @@ impl MessageProcessor { request_id.clone(), codex_request, session, - None, + /*outbound_initialized=*/ None, request_context.clone(), ) .await; @@ -358,7 +358,11 @@ impl MessageProcessor { }; let request_span = crate::app_server_tracing::typed_request_span(&request, connection_id, session); - let request_context = RequestContext::new(request_id.clone(), request_span, None); + let request_context = RequestContext::new( + request_id.clone(), + request_span, + /*parent_trace=*/ None, + ); tracing::trace!( ?connection_id, request_id = ?request_id.request_id, diff --git a/codex-rs/app-server/src/outgoing_message.rs b/codex-rs/app-server/src/outgoing_message.rs index 43c6304aee..dbbbd47b52 100644 --- a/codex-rs/app-server/src/outgoing_message.rs +++ b/codex-rs/app-server/src/outgoing_message.rs @@ -234,7 +234,10 @@ impl OutgoingMessageSender { &self, request: ServerRequestPayload, ) -> (RequestId, oneshot::Receiver) { - self.send_request_to_connections(None, request, None).await + self.send_request_to_connections( + /*connection_ids=*/ None, request, /*thread_id=*/ None, + ) + .await } fn next_request_id(&self) -> RequestId { diff --git a/codex-rs/app-server/src/thread_state.rs b/codex-rs/app-server/src/thread_state.rs index 5176fe1333..350ca760c5 100644 --- a/codex-rs/app-server/src/thread_state.rs +++ b/codex-rs/app-server/src/thread_state.rs @@ -261,7 +261,7 @@ impl ThreadStateManager { { let mut thread_state_guard = thread_state.lock().await; if experimental_raw_events { - thread_state_guard.set_experimental_raw_events(true); + thread_state_guard.set_experimental_raw_events(/*enabled=*/ true); } } Some(thread_state) diff --git a/codex-rs/app-server/src/thread_status.rs b/codex-rs/app-server/src/thread_status.rs index d366089a7c..2a343f19f3 100644 --- a/codex-rs/app-server/src/thread_status.rs +++ b/codex-rs/app-server/src/thread_status.rs @@ -91,13 +91,17 @@ impl ThreadWatchManager { } pub(crate) async fn upsert_thread(&self, thread: Thread) { - self.mutate_and_publish(move |state| state.upsert_thread(thread.id, true)) - .await; + self.mutate_and_publish(move |state| { + state.upsert_thread(thread.id, /*emit_notification=*/ true) + }) + .await; } pub(crate) async fn upsert_thread_silently(&self, thread: Thread) { - self.mutate_and_publish(move |state| state.upsert_thread(thread.id, false)) - .await; + self.mutate_and_publish(move |state| { + state.upsert_thread(thread.id, /*emit_notification=*/ false) + }) + .await; } pub(crate) async fn remove_thread(&self, thread_id: &str) { diff --git a/codex-rs/app-server/tests/common/mcp_process.rs b/codex-rs/app-server/tests/common/mcp_process.rs index 397b87b052..79e78d3adc 100644 --- a/codex-rs/app-server/tests/common/mcp_process.rs +++ b/codex-rs/app-server/tests/common/mcp_process.rs @@ -267,7 +267,8 @@ impl McpProcess { /// Send an `account/rateLimits/read` JSON-RPC request. pub async fn send_get_account_rate_limits_request(&mut self) -> anyhow::Result { - self.send_request("account/rateLimits/read", None).await + self.send_request("account/rateLimits/read", /*params=*/ None) + .await } /// Send an `account/read` JSON-RPC request. @@ -768,7 +769,7 @@ impl McpProcess { /// Send an `account/logout` JSON-RPC request. pub async fn send_logout_account_request(&mut self) -> anyhow::Result { - self.send_request("account/logout", None).await + self.send_request("account/logout", /*params=*/ None).await } /// Send an `account/login/start` JSON-RPC request for API key login. diff --git a/codex-rs/apply-patch/src/lib.rs b/codex-rs/apply-patch/src/lib.rs index 1fc60474b9..aa214d3d91 100644 --- a/codex-rs/apply-patch/src/lib.rs +++ b/codex-rs/apply-patch/src/lib.rs @@ -399,7 +399,7 @@ fn compute_replacements( original_lines, std::slice::from_ref(ctx_line), line_index, - false, + /*eof=*/ false, ) { line_index = idx + 1; } else { @@ -512,7 +512,7 @@ pub fn unified_diff_from_chunks( path: &Path, chunks: &[UpdateFileChunk], ) -> std::result::Result { - unified_diff_from_chunks_with_context(path, chunks, 1) + unified_diff_from_chunks_with_context(path, chunks, /*context=*/ 1) } pub fn unified_diff_from_chunks_with_context( diff --git a/codex-rs/artifacts/src/runtime/js_runtime.rs b/codex-rs/artifacts/src/runtime/js_runtime.rs index 1c8982b920..66b2473635 100644 --- a/codex-rs/artifacts/src/runtime/js_runtime.rs +++ b/codex-rs/artifacts/src/runtime/js_runtime.rs @@ -74,7 +74,7 @@ pub fn can_manage_artifact_runtime() -> bool { pub(crate) fn resolve_machine_js_runtime() -> Option { resolve_js_runtime_from_candidates( - None, + /*preferred_node_path=*/ None, system_node_runtime(), system_electron_runtime(), codex_app_runtime_candidates(), diff --git a/codex-rs/backend-client/src/client.rs b/codex-rs/backend-client/src/client.rs index 02ea983442..7fb5a263f0 100644 --- a/codex-rs/backend-client/src/client.rs +++ b/codex-rs/backend-client/src/client.rs @@ -399,7 +399,7 @@ impl Client { let plan_type = Some(Self::map_plan_type(payload.plan_type)); let mut snapshots = vec![Self::make_rate_limit_snapshot( Some("codex".to_string()), - None, + /*limit_name=*/ None, payload.rate_limit.flatten().map(|details| *details), payload.credits.flatten().map(|details| *details), plan_type, @@ -410,7 +410,7 @@ impl Client { Some(details.metered_feature), Some(details.limit_name), details.rate_limit.flatten().map(|rate_limit| *rate_limit), - None, + /*credits=*/ None, plan_type, ) })); diff --git a/codex-rs/chatgpt/src/chatgpt_client.rs b/codex-rs/chatgpt/src/chatgpt_client.rs index b13be8c0cd..2d366619bf 100644 --- a/codex-rs/chatgpt/src/chatgpt_client.rs +++ b/codex-rs/chatgpt/src/chatgpt_client.rs @@ -13,7 +13,7 @@ pub(crate) async fn chatgpt_get_request( config: &Config, path: String, ) -> anyhow::Result { - chatgpt_get_request_with_timeout(config, path, None).await + chatgpt_get_request_with_timeout(config, path, /*timeout=*/ None).await } pub(crate) async fn chatgpt_get_request_with_timeout( diff --git a/codex-rs/chatgpt/src/connectors.rs b/codex-rs/chatgpt/src/connectors.rs index 27efab1e53..d4d6d645f6 100644 --- a/codex-rs/chatgpt/src/connectors.rs +++ b/codex-rs/chatgpt/src/connectors.rs @@ -45,13 +45,15 @@ pub async fn list_connectors(config: &Config) -> anyhow::Result> { let connectors = connectors_result?; let accessible = accessible_result?; Ok(with_app_enabled_state( - merge_connectors_with_accessible(connectors, accessible, true), + merge_connectors_with_accessible( + connectors, accessible, /*all_connectors_loaded=*/ true, + ), config, )) } pub async fn list_all_connectors(config: &Config) -> anyhow::Result> { - list_all_connectors_with_options(config, false).await + list_all_connectors_with_options(config, /*force_refetch=*/ false).await } pub async fn list_cached_all_connectors(config: &Config) -> Option> { diff --git a/codex-rs/cli/src/debug_sandbox.rs b/codex-rs/cli/src/debug_sandbox.rs index cc1f1e051b..b6842b0f3e 100644 --- a/codex-rs/cli/src/debug_sandbox.rs +++ b/codex-rs/cli/src/debug_sandbox.rs @@ -69,7 +69,7 @@ pub async fn run_command_under_landlock( config_overrides, codex_linux_sandbox_exe, SandboxType::Landlock, - false, + /*log_denials=*/ false, ) .await } @@ -89,7 +89,7 @@ pub async fn run_command_under_windows( config_overrides, codex_linux_sandbox_exe, SandboxType::Windows, - false, + /*log_denials=*/ false, ) .await } diff --git a/codex-rs/cli/src/mcp_cmd.rs b/codex-rs/cli/src/mcp_cmd.rs index d4e1888b86..fb4c2ec774 100644 --- a/codex-rs/cli/src/mcp_cmd.rs +++ b/codex-rs/cli/src/mcp_cmd.rs @@ -330,7 +330,7 @@ async fn run_add(config_overrides: &CliConfigOverrides, add_args: AddArgs) -> Re oauth_config.http_headers, oauth_config.env_http_headers, &resolved_scopes, - None, + /*oauth_resource=*/ None, config.mcp_oauth_callback_port, config.mcp_oauth_callback_url.as_deref(), ) diff --git a/codex-rs/cloud-requirements/src/lib.rs b/codex-rs/cloud-requirements/src/lib.rs index 18c95c3d37..e4dc76d3b4 100644 --- a/codex-rs/cloud-requirements/src/lib.rs +++ b/codex-rs/cloud-requirements/src/lib.rs @@ -367,7 +367,9 @@ impl CloudRequirementsService { while attempt <= CLOUD_REQUIREMENTS_MAX_ATTEMPTS { let contents = match self.fetcher.fetch_requirements(&auth).await { Ok(contents) => { - emit_fetch_attempt_metric(trigger, attempt, "success", None); + emit_fetch_attempt_metric( + trigger, attempt, "success", /*status_code=*/ None, + ); contents } Err(FetchAttemptError::Retryable(status)) => { @@ -500,7 +502,9 @@ impl CloudRequirementsService { tracing::warn!(error = %err, "Failed to write cloud requirements cache"); } - emit_fetch_final_metric(trigger, "success", "none", attempt, None); + emit_fetch_final_metric( + trigger, "success", "none", attempt, /*status_code=*/ None, + ); return Ok(requirements); } diff --git a/codex-rs/cloud-tasks-client/src/http.rs b/codex-rs/cloud-tasks-client/src/http.rs index e6990b7ebd..9b6d608178 100644 --- a/codex-rs/cloud-tasks-client/src/http.rs +++ b/codex-rs/cloud-tasks-client/src/http.rs @@ -94,7 +94,9 @@ impl CloudBackend for HttpClient { } async fn apply_task(&self, id: TaskId, diff_override: Option) -> Result { - self.apply_api().run(id, diff_override, false).await + self.apply_api() + .run(id, diff_override, /*preflight=*/ false) + .await } async fn apply_task_preflight( @@ -102,7 +104,9 @@ impl CloudBackend for HttpClient { id: TaskId, diff_override: Option, ) -> Result { - self.apply_api().run(id, diff_override, true).await + self.apply_api() + .run(id, diff_override, /*preflight=*/ true) + .await } async fn create_task( @@ -533,8 +537,8 @@ mod api { let _ = writeln!( &mut log, "stdout_tail=\n{}\nstderr_tail=\n{}", - tail(&r.stdout, 2000), - tail(&r.stderr, 2000) + tail(&r.stdout, /*max=*/ 2000), + tail(&r.stderr, /*max=*/ 2000) ); let _ = writeln!(&mut log, "{summary}"); let _ = writeln!( diff --git a/codex-rs/cloud-tasks-client/src/mock.rs b/codex-rs/cloud-tasks-client/src/mock.rs index f6e14e61a2..664a69dc1f 100644 --- a/codex-rs/cloud-tasks-client/src/mock.rs +++ b/codex-rs/cloud-tasks-client/src/mock.rs @@ -70,7 +70,12 @@ impl CloudBackend for MockClient { } async fn get_task_summary(&self, id: TaskId) -> Result { - let tasks = self.list_tasks(None, None, None).await?.tasks; + let tasks = self + .list_tasks( + /*env=*/ None, /*limit=*/ None, /*cursor=*/ None, + ) + .await? + .tasks; tasks .into_iter() .find(|t| t.id == id) diff --git a/codex-rs/cloud-tasks/src/lib.rs b/codex-rs/cloud-tasks/src/lib.rs index b1d42fb86f..59d7779ea7 100644 --- a/codex-rs/cloud-tasks/src/lib.rs +++ b/codex-rs/cloud-tasks/src/lib.rs @@ -827,7 +827,7 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option) -> an let backend = Arc::clone(&backend); let tx = tx.clone(); tokio::spawn(async move { - let res = app::load_tasks(&*backend, None).await; + let res = app::load_tasks(&*backend, /*env=*/ None).await; let _ = tx.send(app::AppEvent::TasksLoaded { env: None, result: res, @@ -861,7 +861,10 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option) -> an let headers = util::build_chatgpt_headers().await; // Run autodetect. If it fails, we keep using "All". - let res = crate::env_detect::autodetect_environment_id(&base_url, &headers, None).await; + let res = crate::env_detect::autodetect_environment_id( + &base_url, &headers, /*desired_label=*/ None, + ) + .await; let _ = tx.send(app::AppEvent::EnvironmentAutodetected(res)); }); } @@ -1105,7 +1108,7 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option) -> an ov.base_can_apply = true; ov.apply_selection_to_fields(); } else { - let mut overlay = app::DiffOverlay::new(id.clone(), title, None); + let mut overlay = app::DiffOverlay::new(id.clone(), title, /*attempt_total_hint=*/ None); { let base = overlay.base_attempt_mut(); base.diff_lines = diff_lines.clone(); @@ -1178,7 +1181,7 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option) -> an }); } } else { - let mut overlay = app::DiffOverlay::new(id.clone(), title, None); + let mut overlay = app::DiffOverlay::new(id.clone(), title, /*attempt_total_hint=*/ None); { let base = overlay.base_attempt_mut(); base.text_lines = conv.clone(); @@ -1216,7 +1219,7 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option) -> an .as_ref() .map(|d| d.lines().map(str::to_string).collect()) .unwrap_or_default(); - let text_lines = conversation_lines(None, &attempt.messages); + let text_lines = conversation_lines(/*prompt=*/ None, &attempt.messages); ov.attempts.push(app::AttemptView { turn_id: Some(attempt.turn_id.clone()), status: attempt.status, @@ -1263,7 +1266,7 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option) -> an ov.current_view = app::DetailView::Prompt; ov.apply_selection_to_fields(); } else { - let mut overlay = app::DiffOverlay::new(id.clone(), title, None); + let mut overlay = app::DiffOverlay::new(id.clone(), title, /*attempt_total_hint=*/ None); { let base = overlay.base_attempt_mut(); base.text_lines = pretty; @@ -1500,7 +1503,7 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option) -> an let backend = Arc::clone(&backend); let best_of_n = page.best_of_n; tokio::spawn(async move { - let git_ref = resolve_git_ref(None).await; + let git_ref = resolve_git_ref(/*branch_override=*/ None).await; let result = codex_cloud_tasks_client::CloudBackend::create_task(&*backend, &env, &text, &git_ref, false, best_of_n).await; let evt = match result { @@ -1685,11 +1688,11 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option) -> an needs_redraw = true; } KeyCode::Down | KeyCode::Char('j') => { - if let Some(ov) = &mut app.diff_overlay { ov.sd.scroll_by(1); } + if let Some(ov) = &mut app.diff_overlay { ov.sd.scroll_by(/*delta=*/ 1); } needs_redraw = true; } KeyCode::Up | KeyCode::Char('k') => { - if let Some(ov) = &mut app.diff_overlay { ov.sd.scroll_by(-1); } + if let Some(ov) = &mut app.diff_overlay { ov.sd.scroll_by(/*delta=*/ -1); } needs_redraw = true; } KeyCode::PageDown | KeyCode::Char(' ') => { @@ -1721,7 +1724,7 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option) -> an KeyCode::PageUp => { if let Some(m) = app.env_modal.as_mut() { let step = 10usize; m.selected = m.selected.saturating_sub(step); } needs_redraw = true; } KeyCode::Char('n') => { if app.env_filter.is_none() { - app.new_task = Some(crate::new_task::NewTaskPage::new(None, app.best_of_n)); + app.new_task = Some(crate::new_task::NewTaskPage::new(/*env_id=*/ None, app.best_of_n)); } else { app.new_task = Some(crate::new_task::NewTaskPage::new(app.env_filter.clone(), app.best_of_n)); } diff --git a/codex-rs/cloud-tasks/src/new_task.rs b/codex-rs/cloud-tasks/src/new_task.rs index 162fd3bb3a..677e336ba8 100644 --- a/codex-rs/cloud-tasks/src/new_task.rs +++ b/codex-rs/cloud-tasks/src/new_task.rs @@ -30,6 +30,6 @@ impl NewTaskPage { impl Default for NewTaskPage { fn default() -> Self { - Self::new(None, 1) + Self::new(/*env_id=*/ None, /*best_of_n=*/ 1) } } diff --git a/codex-rs/cloud-tasks/src/ui.rs b/codex-rs/cloud-tasks/src/ui.rs index 4c41ca576c..46c1c9c204 100644 --- a/codex-rs/cloud-tasks/src/ui.rs +++ b/codex-rs/cloud-tasks/src/ui.rs @@ -582,7 +582,10 @@ fn style_conversation_lines( speaker = Some(ConversationSpeaker::User); in_code = false; bullet_indent = None; - styled.push(conversation_header_line(ConversationSpeaker::User, None)); + styled.push(conversation_header_line( + ConversationSpeaker::User, + /*attempt=*/ None, + )); last_src = Some(src_idx); continue; } diff --git a/codex-rs/codex-api/src/endpoint/models.rs b/codex-rs/codex-api/src/endpoint/models.rs index ab90fc438f..73594748af 100644 --- a/codex-rs/codex-api/src/endpoint/models.rs +++ b/codex-rs/codex-api/src/endpoint/models.rs @@ -44,9 +44,15 @@ impl ModelsClient { ) -> Result<(Vec, Option), ApiError> { let resp = self .session - .execute_with(Method::GET, Self::path(), extra_headers, None, |req| { - Self::append_client_version_query(req, client_version); - }) + .execute_with( + Method::GET, + Self::path(), + extra_headers, + /*body=*/ None, + |req| { + Self::append_client_version_query(req, client_version); + }, + ) .await?; let header_etag = resp diff --git a/codex-rs/codex-api/src/rate_limits.rs b/codex-rs/codex-api/src/rate_limits.rs index 909ab06a27..da5ce340a3 100644 --- a/codex-rs/codex-api/src/rate_limits.rs +++ b/codex-rs/codex-api/src/rate_limits.rs @@ -20,7 +20,7 @@ impl Display for RateLimitError { /// Parses the default Codex rate-limit header family into a `RateLimitSnapshot`. pub fn parse_default_rate_limit(headers: &HeaderMap) -> Option { - parse_rate_limit_for_limit(headers, None) + parse_rate_limit_for_limit(headers, /*limit_id=*/ None) } /// Parses all known rate-limit header families into update records keyed by limit id. diff --git a/codex-rs/codex-api/src/sse/responses.rs b/codex-rs/codex-api/src/sse/responses.rs index e264d8d0a0..b533031d7e 100644 --- a/codex-rs/codex-api/src/sse/responses.rs +++ b/codex-rs/codex-api/src/sse/responses.rs @@ -45,7 +45,12 @@ pub fn stream_from_fixture( let reader = std::io::Cursor::new(content); let stream = ReaderStream::new(reader).map_err(|err| TransportError::Network(err.to_string())); let (tx_event, rx_event) = mpsc::channel::>(1600); - tokio::spawn(process_sse(Box::pin(stream), tx_event, idle_timeout, None)); + tokio::spawn(process_sse( + Box::pin(stream), + tx_event, + idle_timeout, + /*telemetry=*/ None, + )); Ok(ResponseStream { rx_event }) } diff --git a/codex-rs/codex-experimental-api-macros/src/lib.rs b/codex-rs/codex-experimental-api-macros/src/lib.rs index d33b47ae5e..660fb29153 100644 --- a/codex-rs/codex-experimental-api-macros/src/lib.rs +++ b/codex-rs/codex-experimental-api-macros/src/lib.rs @@ -38,7 +38,7 @@ fn derive_for_struct(input: &DeriveInput, data: &DataStruct) -> TokenStream { let mut registrations = Vec::new(); for field in &named.named { if let Some(reason) = experimental_reason(&field.attrs) { - let expr = experimental_presence_expr(field, false); + let expr = experimental_presence_expr(field, /*tuple_struct=*/ false); checks.push(quote! { if #expr { return Some(#reason); diff --git a/codex-rs/config/src/config_requirements.rs b/codex-rs/config/src/config_requirements.rs index f1cb9336b2..d75ac22c0d 100644 --- a/codex-rs/config/src/config_requirements.rs +++ b/codex-rs/config/src/config_requirements.rs @@ -92,20 +92,23 @@ impl Default for ConfigRequirements { Self { approval_policy: ConstrainedWithSource::new( Constrained::allow_any_from_default(), - None, + /*source=*/ None, ), sandbox_policy: ConstrainedWithSource::new( Constrained::allow_any(SandboxPolicy::new_read_only_policy()), - None, + /*source=*/ None, ), web_search_mode: ConstrainedWithSource::new( Constrained::allow_any(WebSearchMode::Cached), - None, + /*source=*/ None, ), feature_requirements: None, mcp_servers: None, exec_policy: None, - enforce_residency: ConstrainedWithSource::new(Constrained::allow_any(None), None), + enforce_residency: ConstrainedWithSource::new( + Constrained::allow_any(/*initial_value=*/ None), + /*source=*/ None, + ), network: None, } } @@ -508,7 +511,10 @@ impl TryFrom for ConfigRequirements { })?; ConstrainedWithSource::new(constrained, Some(requirement_source)) } - None => ConstrainedWithSource::new(Constrained::allow_any_from_default(), None), + None => ConstrainedWithSource::new( + Constrained::allow_any_from_default(), + /*source=*/ None, + ), }; // TODO(gt): `ConfigRequirementsToml` should let the author specify the @@ -559,7 +565,10 @@ impl TryFrom for ConfigRequirements { ConstrainedWithSource::new(constrained, Some(requirement_source)) } None => { - ConstrainedWithSource::new(Constrained::allow_any(default_sandbox_policy), None) + ConstrainedWithSource::new( + Constrained::allow_any(default_sandbox_policy), + /*source=*/ None, + ) } }; let exec_policy = match rules { @@ -612,7 +621,10 @@ impl TryFrom for ConfigRequirements { })?; ConstrainedWithSource::new(constrained, Some(requirement_source)) } - None => ConstrainedWithSource::new(Constrained::allow_any(WebSearchMode::Cached), None), + None => ConstrainedWithSource::new( + Constrained::allow_any(WebSearchMode::Cached), + /*source=*/ None, + ), }; let feature_requirements = feature_requirements.filter(|requirements| !requirements.value.is_empty()); @@ -638,7 +650,10 @@ impl TryFrom for ConfigRequirements { })?; ConstrainedWithSource::new(constrained, Some(requirement_source)) } - None => ConstrainedWithSource::new(Constrained::allow_any(None), None), + None => ConstrainedWithSource::new( + Constrained::allow_any(/*initial_value=*/ None), + /*source=*/ None, + ), }; let network = network.map(|sourced_network| { let Sourced { value, source } = sourced_network; diff --git a/codex-rs/config/src/diagnostics.rs b/codex-rs/config/src/diagnostics.rs index be6e123d33..4aef825aca 100644 --- a/codex-rs/config/src/diagnostics.rs +++ b/codex-rs/config/src/diagnostics.rs @@ -142,7 +142,10 @@ pub async fn first_layer_config_error( // per-file error to point users at a specific file and range rather than an // opaque merged-layer failure. first_layer_config_error_for_entries::( - layers.get_layers(ConfigLayerStackOrdering::LowestPrecedenceFirst, false), + layers.get_layers( + ConfigLayerStackOrdering::LowestPrecedenceFirst, + /*include_disabled=*/ false, + ), config_toml_file, ) .await diff --git a/codex-rs/config/src/state.rs b/codex-rs/config/src/state.rs index 98769f44b2..b8901b1a0c 100644 --- a/codex-rs/config/src/state.rs +++ b/codex-rs/config/src/state.rs @@ -211,7 +211,10 @@ impl ConfigLayerStack { pub fn effective_config(&self) -> TomlValue { let mut merged = TomlValue::Table(toml::map::Map::new()); - for layer in self.get_layers(ConfigLayerStackOrdering::LowestPrecedenceFirst, false) { + for layer in self.get_layers( + ConfigLayerStackOrdering::LowestPrecedenceFirst, + /*include_disabled=*/ false, + ) { merge_toml_values(&mut merged, &layer.config); } merged @@ -221,7 +224,10 @@ impl ConfigLayerStack { let mut origins = HashMap::new(); let mut path = Vec::new(); - for layer in self.get_layers(ConfigLayerStackOrdering::LowestPrecedenceFirst, false) { + for layer in self.get_layers( + ConfigLayerStackOrdering::LowestPrecedenceFirst, + /*include_disabled=*/ false, + ) { record_origins(&layer.config, &layer.metadata(), &mut path, &mut origins); } @@ -231,7 +237,10 @@ impl ConfigLayerStack { /// Returns the highest-precedence to lowest-precedence layers, so /// `ConfigLayerSource::SessionFlags` would be first, if present. pub fn layers_high_to_low(&self) -> Vec<&ConfigLayerEntry> { - self.get_layers(ConfigLayerStackOrdering::HighestPrecedenceFirst, false) + self.get_layers( + ConfigLayerStackOrdering::HighestPrecedenceFirst, + /*include_disabled=*/ false, + ) } /// Returns the highest-precedence to lowest-precedence layers, so diff --git a/codex-rs/core/src/agent/control.rs b/codex-rs/core/src/agent/control.rs index c9ac18a026..65f6a1b6c0 100644 --- a/codex-rs/core/src/agent/control.rs +++ b/codex-rs/core/src/agent/control.rs @@ -186,7 +186,7 @@ impl AgentControl { initial_history, self.clone(), session_source, - false, + /*persist_extended_history=*/ false, inherited_shell_snapshot, ) .await? @@ -196,8 +196,8 @@ impl AgentControl { config, self.clone(), session_source, - false, - None, + /*persist_extended_history=*/ false, + /*metrics_service_name=*/ None, inherited_shell_snapshot, ) .await? diff --git a/codex-rs/core/src/agent/guards.rs b/codex-rs/core/src/agent/guards.rs index 167b993013..952181e786 100644 --- a/codex-rs/core/src/agent/guards.rs +++ b/codex-rs/core/src/agent/guards.rs @@ -179,7 +179,7 @@ pub(crate) struct SpawnReservation { impl SpawnReservation { pub(crate) fn reserve_agent_nickname(&mut self, names: &[&str]) -> Result { - self.reserve_agent_nickname_with_preference(names, None) + self.reserve_agent_nickname_with_preference(names, /*preferred=*/ None) } pub(crate) fn reserve_agent_nickname_with_preference( @@ -198,7 +198,7 @@ impl SpawnReservation { } pub(crate) fn commit(self, thread_id: ThreadId) { - self.commit_with_agent_nickname(thread_id, None); + self.commit_with_agent_nickname(thread_id, /*agent_nickname=*/ None); } pub(crate) fn commit_with_agent_nickname( diff --git a/codex-rs/core/src/auth.rs b/codex-rs/core/src/auth.rs index 8818aa5c6c..2a463bd609 100644 --- a/codex-rs/core/src/auth.rs +++ b/codex-rs/core/src/auth.rs @@ -194,7 +194,11 @@ impl CodexAuth { codex_home: &Path, auth_credentials_store_mode: AuthCredentialsStoreMode, ) -> std::io::Result> { - load_auth(codex_home, false, auth_credentials_store_mode) + load_auth( + codex_home, + /*enable_codex_api_key_env=*/ false, + auth_credentials_store_mode, + ) } pub fn auth_mode(&self) -> AuthMode { @@ -457,7 +461,7 @@ pub fn load_auth_dot_json( pub fn enforce_login_restrictions(config: &Config) -> std::io::Result<()> { let Some(auth) = load_auth( &config.codex_home, - true, + /*enable_codex_api_key_env=*/ true, config.cli_auth_credentials_store_mode, )? else { diff --git a/codex-rs/core/src/client.rs b/codex-rs/core/src/client.rs index 32c1653ae8..a15a6d513c 100644 --- a/codex-rs/core/src/client.rs +++ b/codex-rs/core/src/client.rs @@ -680,9 +680,11 @@ impl ModelClientSession { let Some(last_response) = self.get_last_response() else { return ResponsesWsRequest::ResponseCreate(payload); }; - let Some(incremental_items) = - self.get_incremental_items(request, Some(&last_response), true) - else { + let Some(incremental_items) = self.get_incremental_items( + request, + Some(&last_response), + /*allow_empty_delta=*/ true, + ) else { return ResponsesWsRequest::ResponseCreate(payload); }; @@ -726,7 +728,7 @@ impl ModelClientSession { client_setup.api_provider, client_setup.api_auth, Some(Arc::clone(&self.turn_state)), - None, + /*turn_metadata_header=*/ None, ) .await?; self.websocket_session.connection = Some(connection); @@ -1024,7 +1026,7 @@ impl ModelClientSession { summary, service_tier, turn_metadata_header, - true, + /*warmup=*/ true, ) .await { @@ -1077,7 +1079,7 @@ impl ModelClientSession { summary, service_tier, turn_metadata_header, - false, + /*warmup=*/ false, ) .await? { diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs index cf382d2bfd..14df6c75b2 100644 --- a/codex-rs/core/src/codex.rs +++ b/codex-rs/core/src/codex.rs @@ -632,7 +632,7 @@ impl Codex { /// Submit the `op` wrapped in a `Submission` with a unique ID. pub async fn submit(&self, op: Op) -> CodexResult { - self.submit_with_trace(op, None).await + self.submit_with_trace(op, /*trace=*/ None).await } pub async fn submit_with_trace( @@ -1694,7 +1694,8 @@ impl Session { (None, None) }; - let mut hook_shell_argv = default_shell.derive_exec_args("", false); + let mut hook_shell_argv = + default_shell.derive_exec_args("", /*use_login_shell=*/ false); let hook_shell_program = hook_shell_argv.remove(0); let _ = hook_shell_argv.pop(); let hooks = Hooks::new(HooksConfig { @@ -2042,7 +2043,8 @@ impl Session { InitialHistory::New => { // Defer initial context insertion until the first real turn starts so // turn/start overrides can be merged before we write model-visible context. - self.set_previous_turn_settings(None).await; + self.set_previous_turn_settings(/*previous_turn_settings=*/ None) + .await; } InitialHistory::Resumed(resumed_history) => { let rollout_items = resumed_history.history; @@ -2340,7 +2342,7 @@ impl Session { let skills_outcome = Arc::new( self.services .skills_manager - .skills_for_cwd(&session_configuration.cwd, false) + .skills_for_cwd(&session_configuration.cwd, /*force_reload=*/ false) .await, ); let mut turn_context: TurnContext = Self::make_turn_context( @@ -2431,7 +2433,7 @@ impl Session { startup_turn_context.as_ref(), &[], &HashSet::new(), - None, + /*skills_outcome=*/ None, &startup_cancellation_token, ) .await?; @@ -2517,8 +2519,13 @@ impl Session { let state = self.state.lock().await; state.session_configuration.clone() }; - self.new_turn_from_configuration(sub_id, session_configuration, None, false) - .await + self.new_turn_from_configuration( + sub_id, + session_configuration, + /*final_output_json_schema=*/ None, + /*sandbox_policy_changed=*/ false, + ) + .await } async fn build_settings_update_items( @@ -4483,7 +4490,9 @@ mod handlers { current_context.session_telemetry.user_prompt(&items); // Attempt to inject input into current task. - if let Err(SteerInputError::NoActiveTurn(items)) = sess.steer_input(items, None).await { + if let Err(SteerInputError::NoActiveTurn(items)) = + sess.steer_input(items, /*expected_turn_id=*/ None).await + { sess.refresh_mcp_servers_if_requested(¤t_context) .await; let regular_task = sess.take_startup_regular_task().await.unwrap_or_default(); @@ -5229,7 +5238,7 @@ async fn spawn_review_thread( sandbox_policy: parent_turn_context.sandbox_policy.get(), windows_sandbox_level: parent_turn_context.windows_sandbox_level, }) - .with_web_search_config(None) + .with_web_search_config(/*web_search_config=*/ None) .with_allow_login_shell(config.permissions.allow_login_shell) .with_agent_roles(config.agent_roles.clone()); @@ -5909,7 +5918,7 @@ pub(crate) async fn run_turn( } Err(e) => { info!("Turn error: {e:#}"); - let event = EventMsg::Error(e.to_error_event(None)); + let event = EventMsg::Error(e.to_error_event(/*message_prefix=*/ None)); sess.send_event(&turn_context, event).await; // let the user continue the conversation break; @@ -6946,7 +6955,8 @@ async fn handle_assistant_item_done_in_plan_mode( { maybe_complete_plan_item_from_message(sess, turn_context, state, item).await; - if let Some(turn_item) = handle_non_tool_response_item(sess, turn_context, item, true).await + if let Some(turn_item) = + handle_non_tool_response_item(sess, turn_context, item, /*plan_mode=*/ true).await { emit_turn_item_in_plan_mode( sess, @@ -6959,7 +6969,9 @@ async fn handle_assistant_item_done_in_plan_mode( } record_completed_response_item(sess, turn_context, item).await; - if let Some(agent_message) = last_assistant_message_from_item(item, true) { + if let Some(agent_message) = + last_assistant_message_from_item(item, /*plan_mode=*/ true) + { *last_agent_message = Some(agent_message); } return true; @@ -7330,7 +7342,7 @@ async fn try_run_sampling_request( pub(super) fn get_last_assistant_message_from_turn(responses: &[ResponseItem]) -> Option { for item in responses.iter().rev() { - if let Some(message) = last_assistant_message_from_item(item, false) { + if let Some(message) = last_assistant_message_from_item(item, /*plan_mode=*/ false) { return Some(message); } } diff --git a/codex-rs/core/src/codex_thread.rs b/codex-rs/core/src/codex_thread.rs index 7a243f9f74..1eb7539225 100644 --- a/codex-rs/core/src/codex_thread.rs +++ b/codex-rs/core/src/codex_thread.rs @@ -171,7 +171,7 @@ impl CodexThread { if was_zero { self.codex .session - .set_out_of_band_elicitation_pause_state(true); + .set_out_of_band_elicitation_pause_state(/*paused=*/ true); } Ok(*guard) @@ -190,7 +190,7 @@ impl CodexThread { if now_zero { self.codex .session - .set_out_of_band_elicitation_pause_state(false); + .set_out_of_band_elicitation_pause_state(/*paused=*/ false); } Ok(*guard) diff --git a/codex-rs/core/src/compact.rs b/codex-rs/core/src/compact.rs index 4900051938..a1675cba37 100644 --- a/codex-rs/core/src/compact.rs +++ b/codex-rs/core/src/compact.rs @@ -163,7 +163,7 @@ async fn run_compact_task_inner( continue; } sess.set_total_tokens_full(turn_context.as_ref()).await; - let event = EventMsg::Error(e.to_error_event(None)); + let event = EventMsg::Error(e.to_error_event(/*message_prefix=*/ None)); sess.send_event(&turn_context, event).await; return Err(e); } @@ -180,7 +180,7 @@ async fn run_compact_task_inner( tokio::time::sleep(delay).await; continue; } else { - let event = EventMsg::Error(e.to_error_event(None)); + let event = EventMsg::Error(e.to_error_event(/*message_prefix=*/ None)); sess.send_event(&turn_context, event).await; return Err(e); } diff --git a/codex-rs/core/src/compact_remote.rs b/codex-rs/core/src/compact_remote.rs index 339065f72c..2cddf056dc 100644 --- a/codex-rs/core/src/compact_remote.rs +++ b/codex-rs/core/src/compact_remote.rs @@ -101,7 +101,7 @@ async fn run_remote_compact_task_inner_impl( turn_context.as_ref(), &prompt_input, &HashSet::new(), - None, + /*skills_outcome=*/ None, &CancellationToken::new(), ) .await?; diff --git a/codex-rs/core/src/config/agent_roles.rs b/codex-rs/core/src/config/agent_roles.rs index 2004f64405..8de4d4ac56 100644 --- a/codex-rs/core/src/config/agent_roles.rs +++ b/codex-rs/core/src/config/agent_roles.rs @@ -450,13 +450,14 @@ fn discover_agent_roles_in_dir( if declared_role_files.contains(&agent_file) { continue; } - let parsed_file = match read_resolved_agent_role_file(&agent_file, None) { - Ok(parsed_file) => parsed_file, - Err(err) => { - push_agent_role_warning(startup_warnings, err); - continue; - } - }; + let parsed_file = + match read_resolved_agent_role_file(&agent_file, /*role_name_hint=*/ None) { + Ok(parsed_file) => parsed_file, + Err(err) => { + push_agent_role_warning(startup_warnings, err); + continue; + } + }; let role_name = parsed_file.role_name; if roles.contains_key(&role_name) { push_agent_role_warning( diff --git a/codex-rs/core/src/config/managed_features.rs b/codex-rs/core/src/config/managed_features.rs index 4e45dedf91..b6eb2b89b6 100644 --- a/codex-rs/core/src/config/managed_features.rs +++ b/codex-rs/core/src/config/managed_features.rs @@ -81,11 +81,11 @@ impl ManagedFeatures { } pub fn enable(&mut self, feature: Feature) -> ConstraintResult<()> { - self.set_enabled(feature, true) + self.set_enabled(feature, /*enabled=*/ true) } pub fn disable(&mut self, feature: Feature) -> ConstraintResult<()> { - self.set_enabled(feature, false) + self.set_enabled(feature, /*enabled=*/ false) } } @@ -321,7 +321,12 @@ pub(crate) fn validate_feature_requirements_in_config_toml( }) } - validate_profile(cfg, None, &ConfigProfile::default(), feature_requirements)?; + validate_profile( + cfg, + /*profile_name=*/ None, + &ConfigProfile::default(), + feature_requirements, + )?; for (profile_name, profile) in &cfg.profiles { validate_profile(cfg, Some(profile_name), profile, feature_requirements)?; } diff --git a/codex-rs/core/src/config_loader/layer_io.rs b/codex-rs/core/src/config_loader/layer_io.rs index 5caebdf527..33a81879da 100644 --- a/codex-rs/core/src/config_loader/layer_io.rs +++ b/codex-rs/core/src/config_loader/layer_io.rs @@ -56,12 +56,13 @@ pub(super) async fn load_config_layers_internal( managed_config_path.unwrap_or_else(|| managed_config_default_path(codex_home)), )?; - let managed_config = read_config_from_path(&managed_config_path, false) - .await? - .map(|managed_config| MangedConfigFromFile { - managed_config, - file: managed_config_path.clone(), - }); + let managed_config = + read_config_from_path(&managed_config_path, /*log_missing_as_info=*/ false) + .await? + .map(|managed_config| MangedConfigFromFile { + managed_config, + file: managed_config_path.clone(), + }); #[cfg(target_os = "macos")] let managed_preferences = diff --git a/codex-rs/core/src/config_loader/mod.rs b/codex-rs/core/src/config_loader/mod.rs index 576a390f5e..ade1b6448a 100644 --- a/codex-rs/core/src/config_loader/mod.rs +++ b/codex-rs/core/src/config_loader/mod.rs @@ -853,15 +853,20 @@ async fn load_project_layers( &dot_codex_abs, &layer_dir, TomlValue::Table(toml::map::Map::new()), - true, + /*config_toml_exists=*/ true, )); continue; } }; let config = resolve_relative_paths_in_config_toml(config, dot_codex_abs.as_path())?; - let entry = - project_layer_entry(trust_context, &dot_codex_abs, &layer_dir, config, true); + let entry = project_layer_entry( + trust_context, + &dot_codex_abs, + &layer_dir, + config, + /*config_toml_exists=*/ true, + ); layers.push(entry); } Err(err) => { @@ -874,7 +879,7 @@ async fn load_project_layers( &dot_codex_abs, &layer_dir, TomlValue::Table(toml::map::Map::new()), - false, + /*config_toml_exists=*/ false, )); } else { let config_file_display = config_file.as_path().display(); diff --git a/codex-rs/core/src/connectors.rs b/codex-rs/core/src/connectors.rs index af1b5c5abe..b564eff4d3 100644 --- a/codex-rs/core/src/connectors.rs +++ b/codex-rs/core/src/connectors.rs @@ -104,9 +104,11 @@ pub async fn list_accessible_connectors_from_mcp_tools( config: &Config, ) -> anyhow::Result> { Ok( - list_accessible_connectors_from_mcp_tools_with_options_and_status(config, false) - .await? - .connectors, + list_accessible_connectors_from_mcp_tools_with_options_and_status( + config, /*force_refetch=*/ false, + ) + .await? + .connectors, ) } @@ -186,7 +188,12 @@ pub async fn list_accessible_connectors_from_mcp_tools_with_options_and_status( }); } - let mcp_servers = with_codex_apps_mcp(HashMap::new(), true, auth.as_ref(), config); + let mcp_servers = with_codex_apps_mcp( + HashMap::new(), + /*connectors_enabled=*/ true, + auth.as_ref(), + config, + ); if mcp_servers.is_empty() { return Ok(AccessibleConnectorsStatus { connectors: Vec::new(), @@ -459,7 +466,7 @@ async fn chatgpt_get_request_with_token( fn auth_manager_from_config(config: &Config) -> std::sync::Arc { AuthManager::shared( config.codex_home.clone(), - false, + /*enable_codex_api_key_env=*/ false, config.cli_auth_credentials_store_mode, ) } diff --git a/codex-rs/core/src/default_client.rs b/codex-rs/core/src/default_client.rs index 809c73eed1..fb2a52e243 100644 --- a/codex-rs/core/src/default_client.rs +++ b/codex-rs/core/src/default_client.rs @@ -97,7 +97,7 @@ pub fn originator() -> Originator { } if std::env::var(CODEX_INTERNAL_ORIGINATOR_OVERRIDE_ENV_VAR).is_ok() { - let originator = get_originator_value(None); + let originator = get_originator_value(/*provided=*/ None); if let Ok(mut guard) = ORIGINATOR.write() { match guard.as_ref() { Some(originator) => return originator.clone(), @@ -107,7 +107,7 @@ pub fn originator() -> Originator { return originator; } - get_originator_value(None) + get_originator_value(/*provided=*/ None) } pub fn is_first_party_originator(originator_value: &str) -> bool { diff --git a/codex-rs/core/src/environment_context.rs b/codex-rs/core/src/environment_context.rs index 0c42cd0900..db3c78bdf3 100644 --- a/codex-rs/core/src/environment_context.rs +++ b/codex-rs/core/src/environment_context.rs @@ -82,7 +82,14 @@ impl EnvironmentContext { } else { before_network }; - EnvironmentContext::new(cwd, shell.clone(), current_date, timezone, network, None) + EnvironmentContext::new( + cwd, + shell.clone(), + current_date, + timezone, + network, + /*subagents=*/ None, + ) } pub fn from_turn_context(turn_context: &TurnContext, shell: &Shell) -> Self { @@ -92,7 +99,7 @@ impl EnvironmentContext { turn_context.current_date.clone(), turn_context.timezone.clone(), Self::network_from_turn_context(turn_context), - None, + /*subagents=*/ None, ) } @@ -103,7 +110,7 @@ impl EnvironmentContext { turn_context_item.current_date.clone(), turn_context_item.timezone.clone(), Self::network_from_turn_context_item(turn_context_item), - None, + /*subagents=*/ None, ) } diff --git a/codex-rs/core/src/exec.rs b/codex-rs/core/src/exec.rs index 8bb16b2a5e..07d44fc717 100644 --- a/codex-rs/core/src/exec.rs +++ b/codex-rs/core/src/exec.rs @@ -877,12 +877,12 @@ async fn consume_truncated_output( let stdout_handle = tokio::spawn(read_capped( BufReader::new(stdout_reader), stdout_stream.clone(), - false, + /*is_stderr=*/ false, )); let stderr_handle = tokio::spawn(read_capped( BufReader::new(stderr_reader), stdout_stream.clone(), - true, + /*is_stderr=*/ true, )); let (exit_status, timed_out) = tokio::select! { diff --git a/codex-rs/core/src/external_agent_config.rs b/codex-rs/core/src/external_agent_config.rs index 4df4d60ebe..46a4b5fa1e 100644 --- a/codex-rs/core/src/external_agent_config.rs +++ b/codex-rs/core/src/external_agent_config.rs @@ -60,7 +60,7 @@ impl ExternalAgentConfigService { ) -> io::Result> { let mut items = Vec::new(); if params.include_home { - self.detect_migrations(None, &mut items)?; + self.detect_migrations(/*repo_root=*/ None, &mut items)?; } for cwd in params.cwds.as_deref().unwrap_or(&[]) { @@ -81,7 +81,7 @@ impl ExternalAgentConfigService { emit_migration_metric( EXTERNAL_AGENT_CONFIG_IMPORT_METRIC, ExternalAgentConfigMigrationItemType::Config, - None, + /*skills_count=*/ None, ); } ExternalAgentConfigMigrationItemType::Skills => { @@ -97,7 +97,7 @@ impl ExternalAgentConfigService { emit_migration_metric( EXTERNAL_AGENT_CONFIG_IMPORT_METRIC, ExternalAgentConfigMigrationItemType::AgentsMd, - None, + /*skills_count=*/ None, ); } ExternalAgentConfigMigrationItemType::McpServerConfig => {} @@ -153,7 +153,7 @@ impl ExternalAgentConfigService { emit_migration_metric( EXTERNAL_AGENT_CONFIG_DETECT_METRIC, ExternalAgentConfigMigrationItemType::Config, - None, + /*skills_count=*/ None, ); } } @@ -210,7 +210,7 @@ impl ExternalAgentConfigService { emit_migration_metric( EXTERNAL_AGENT_CONFIG_DETECT_METRIC, ExternalAgentConfigMigrationItemType::AgentsMd, - None, + /*skills_count=*/ None, ); } diff --git a/codex-rs/core/src/guardian.rs b/codex-rs/core/src/guardian.rs index 8db5af402b..598b285697 100644 --- a/codex-rs/core/src/guardian.rs +++ b/codex-rs/core/src/guardian.rs @@ -614,7 +614,7 @@ async fn run_guardian_subagent( turn, child_cancel.clone(), SubAgentSource::Other(GUARDIAN_SUBAGENT_NAME.to_string()), - None, + /*initial_history=*/ None, ) .await?; // Preserve exact session-scoped network approvals after spawn so their diff --git a/codex-rs/core/src/landlock.rs b/codex-rs/core/src/landlock.rs index ea65595e11..e5834078ce 100644 --- a/codex-rs/core/src/landlock.rs +++ b/codex-rs/core/src/landlock.rs @@ -43,7 +43,7 @@ where network_sandbox_policy, sandbox_policy_cwd, use_legacy_landlock, - allow_network_for_proxy(false), + allow_network_for_proxy(/*enforce_managed_network=*/ false), ); let arg0 = Some("codex-linux-sandbox"); spawn_child_async(SpawnChildRequest { diff --git a/codex-rs/core/src/mcp/mod.rs b/codex-rs/core/src/mcp/mod.rs index 3140f5bcff..cbc9c87ba5 100644 --- a/codex-rs/core/src/mcp/mod.rs +++ b/codex-rs/core/src/mcp/mod.rs @@ -277,7 +277,7 @@ fn effective_mcp_servers( pub async fn collect_mcp_snapshot(config: &Config) -> McpListToolsResponseEvent { let auth_manager = AuthManager::shared( config.codex_home.clone(), - false, + /*enable_codex_api_key_env=*/ false, config.cli_auth_credentials_store_mode, ); let auth = auth_manager.auth().await; diff --git a/codex-rs/core/src/mcp/skill_dependencies.rs b/codex-rs/core/src/mcp/skill_dependencies.rs index 15f09932a8..c835de0910 100644 --- a/codex-rs/core/src/mcp/skill_dependencies.rs +++ b/codex-rs/core/src/mcp/skill_dependencies.rs @@ -239,7 +239,7 @@ pub(crate) async fn maybe_install_mcp_dependencies( .await; let resolved_scopes = resolve_oauth_scopes( - None, + /*explicit_scopes=*/ None, server_config.scopes.clone(), oauth_config.discovered_scopes.clone(), ); diff --git a/codex-rs/core/src/mcp_tool_call.rs b/codex-rs/core/src/mcp_tool_call.rs index 7430312136..15a6341a9f 100644 --- a/codex-rs/core/src/mcp_tool_call.rs +++ b/codex-rs/core/src/mcp_tool_call.rs @@ -495,7 +495,7 @@ async fn maybe_request_mcp_tool_approval( sess, turn_context, build_guardian_mcp_tool_review_request(invocation, metadata), - None, + /*retry_reason=*/ None, ) .await; let decision = mcp_tool_approval_decision_from_guardian(decision); diff --git a/codex-rs/core/src/network_proxy_loader.rs b/codex-rs/core/src/network_proxy_loader.rs index 0509988510..21480020e0 100644 --- a/codex-rs/core/src/network_proxy_loader.rs +++ b/codex-rs/core/src/network_proxy_loader.rs @@ -46,7 +46,7 @@ async fn build_config_state_with_mtimes() -> Result<(ConfigState, Vec io: && let Some(ids) = state_db::list_thread_ids_db( Some(state_db_ctx.as_ref()), codex_home, - 1, - None, + /*page_size=*/ 1, + /*cursor=*/ None, ThreadSortKey::CreatedAt, allowed_sources, - None, - false, + /*model_providers=*/ None, + /*archived_only=*/ false, "personality_migration", ) .await @@ -86,8 +86,8 @@ async fn has_recorded_sessions(codex_home: &Path, default_provider: &str) -> io: let sessions = get_threads_in_root( codex_home.join(SESSIONS_SUBDIR), - 1, - None, + /*page_size=*/ 1, + /*cursor=*/ None, ThreadSortKey::CreatedAt, ThreadListConfig { allowed_sources, @@ -103,8 +103,8 @@ async fn has_recorded_sessions(codex_home: &Path, default_provider: &str) -> io: let archived_sessions = get_threads_in_root( codex_home.join(ARCHIVED_SESSIONS_SUBDIR), - 1, - None, + /*page_size=*/ 1, + /*cursor=*/ None, ThreadSortKey::CreatedAt, ThreadListConfig { allowed_sources, diff --git a/codex-rs/core/src/plugins/manager.rs b/codex-rs/core/src/plugins/manager.rs index ef9cbefe85..d3cbbf1dde 100644 --- a/codex-rs/core/src/plugins/manager.rs +++ b/codex-rs/core/src/plugins/manager.rs @@ -434,7 +434,11 @@ impl PluginsManager { } pub fn plugins_for_config(&self, config: &Config) -> PluginLoadOutcome { - self.plugins_for_layer_stack(&config.cwd, &config.config_layer_stack, false) + self.plugins_for_layer_stack( + &config.cwd, + &config.config_layer_stack, + /*force_reload=*/ false, + ) } pub fn plugins_for_layer_stack( diff --git a/codex-rs/core/src/realtime_context.rs b/codex-rs/core/src/realtime_context.rs index 8016763514..171fd6b372 100644 --- a/codex-rs/core/src/realtime_context.rs +++ b/codex-rs/core/src/realtime_context.rs @@ -235,7 +235,7 @@ fn render_tree(root: &Path) -> Option> { } let mut lines = Vec::new(); - collect_tree_lines(root, 0, &mut lines); + collect_tree_lines(root, /*depth=*/ 0, &mut lines); (!lines.is_empty()).then_some(lines) } diff --git a/codex-rs/core/src/review_format.rs b/codex-rs/core/src/review_format.rs index 10f53066a7..e7beae57ae 100644 --- a/codex-rs/core/src/review_format.rs +++ b/codex-rs/core/src/review_format.rs @@ -68,7 +68,7 @@ pub fn render_review_output_text(output: &ReviewOutputEvent) -> String { sections.push(explanation.to_string()); } if !output.findings.is_empty() { - let findings = format_review_findings_block(&output.findings, None); + let findings = format_review_findings_block(&output.findings, /*selection=*/ None); let trimmed = findings.trim(); if !trimmed.is_empty() { sections.push(trimmed.to_string()); diff --git a/codex-rs/core/src/rollout/recorder.rs b/codex-rs/core/src/rollout/recorder.rs index c4ec88784b..9c2c97f3c3 100644 --- a/codex-rs/core/src/rollout/recorder.rs +++ b/codex-rs/core/src/rollout/recorder.rs @@ -180,7 +180,7 @@ impl RolloutRecorder { allowed_sources, model_providers, default_provider, - false, + /*archived=*/ false, search_term, ) .await @@ -206,7 +206,7 @@ impl RolloutRecorder { allowed_sources, model_providers, default_provider, - true, + /*archived=*/ true, search_term, ) .await @@ -320,8 +320,8 @@ impl RolloutRecorder { sort_key, allowed_sources, model_providers, - false, - None, + /*archived=*/ false, + /*search_term=*/ None, ) .await else { @@ -889,7 +889,7 @@ async fn write_and_reconcile_items( state_builder, items, default_provider, - None, + /*new_thread_memory_mode=*/ None, ) .await; Ok(()) diff --git a/codex-rs/core/src/sandboxing/mod.rs b/codex-rs/core/src/sandboxing/mod.rs index b6b9fd2f5b..95dcb91898 100644 --- a/codex-rs/core/src/sandboxing/mod.rs +++ b/codex-rs/core/src/sandboxing/mod.rs @@ -728,7 +728,13 @@ pub async fn execute_env( stdout_stream: Option, ) -> crate::error::Result { let effective_policy = exec_request.sandbox_policy.clone(); - execute_exec_request(exec_request, &effective_policy, stdout_stream, None).await + execute_exec_request( + exec_request, + &effective_policy, + stdout_stream, + /*after_spawn=*/ None, + ) + .await } pub async fn execute_exec_request_with_after_spawn( diff --git a/codex-rs/core/src/seatbelt.rs b/codex-rs/core/src/seatbelt.rs index 672165526b..d487e5f959 100644 --- a/codex-rs/core/src/seatbelt.rs +++ b/codex-rs/core/src/seatbelt.rs @@ -45,8 +45,13 @@ pub async fn spawn_command_under_seatbelt( network: Option<&NetworkProxy>, mut env: HashMap, ) -> std::io::Result { - let args = - create_seatbelt_command_args(command, sandbox_policy, sandbox_policy_cwd, false, network); + let args = create_seatbelt_command_args( + command, + sandbox_policy, + sandbox_policy_cwd, + /*enforce_managed_network=*/ false, + network, + ); let arg0 = None; env.insert(CODEX_SANDBOX_ENV_VAR.to_string(), "seatbelt".to_string()); spawn_child_async(SpawnChildRequest { @@ -338,7 +343,7 @@ pub(crate) fn create_seatbelt_command_args( sandbox_policy_cwd, enforce_managed_network, network, - None, + /*extensions=*/ None, ) } diff --git a/codex-rs/core/src/shell.rs b/codex-rs/core/src/shell.rs index dba595c1ec..e6a26c6ea0 100644 --- a/codex-rs/core/src/shell.rs +++ b/codex-rs/core/src/shell.rs @@ -291,20 +291,20 @@ pub fn default_user_shell() -> Shell { fn default_user_shell_from_path(user_shell_path: Option) -> Shell { if cfg!(windows) { - get_shell(ShellType::PowerShell, None).unwrap_or(ultimate_fallback_shell()) + get_shell(ShellType::PowerShell, /*path=*/ None).unwrap_or(ultimate_fallback_shell()) } else { let user_default_shell = user_shell_path .and_then(|shell| detect_shell_type(&shell)) - .and_then(|shell_type| get_shell(shell_type, None)); + .and_then(|shell_type| get_shell(shell_type, /*path=*/ None)); let shell_with_fallback = if cfg!(target_os = "macos") { user_default_shell - .or_else(|| get_shell(ShellType::Zsh, None)) - .or_else(|| get_shell(ShellType::Bash, None)) + .or_else(|| get_shell(ShellType::Zsh, /*path=*/ None)) + .or_else(|| get_shell(ShellType::Bash, /*path=*/ None)) } else { user_default_shell - .or_else(|| get_shell(ShellType::Bash, None)) - .or_else(|| get_shell(ShellType::Zsh, None)) + .or_else(|| get_shell(ShellType::Bash, /*path=*/ None)) + .or_else(|| get_shell(ShellType::Zsh, /*path=*/ None)) }; shell_with_fallback.unwrap_or(ultimate_fallback_shell()) diff --git a/codex-rs/core/src/shell_snapshot.rs b/codex-rs/core/src/shell_snapshot.rs index 2c6c9b5295..0942d62d90 100644 --- a/codex-rs/core/src/shell_snapshot.rs +++ b/codex-rs/core/src/shell_snapshot.rs @@ -199,7 +199,7 @@ async fn write_shell_snapshot( if shell_type == ShellType::PowerShell || shell_type == ShellType::Cmd { bail!("Shell snapshot not supported yet for {shell_type:?}"); } - let shell = get_shell(shell_type.clone(), None) + let shell = get_shell(shell_type.clone(), /*path=*/ None) .with_context(|| format!("No available shell for {shell_type:?}"))?; let raw_snapshot = capture_snapshot(&shell, cwd).await?; @@ -243,13 +243,26 @@ fn strip_snapshot_preamble(snapshot: &str) -> Result { async fn validate_snapshot(shell: &Shell, snapshot_path: &Path, cwd: &Path) -> Result<()> { let snapshot_path_display = snapshot_path.display(); let script = format!("set -e; . \"{snapshot_path_display}\""); - run_script_with_timeout(shell, &script, SNAPSHOT_TIMEOUT, false, cwd) - .await - .map(|_| ()) + run_script_with_timeout( + shell, + &script, + SNAPSHOT_TIMEOUT, + /*use_login_shell=*/ false, + cwd, + ) + .await + .map(|_| ()) } async fn run_shell_script(shell: &Shell, script: &str, cwd: &Path) -> Result { - run_script_with_timeout(shell, script, SNAPSHOT_TIMEOUT, true, cwd).await + run_script_with_timeout( + shell, + script, + SNAPSHOT_TIMEOUT, + /*use_login_shell=*/ true, + cwd, + ) + .await } async fn run_script_with_timeout( diff --git a/codex-rs/core/src/state_db.rs b/codex-rs/core/src/state_db.rs index 536b335035..639b8a6abc 100644 --- a/codex-rs/core/src/state_db.rs +++ b/codex-rs/core/src/state_db.rs @@ -350,7 +350,7 @@ pub async fn reconcile_rollout( items, "reconcile_rollout", new_thread_memory_mode, - None, + /*updated_at_override=*/ None, ) .await; return; @@ -472,10 +472,10 @@ pub async fn read_repair_rollout_path( Some(ctx), rollout_path, default_provider.as_str(), - None, + /*builder=*/ None, &[], archived_only, - None, + /*new_thread_memory_mode=*/ None, ) .await; } diff --git a/codex-rs/core/src/tasks/regular.rs b/codex-rs/core/src/tasks/regular.rs index 78bbd1db4c..d6ad5e9122 100644 --- a/codex-rs/core/src/tasks/regular.rs +++ b/codex-rs/core/src/tasks/regular.rs @@ -81,7 +81,8 @@ impl SessionTask for RegularTask { ) -> Option { 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, diff --git a/codex-rs/core/src/tasks/review.rs b/codex-rs/core/src/tasks/review.rs index 0a72355b5b..dfbc99cff9 100644 --- a/codex-rs/core/src/tasks/review.rs +++ b/codex-rs/core/src/tasks/review.rs @@ -80,7 +80,7 @@ impl SessionTask for ReviewTask { } async fn abort(&self, session: Arc, ctx: Arc) { - 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 = diff --git a/codex-rs/core/src/tasks/user_shell.rs b/codex-rs/core/src/tasks/user_shell.rs index 64fe70491d..2f4cfdd464 100644 --- a/codex-rs/core/src/tasks/user_shell.rs +++ b/codex-rs/core/src/tasks/user_shell.rs @@ -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) => { diff --git a/codex-rs/core/src/terminal.rs b/codex-rs/core/src/terminal.rs index f875fcd9e6..d81bf2eb04 100644 --- a/codex-rs/core/src/terminal.rs +++ b/codex-rs/core/src/terminal.rs @@ -108,7 +108,13 @@ impl TerminalInfo { version: Option, multiplexer: Option, ) -> Self { - Self::new(name, Some(term_program), version, None, multiplexer) + Self::new( + name, + Some(term_program), + version, + /*term=*/ None, + multiplexer, + ) } /// Creates terminal metadata from a `TERM_PROGRAM` match plus a `TERM` value. @@ -128,7 +134,13 @@ impl TerminalInfo { version: Option, multiplexer: Option, ) -> Self { - Self::new(name, None, version, None, multiplexer) + Self::new( + name, + /*term_program=*/ None, + version, + /*term=*/ None, + multiplexer, + ) } /// Creates terminal metadata from a `TERM` capability value. @@ -138,12 +150,24 @@ impl TerminalInfo { } else { TerminalName::Unknown }; - Self::new(name, None, None, Some(term), multiplexer) + Self::new( + name, + /*term_program=*/ None, + /*version=*/ None, + Some(term), + multiplexer, + ) } /// Creates terminal metadata for unknown terminals. fn unknown(multiplexer: Option) -> Self { - Self::new(TerminalName::Unknown, None, None, None, multiplexer) + Self::new( + TerminalName::Unknown, + /*term_program=*/ None, + /*version=*/ None, + /*term=*/ None, + multiplexer, + ) } /// Formats the terminal info as a User-Agent token. @@ -279,11 +303,15 @@ fn detect_terminal_info_from_env(env: &dyn Environment) -> TerminalInfo { } if env.has("ITERM_SESSION_ID") || env.has("ITERM_PROFILE") || env.has("ITERM_PROFILE_NAME") { - return TerminalInfo::from_name(TerminalName::Iterm2, None, multiplexer); + return TerminalInfo::from_name(TerminalName::Iterm2, /*version=*/ None, multiplexer); } if env.has("TERM_SESSION_ID") { - return TerminalInfo::from_name(TerminalName::AppleTerminal, None, multiplexer); + return TerminalInfo::from_name( + TerminalName::AppleTerminal, + /*version=*/ None, + multiplexer, + ); } if env.has("KITTY_WINDOW_ID") @@ -292,7 +320,7 @@ fn detect_terminal_info_from_env(env: &dyn Environment) -> TerminalInfo { .map(|term| term.contains("kitty")) .unwrap_or(false) { - return TerminalInfo::from_name(TerminalName::Kitty, None, multiplexer); + return TerminalInfo::from_name(TerminalName::Kitty, /*version=*/ None, multiplexer); } if env.has("ALACRITTY_SOCKET") @@ -301,7 +329,11 @@ fn detect_terminal_info_from_env(env: &dyn Environment) -> TerminalInfo { .map(|term| term == "alacritty") .unwrap_or(false) { - return TerminalInfo::from_name(TerminalName::Alacritty, None, multiplexer); + return TerminalInfo::from_name( + TerminalName::Alacritty, + /*version=*/ None, + multiplexer, + ); } if env.has("KONSOLE_VERSION") { @@ -310,7 +342,11 @@ fn detect_terminal_info_from_env(env: &dyn Environment) -> TerminalInfo { } if env.has("GNOME_TERMINAL_SCREEN") { - return TerminalInfo::from_name(TerminalName::GnomeTerminal, None, multiplexer); + return TerminalInfo::from_name( + TerminalName::GnomeTerminal, + /*version=*/ None, + multiplexer, + ); } if env.has("VTE_VERSION") { @@ -319,7 +355,11 @@ fn detect_terminal_info_from_env(env: &dyn Environment) -> TerminalInfo { } if env.has("WT_SESSION") { - return TerminalInfo::from_name(TerminalName::WindowsTerminal, None, multiplexer); + return TerminalInfo::from_name( + TerminalName::WindowsTerminal, + /*version=*/ None, + multiplexer, + ); } if let Some(term) = env.var_non_empty("TERM") { diff --git a/codex-rs/core/src/thread_manager.rs b/codex-rs/core/src/thread_manager.rs index 3ed8e8f0b3..20b8629fbd 100644 --- a/codex-rs/core/src/thread_manager.rs +++ b/codex-rs/core/src/thread_manager.rs @@ -206,7 +206,7 @@ impl ThreadManager { auth: CodexAuth, provider: ModelProviderInfo, ) -> Self { - set_thread_manager_test_mode_for_tests(true); + set_thread_manager_test_mode_for_tests(/*enabled=*/ true); let codex_home = std::env::temp_dir().join(format!( "codex-thread-manager-test-{}", uuid::Uuid::new_v4() @@ -226,7 +226,7 @@ impl ThreadManager { provider: ModelProviderInfo, codex_home: PathBuf, ) -> Self { - set_thread_manager_test_mode_for_tests(true); + set_thread_manager_test_mode_for_tests(/*enabled=*/ true); let auth_manager = AuthManager::from_auth_for_testing(auth); let (thread_created_tx, _) = broadcast::channel(THREAD_CREATED_CHANNEL_CAPACITY); let plugins_manager = Arc::new(PluginsManager::new(codex_home.clone())); @@ -234,7 +234,7 @@ impl ThreadManager { let skills_manager = Arc::new(SkillsManager::new( codex_home.clone(), Arc::clone(&plugins_manager), - true, + /*bundled_skills_enabled=*/ true, )); let file_watcher = build_file_watcher(codex_home.clone(), Arc::clone(&skills_manager)); Self { @@ -333,7 +333,12 @@ impl ThreadManager { pub async fn start_thread(&self, config: Config) -> CodexResult { // Box delegated thread-spawn futures so these convenience wrappers do // not inline the full spawn path into every caller's async state. - Box::pin(self.start_thread_with_tools(config, Vec::new(), false)).await + Box::pin(self.start_thread_with_tools( + config, + Vec::new(), + /*persist_extended_history=*/ false, + )) + .await } pub async fn start_thread_with_tools( @@ -346,8 +351,8 @@ impl ThreadManager { config, dynamic_tools, persist_extended_history, - None, - None, + /*metrics_service_name=*/ None, + /*parent_trace=*/ None, )) .await } @@ -385,7 +390,7 @@ impl ThreadManager { config, initial_history, auth_manager, - false, + /*persist_extended_history=*/ false, parent_trace, )) .await @@ -406,7 +411,7 @@ impl ThreadManager { self.agent_control(), Vec::new(), persist_extended_history, - None, + /*metrics_service_name=*/ None, parent_trace, )) .await @@ -491,7 +496,7 @@ impl ThreadManager { self.agent_control(), Vec::new(), persist_extended_history, - None, + /*metrics_service_name=*/ None, parent_trace, )) .await @@ -551,9 +556,9 @@ impl ThreadManagerState { config, agent_control, self.session_source.clone(), - false, - None, - None, + /*persist_extended_history=*/ false, + /*metrics_service_name=*/ None, + /*inherited_shell_snapshot=*/ None, )) .await } @@ -577,7 +582,7 @@ impl ThreadManagerState { persist_extended_history, metrics_service_name, inherited_shell_snapshot, - None, + /*parent_trace=*/ None, )) .await } @@ -598,10 +603,10 @@ impl ThreadManagerState { agent_control, session_source, Vec::new(), - false, - None, + /*persist_extended_history=*/ false, + /*metrics_service_name=*/ None, inherited_shell_snapshot, - None, + /*parent_trace=*/ None, )) .await } @@ -623,9 +628,9 @@ impl ThreadManagerState { session_source, Vec::new(), persist_extended_history, - None, + /*metrics_service_name=*/ None, inherited_shell_snapshot, - None, + /*parent_trace=*/ None, )) .await } @@ -652,7 +657,7 @@ impl ThreadManagerState { dynamic_tools, persist_extended_history, metrics_service_name, - None, + /*inherited_shell_snapshot=*/ None, parent_trace, )) .await diff --git a/codex-rs/core/src/tools/code_mode/execute_handler.rs b/codex-rs/core/src/tools/code_mode/execute_handler.rs index 6c9009948a..4e2a292807 100644 --- a/codex-rs/core/src/tools/code_mode/execute_handler.rs +++ b/codex-rs/core/src/tools/code_mode/execute_handler.rs @@ -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)) diff --git a/codex-rs/core/src/tools/code_mode/mod.rs b/codex-rs/core/src/tools/code_mode/mod.rs index fd79f9a7d7..ec1526b025 100644 --- a/codex-rs/core/src/tools/code_mode/mod.rs +++ b/codex-rs/core/src/tools/code_mode/mod.rs @@ -230,7 +230,7 @@ async fn build_enabled_tools(exec: &ExecContext) -> Vec { 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::>(); out.sort_by(|left, right| left.tool_name.cmp(&right.tool_name)); diff --git a/codex-rs/core/src/tools/context.rs b/codex-rs/core/src/tools/context.rs index b8e9121ec2..83a28bd492 100644 --- a/codex-rs/core/src/tools/context.rs +++ b/codex-rs/core/src/tools/context.rs @@ -230,7 +230,7 @@ impl ToolOutput for AbortedToolOutput { vec![FunctionCallOutputContentItem::InputText { text: self.message.clone(), }], - None, + /*success=*/ None, ), } } diff --git a/codex-rs/core/src/tools/events.rs b/codex-rs/core/src/tools/events.rs index 2bacd188d5..d0f7423b3f 100644 --- a/codex-rs/core/src/tools/events.rs +++ b/codex-rs/core/src/tools/events.rs @@ -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, diff --git a/codex-rs/core/src/tools/handlers/agent_jobs.rs b/codex-rs/core/src/tools/handlers/agent_jobs.rs index 4e786178f8..a7c3893da3 100644 --- a/codex-rs/core/src/tools/handlers/agent_jobs.rs +++ b/codex-rs/core/src/tools/handlers/agent_jobs.rs @@ -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?; @@ -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(()) } diff --git a/codex-rs/core/src/tools/handlers/artifacts.rs b/codex-rs/core/src/tools/handlers/artifacts.rs index bbcbcd3c80..8f90ad54d9 100644 --- a/codex-rs/core/src/tools/handlers/artifacts.rs +++ b/codex-rs/core/src/tools/handlers/artifacts.rs @@ -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 { diff --git a/codex-rs/core/src/tools/handlers/js_repl.rs b/codex-rs/core/src/tools/handlers/js_repl.rs index bfb531f923..00c45aa617 100644 --- a/codex-rs/core/src/tools/handlers/js_repl.rs +++ b/codex-rs/core/src/tools/handlers/js_repl.rs @@ -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; diff --git a/codex-rs/core/src/tools/handlers/multi_agents/resume_agent.rs b/codex-rs/core/src/tools/handlers/multi_agents/resume_agent.rs index bc8b78a449..7cf4838944 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/resume_agent.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/resume_agent.rs @@ -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))?; diff --git a/codex-rs/core/src/tools/handlers/multi_agents/wait.rs b/codex-rs/core/src/tools/handlers/multi_agents/wait.rs index 3bd0922fce..1d0868b3d3 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/wait.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/wait.rs @@ -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 { diff --git a/codex-rs/core/src/tools/handlers/shell.rs b/codex-rs/core/src/tools/handlers/shell.rs index a3014a8ed4..a9665608d1 100644 --- a/codex-rs/core/src/tools/handlers/shell.rs +++ b/codex-rs/core/src/tools/handlers/shell.rs @@ -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))) } diff --git a/codex-rs/core/src/tools/js_repl/mod.rs b/codex-rs/core/src/tools/js_repl/mod.rs index 1ef5be5ff4..334af3467a 100644 --- a/codex-rs/core/src/tools/js_repl/mod.rs +++ b/codex-rs/core/src/tools/js_repl/mod.rs @@ -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, diff --git a/codex-rs/core/src/tools/network_approval.rs b/codex-rs/core/src/tools/network_approval.rs index 756b643701..466d931863 100644 --- a/codex-rs/core/src/tools/network_approval.rs +++ b/codex-rs/core/src/tools/network_approval.rs @@ -360,14 +360,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 diff --git a/codex-rs/core/src/tools/registry.rs b/codex-rs/core/src/tools/registry.rs index e06e3442a6..a091e65c07 100644 --- a/codex-rs/core/src/tools/registry.rs +++ b/codex-rs/core/src/tools/registry.rs @@ -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( diff --git a/codex-rs/core/src/tools/runtimes/apply_patch.rs b/codex-rs/core/src/tools/runtimes/apply_patch.rs index 48b30fcec5..04b48df31f 100644 --- a/codex-rs/core/src/tools/runtimes/apply_patch.rs +++ b/codex-rs/core/src/tools/runtimes/apply_patch.rs @@ -143,7 +143,13 @@ impl Approvable 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(); } @@ -154,7 +160,10 @@ impl Approvable 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() }, @@ -194,7 +203,7 @@ impl ToolRuntime for ApplyPatchRuntime { ) -> Result { 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 diff --git a/codex-rs/core/src/tools/runtimes/shell.rs b/codex-rs/core/src/tools/runtimes/shell.rs index daf8e82906..f0faaf5af5 100644 --- a/codex-rs/core/src/tools/runtimes/shell.rs +++ b/codex-rs/core/src/tools/runtimes/shell.rs @@ -173,7 +173,7 @@ impl Approvable for ShellRuntime { .request_command_approval( turn, call_id, - None, + /*approval_id=*/ None, command, cwd, reason, @@ -182,7 +182,7 @@ impl Approvable for ShellRuntime { .proposed_execpolicy_amendment() .cloned(), req.additional_permissions.clone(), - None, + /*skill_metadata=*/ None, available_decisions, ) .await diff --git a/codex-rs/core/src/tools/runtimes/shell/unix_escalation.rs b/codex-rs/core/src/tools/runtimes/shell/unix_escalation.rs index 6303f9c492..b06c0703be 100644 --- a/codex-rs/core/src/tools/runtimes/shell/unix_escalation.rs +++ b/codex-rs/core/src/tools/runtimes/shell/unix_escalation.rs @@ -455,7 +455,7 @@ impl CoreShellActionProvider { cwd: workdir, additional_permissions, }, - None, + /*retry_reason=*/ None, ) .await; } @@ -488,9 +488,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), @@ -933,7 +933,7 @@ impl ShellCommandExecutor for CoreShellCommandExecutor { justification: self.justification.clone(), arg0: self.arg0.clone(), }, - None, + /*stdout_stream=*/ None, after_spawn, ) .await?; diff --git a/codex-rs/core/src/tools/runtimes/unified_exec.rs b/codex-rs/core/src/tools/runtimes/unified_exec.rs index 8d15c96c65..a77c6e19ec 100644 --- a/codex-rs/core/src/tools/runtimes/unified_exec.rs +++ b/codex-rs/core/src/tools/runtimes/unified_exec.rs @@ -139,7 +139,7 @@ impl Approvable for UnifiedExecRuntime<'_> { .request_command_approval( turn, call_id, - None, + /*approval_id=*/ None, command, cwd, reason, @@ -148,7 +148,7 @@ impl Approvable for UnifiedExecRuntime<'_> { .proposed_execpolicy_amendment() .cloned(), req.additional_permissions.clone(), - None, + /*skill_metadata=*/ None, available_decisions, ) .await diff --git a/codex-rs/core/src/tools/spec.rs b/codex-rs/core/src/tools/spec.rs index f062389797..a9d4fb51f8 100644 --- a/codex-rs/core/src/tools/spec.rs +++ b/codex-rs/core/src/tools/spec.rs @@ -2165,7 +2165,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); } @@ -2473,14 +2473,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, @@ -2493,14 +2495,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); @@ -2511,7 +2513,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, ); } @@ -2519,7 +2521,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, ); } @@ -2530,13 +2532,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()); @@ -2552,7 +2554,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, ); } @@ -2570,19 +2572,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()); @@ -2593,7 +2595,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); @@ -2602,13 +2604,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); @@ -2621,7 +2623,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); @@ -2631,7 +2633,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); @@ -2644,7 +2646,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); @@ -2662,7 +2664,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); } @@ -2672,7 +2677,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, ); } @@ -2680,7 +2685,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, ); } @@ -2696,7 +2701,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); @@ -2710,7 +2715,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); @@ -2725,7 +2730,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); @@ -2739,7 +2744,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); @@ -2780,7 +2785,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, ); } @@ -2791,7 +2796,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, ); } @@ -2799,7 +2804,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); @@ -2808,7 +2813,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); @@ -2818,31 +2823,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)); @@ -2857,7 +2862,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()); @@ -2865,7 +2870,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); @@ -2882,7 +2887,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()); @@ -2901,7 +2906,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()); diff --git a/codex-rs/core/src/turn_metadata.rs b/codex-rs/core/src/turn_metadata.rs index 44d36b3a14..a39051ab8d 100644 --- a/codex-rs/core/src/turn_metadata.rs +++ b/codex-rs/core/src/turn_metadata.rs @@ -104,7 +104,7 @@ pub async fn build_turn_metadata_header(cwd: &Path, sandbox: Option<&str>) -> Op } build_turn_metadata_bag( - None, + /*turn_id=*/ None, sandbox.map(ToString::to_string), repo_root, Some(WorkspaceGitMetadata { @@ -135,7 +135,12 @@ impl TurnMetadataState { ) -> Self { let repo_root = get_git_repo_root(&cwd).map(|root| root.to_string_lossy().into_owned()); let sandbox = Some(sandbox_tag(sandbox_policy, windows_sandbox_level).to_string()); - let base_metadata = build_turn_metadata_bag(Some(turn_id), sandbox, None, None); + let base_metadata = build_turn_metadata_bag( + Some(turn_id), + sandbox, + /*repo_root=*/ None, + /*workspace_git_metadata=*/ None, + ); let base_header = base_metadata .to_header_value() .unwrap_or_else(|| "{}".to_string()); diff --git a/codex-rs/core/src/unified_exec/async_watcher.rs b/codex-rs/core/src/unified_exec/async_watcher.rs index d595342544..886563858d 100644 --- a/codex-rs/core/src/unified_exec/async_watcher.rs +++ b/codex-rs/core/src/unified_exec/async_watcher.rs @@ -196,7 +196,12 @@ pub(crate) async fn emit_exec_end_for_unified_exec( duration, timed_out: false, }; - let event_ctx = ToolEventCtx::new(session_ref.as_ref(), turn_ref.as_ref(), &call_id, None); + let event_ctx = ToolEventCtx::new( + session_ref.as_ref(), + turn_ref.as_ref(), + &call_id, + /*turn_diff_tracker=*/ None, + ); let emitter = ToolEmitter::unified_exec( &command, cwd, diff --git a/codex-rs/core/src/unified_exec/process_manager.rs b/codex-rs/core/src/unified_exec/process_manager.rs index 08f654d129..2690fbdbc7 100644 --- a/codex-rs/core/src/unified_exec/process_manager.rs +++ b/codex-rs/core/src/unified_exec/process_manager.rs @@ -180,7 +180,7 @@ impl UnifiedExecProcessManager { context.session.as_ref(), context.turn.as_ref(), &context.call_id, - None, + /*turn_diff_tracker=*/ None, ); let emitter = ToolEmitter::unified_exec( &request.command, diff --git a/codex-rs/core/tests/common/lib.rs b/codex-rs/core/tests/common/lib.rs index 40bb09037c..5782f5a5db 100644 --- a/codex-rs/core/tests/common/lib.rs +++ b/codex-rs/core/tests/common/lib.rs @@ -79,7 +79,7 @@ pub fn test_path_buf_with_windows(unix_path: &str, windows_path: Option<&str>) - } pub fn test_path_buf(unix_path: &str) -> PathBuf { - test_path_buf_with_windows(unix_path, None) + test_path_buf_with_windows(unix_path, /*windows_path=*/ None) } pub fn test_absolute_path_with_windows( @@ -91,7 +91,7 @@ pub fn test_absolute_path_with_windows( } pub fn test_absolute_path(unix_path: &str) -> AbsolutePathBuf { - test_absolute_path_with_windows(unix_path, None) + test_absolute_path_with_windows(unix_path, /*windows_path=*/ None) } pub fn test_tmp_path() -> AbsolutePathBuf { diff --git a/codex-rs/core/tests/common/streaming_sse.rs b/codex-rs/core/tests/common/streaming_sse.rs index db34a2c172..05ba23649b 100644 --- a/codex-rs/core/tests/common/streaming_sse.rs +++ b/codex-rs/core/tests/common/streaming_sse.rs @@ -81,7 +81,7 @@ pub async fn start_streaming_sse_server( tokio::spawn(async move { let (request, body_prefix) = read_http_request(&mut stream).await; let Some((method, path)) = parse_request_line(&request) else { - let _ = write_http_response(&mut stream, 400, "bad request", "text/plain").await; + let _ = write_http_response(&mut stream, /*status=*/ 400, "bad request", "text/plain").await; return; }; @@ -90,7 +90,7 @@ pub async fn start_streaming_sse_server( .await .is_err() { - let _ = write_http_response(&mut stream, 400, "bad request", "text/plain").await; + let _ = write_http_response(&mut stream, /*status=*/ 400, "bad request", "text/plain").await; return; } let body = serde_json::json!({ @@ -98,7 +98,7 @@ pub async fn start_streaming_sse_server( "object": "list" }) .to_string(); - let _ = write_http_response(&mut stream, 200, &body, "application/json").await; + let _ = write_http_response(&mut stream, /*status=*/ 200, &body, "application/json").await; return; } @@ -108,13 +108,13 @@ pub async fn start_streaming_sse_server( { Ok(body) => body, Err(_) => { - let _ = write_http_response(&mut stream, 400, "bad request", "text/plain").await; + let _ = write_http_response(&mut stream, /*status=*/ 400, "bad request", "text/plain").await; return; } }; requests.lock().await.push(body); let Some((chunks, completion)) = take_next_stream(&state).await else { - let _ = write_http_response(&mut stream, 500, "no responses queued", "text/plain").await; + let _ = write_http_response(&mut stream, /*status=*/ 500, "no responses queued", "text/plain").await; return; }; @@ -138,7 +138,7 @@ pub async fn start_streaming_sse_server( return; } - let _ = write_http_response(&mut stream, 404, "not found", "text/plain").await; + let _ = write_http_response(&mut stream, /*status=*/ 404, "not found", "text/plain").await; }); } } diff --git a/codex-rs/core/tests/common/test_codex.rs b/codex-rs/core/tests/common/test_codex.rs index b2aaec7772..f334e6ab27 100644 --- a/codex-rs/core/tests/common/test_codex.rs +++ b/codex-rs/core/tests/common/test_codex.rs @@ -105,7 +105,7 @@ impl TestCodexBuilder { Some(home) => home, None => Arc::new(TempDir::new()?), }; - Box::pin(self.build_with_home(server, home, None)).await + Box::pin(self.build_with_home(server, home, /*resume_from=*/ None)).await } pub async fn build_with_streaming_server( @@ -117,7 +117,12 @@ impl TestCodexBuilder { Some(home) => home, None => Arc::new(TempDir::new()?), }; - Box::pin(self.build_with_home_and_base_url(format!("{base_url}/v1"), home, None)).await + Box::pin(self.build_with_home_and_base_url( + format!("{base_url}/v1"), + home, + /*resume_from=*/ None, + )) + .await } pub async fn build_with_websocket_server( @@ -138,7 +143,7 @@ impl TestCodexBuilder { .enable(Feature::ResponsesWebsockets) .expect("test config should allow feature update"); })); - Box::pin(self.build_with_home_and_base_url(base_url, home, None)).await + Box::pin(self.build_with_home_and_base_url(base_url, home, /*resume_from=*/ None)).await } pub async fn resume( @@ -362,8 +367,13 @@ impl TestCodex { approval_policy: AskForApproval, sandbox_policy: SandboxPolicy, ) -> Result<()> { - self.submit_turn_with_context(prompt, approval_policy, sandbox_policy, None) - .await + self.submit_turn_with_context( + prompt, + approval_policy, + sandbox_policy, + /*service_tier=*/ None, + ) + .await } async fn submit_turn_with_context( diff --git a/codex-rs/core/tests/common/zsh_fork.rs b/codex-rs/core/tests/common/zsh_fork.rs index fbc46421d9..5a5b173548 100644 --- a/codex-rs/core/tests/common/zsh_fork.rs +++ b/codex-rs/core/tests/common/zsh_fork.rs @@ -102,7 +102,7 @@ fn find_test_zsh_path() -> Result> { return Ok(None); } - match crate::fetch_dotslash_file(&dotslash_zsh, None) { + match crate::fetch_dotslash_file(&dotslash_zsh, /*dotslash_cache=*/ None) { Ok(path) => Ok(Some(path)), Err(error) => { eprintln!("skipping zsh-fork test: failed to fetch zsh via dotslash: {error:#}"); diff --git a/codex-rs/debug-client/src/main.rs b/codex-rs/debug-client/src/main.rs index e51376fb51..ed6e37cd0e 100644 --- a/codex-rs/debug-client/src/main.rs +++ b/codex-rs/debug-client/src/main.rs @@ -219,7 +219,7 @@ fn handle_command( true } UserCommand::RefreshThread => { - match client.request_thread_list(None) { + match client.request_thread_list(/*cursor=*/ None) { Ok(request_id) => { output .client_line(&format!("requested thread list ({request_id:?})")) diff --git a/codex-rs/exec/src/event_processor_with_human_output.rs b/codex-rs/exec/src/event_processor_with_human_output.rs index 79c0f1b695..a7c092eae6 100644 --- a/codex-rs/exec/src/event_processor_with_human_output.rs +++ b/codex-rs/exec/src/event_processor_with_human_output.rs @@ -777,7 +777,7 @@ impl EventProcessor for EventProcessorWithHumanOutput { self, "{} {}", "collab".style(self.magenta), - format_collab_invocation("wait", &call_id, None).style(self.bold) + format_collab_invocation("wait", &call_id, /*prompt=*/ None).style(self.bold) ); eprintln!( " receivers: {}", @@ -794,7 +794,7 @@ impl EventProcessor for EventProcessorWithHumanOutput { ts_msg!( self, "{} {}:", - format_collab_invocation("wait", &call_id, None), + format_collab_invocation("wait", &call_id, /*prompt=*/ None), "timed out".style(self.yellow) ); return CodexStatus::Running; @@ -803,7 +803,7 @@ impl EventProcessor for EventProcessorWithHumanOutput { let title_style = if success { self.green } else { self.red }; let title = format!( "{} {} agents complete:", - format_collab_invocation("wait", &call_id, None), + format_collab_invocation("wait", &call_id, /*prompt=*/ None), statuses.len() ); ts_msg!(self, "{}", title.style(title_style)); @@ -829,7 +829,8 @@ impl EventProcessor for EventProcessorWithHumanOutput { self, "{} {}", "collab".style(self.magenta), - format_collab_invocation("close_agent", &call_id, None).style(self.bold) + format_collab_invocation("close_agent", &call_id, /*prompt=*/ None) + .style(self.bold) ); eprintln!( " receiver: {}", @@ -847,7 +848,7 @@ impl EventProcessor for EventProcessorWithHumanOutput { let title_style = if success { self.green } else { self.red }; let title = format!( "{} {}:", - format_collab_invocation("close_agent", &call_id, None), + format_collab_invocation("close_agent", &call_id, /*prompt=*/ None), format_collab_status(&status) ); ts_msg!(self, "{}", title.style(title_style)); @@ -1246,7 +1247,7 @@ fn format_collab_invocation(tool: &str, call_id: &str, prompt: Option<&str>) -> let prompt = prompt .map(str::trim) .filter(|prompt| !prompt.is_empty()) - .map(|prompt| truncate_preview(prompt, 120)); + .map(|prompt| truncate_preview(prompt, /*max_chars=*/ 120)); match prompt { Some(prompt) => format!("{tool}({call_id}, prompt=\"{prompt}\")"), None => format!("{tool}({call_id})"), @@ -1258,7 +1259,7 @@ fn format_collab_status(status: &AgentStatus) -> String { AgentStatus::PendingInit => "pending init".to_string(), AgentStatus::Running => "running".to_string(), AgentStatus::Completed(Some(message)) => { - let preview = truncate_preview(message.trim(), 120); + let preview = truncate_preview(message.trim(), /*max_chars=*/ 120); if preview.is_empty() { "completed".to_string() } else { @@ -1267,7 +1268,7 @@ fn format_collab_status(status: &AgentStatus) -> String { } AgentStatus::Completed(None) => "completed".to_string(), AgentStatus::Errored(message) => { - let preview = truncate_preview(message.trim(), 120); + let preview = truncate_preview(message.trim(), /*max_chars=*/ 120); if preview.is_empty() { "errored".to_string() } else { diff --git a/codex-rs/exec/src/event_processor_with_jsonl_output.rs b/codex-rs/exec/src/event_processor_with_jsonl_output.rs index 8bec82b15d..14bce202cf 100644 --- a/codex-rs/exec/src/event_processor_with_jsonl_output.rs +++ b/codex-rs/exec/src/event_processor_with_jsonl_output.rs @@ -495,7 +495,7 @@ impl EventProcessorWithJsonOutput { .iter() .map(ToString::to_string) .collect(), - None, + /*prompt=*/ None, ) } @@ -526,7 +526,7 @@ impl EventProcessorWithJsonOutput { CollabTool::Wait, ev.sender_thread_id.to_string(), receiver_thread_ids, - None, + /*prompt=*/ None, agents_states, status, ) @@ -538,7 +538,7 @@ impl EventProcessorWithJsonOutput { CollabTool::CloseAgent, ev.sender_thread_id.to_string(), vec![ev.receiver_thread_id.to_string()], - None, + /*prompt=*/ None, ) } @@ -555,7 +555,7 @@ impl EventProcessorWithJsonOutput { CollabTool::CloseAgent, ev.sender_thread_id.to_string(), vec![receiver_id.clone()], - None, + /*prompt=*/ None, [(receiver_id, agent_state)].into_iter().collect(), status, ) diff --git a/codex-rs/execpolicy-legacy/src/policy_parser.rs b/codex-rs/execpolicy-legacy/src/policy_parser.rs index b065c109a8..f1298ba7b8 100644 --- a/codex-rs/execpolicy-legacy/src/policy_parser.rs +++ b/codex-rs/execpolicy-legacy/src/policy_parser.rs @@ -221,6 +221,6 @@ fn policy_builtins(builder: &mut GlobalsBuilder) { } fn flag(name: String) -> anyhow::Result { - Ok(Opt::new(name, OptMeta::Flag, false)) + Ok(Opt::new(name, OptMeta::Flag, /*required=*/ false)) } } diff --git a/codex-rs/execpolicy/src/execpolicycheck.rs b/codex-rs/execpolicy/src/execpolicycheck.rs index 1ff8937a5d..aa78a5dcf6 100644 --- a/codex-rs/execpolicy/src/execpolicycheck.rs +++ b/codex-rs/execpolicy/src/execpolicycheck.rs @@ -44,7 +44,7 @@ impl ExecPolicyCheckCommand { let policy = load_policies(&self.rules)?; let matched_rules = policy.matches_for_command_with_options( &self.command, - None, + /*heuristics_fallback=*/ None, &MatchOptions { resolve_host_executables: self.resolve_host_executables, }, diff --git a/codex-rs/execpolicy/src/rule.rs b/codex-rs/execpolicy/src/rule.rs index 15401ec878..46dc1f98e0 100644 --- a/codex-rs/execpolicy/src/rule.rs +++ b/codex-rs/execpolicy/src/rule.rs @@ -255,7 +255,7 @@ pub(crate) fn validate_match_examples( for example in matches { if !policy - .matches_for_command_with_options(example, None, &options) + .matches_for_command_with_options(example, /*heuristics_fallback=*/ None, &options) .is_empty() { continue; @@ -290,7 +290,7 @@ pub(crate) fn validate_not_match_examples( for example in not_matches { if let Some(rule) = policy - .matches_for_command_with_options(example, None, &options) + .matches_for_command_with_options(example, /*heuristics_fallback=*/ None, &options) .first() { return Err(Error::ExampleDidMatch { diff --git a/codex-rs/file-search/src/lib.rs b/codex-rs/file-search/src/lib.rs index ba376c38f1..d447ddd9d1 100644 --- a/codex-rs/file-search/src/lib.rs +++ b/codex-rs/file-search/src/lib.rs @@ -261,7 +261,7 @@ pub async fn run_main( compute_indices, respect_gitignore: true, }, - None, + /*cancel_flag=*/ None, )?; let match_count = matches.len(); let matches_truncated = total_match_count > match_count; diff --git a/codex-rs/hooks/src/engine/discovery.rs b/codex-rs/hooks/src/engine/discovery.rs index 33a35bdef9..c9c8c0945f 100644 --- a/codex-rs/hooks/src/engine/discovery.rs +++ b/codex-rs/hooks/src/engine/discovery.rs @@ -87,7 +87,7 @@ pub(crate) fn discover_handlers(config_layer_stack: Option<&ConfigLayerStack>) - &mut display_order, source_path.as_path(), codex_protocol::protocol::HookEventName::Stop, - None, + /*matcher=*/ None, group.hooks, ); } diff --git a/codex-rs/hooks/src/events/stop.rs b/codex-rs/hooks/src/events/stop.rs index 1ac4028ad3..08b0b3f58c 100644 --- a/codex-rs/hooks/src/events/stop.rs +++ b/codex-rs/hooks/src/events/stop.rs @@ -50,10 +50,14 @@ pub(crate) fn preview( handlers: &[ConfiguredHandler], _request: &StopRequest, ) -> Vec { - dispatcher::select_handlers(handlers, HookEventName::Stop, None) - .into_iter() - .map(|handler| dispatcher::running_summary(&handler)) - .collect() + dispatcher::select_handlers( + handlers, + HookEventName::Stop, + /*session_start_source=*/ None, + ) + .into_iter() + .map(|handler| dispatcher::running_summary(&handler)) + .collect() } pub(crate) async fn run( @@ -61,7 +65,11 @@ pub(crate) async fn run( shell: &CommandShell, request: StopRequest, ) -> StopOutcome { - let matched = dispatcher::select_handlers(handlers, HookEventName::Stop, None); + let matched = dispatcher::select_handlers( + handlers, + HookEventName::Stop, + /*session_start_source=*/ None, + ); if matched.is_empty() { return StopOutcome { hook_events: Vec::new(), diff --git a/codex-rs/lmstudio/src/client.rs b/codex-rs/lmstudio/src/client.rs index a2a8ee03bf..fab262dbfa 100644 --- a/codex-rs/lmstudio/src/client.rs +++ b/codex-rs/lmstudio/src/client.rs @@ -125,7 +125,7 @@ impl LMStudioClient { // Find lms, checking fallback paths if not in PATH fn find_lms() -> std::io::Result { - Self::find_lms_with_home_dir(None) + Self::find_lms_with_home_dir(/*home_dir=*/ None) } fn find_lms_with_home_dir(home_dir: Option<&str>) -> std::io::Result { diff --git a/codex-rs/login/src/device_code_auth.rs b/codex-rs/login/src/device_code_auth.rs index 678781ac1c..aae4651ed3 100644 --- a/codex-rs/login/src/device_code_auth.rs +++ b/codex-rs/login/src/device_code_auth.rs @@ -212,7 +212,7 @@ pub async fn complete_device_code_login( crate::server::persist_tokens_async( &opts.codex_home, - None, + /*api_key=*/ None, tokens.id_token, tokens.access_token, tokens.refresh_token, diff --git a/codex-rs/login/src/server.rs b/codex-rs/login/src/server.rs index 2cb88c9ca7..ced0fc0448 100644 --- a/codex-rs/login/src/server.rs +++ b/codex-rs/login/src/server.rs @@ -317,7 +317,7 @@ async fn process_request( "Missing authorization code. Sign-in could not be completed.", io::ErrorKind::InvalidData, Some("missing_authorization_code"), - None, + /*error_description=*/ None, ); } }; @@ -335,7 +335,7 @@ async fn process_request( &message, io::ErrorKind::PermissionDenied, Some("workspace_restriction"), - None, + /*error_description=*/ None, ); } // Obtain API key via token-exchange and persist @@ -373,7 +373,7 @@ async fn process_request( "Sign-in completed but redirecting back to Codex failed.", io::ErrorKind::Other, Some("redirect_failed"), - None, + /*error_description=*/ None, ), } } @@ -384,7 +384,7 @@ async fn process_request( &format!("Token exchange failed: {err}"), io::ErrorKind::Other, Some("token_exchange_failed"), - None, + /*error_description=*/ None, ) } } diff --git a/codex-rs/mcp-server/src/codex_tool_runner.rs b/codex-rs/mcp-server/src/codex_tool_runner.rs index df38a1c0c8..48498318df 100644 --- a/codex-rs/mcp-server/src/codex_tool_runner.rs +++ b/codex-rs/mcp-server/src/codex_tool_runner.rs @@ -296,7 +296,9 @@ async fn run_codex_tool_session_inner( Some(msg) => msg, None => "".to_string(), }; - let result = create_call_tool_result_with_thread_id(thread_id, text, None); + let result = create_call_tool_result_with_thread_id( + thread_id, text, /*is_error=*/ None, + ); outgoing.send_response(request_id.clone(), result).await; // unregister the id so we don't keep it in the map running_requests_id_to_codex_uuid diff --git a/codex-rs/network-proxy/src/certs.rs b/codex-rs/network-proxy/src/certs.rs index 87ebe20a4c..63a9ea57d9 100644 --- a/codex-rs/network-proxy/src/certs.rs +++ b/codex-rs/network-proxy/src/certs.rs @@ -140,9 +140,9 @@ fn load_or_create_ca() -> Result<(String, String)> { // // We intentionally use create-new semantics: if a key already exists, we should not overwrite // it silently (that would invalidate previously-trusted cert chains). - write_atomic_create_new(&key_path, key_pem.as_bytes(), 0o600) + write_atomic_create_new(&key_path, key_pem.as_bytes(), /*mode=*/ 0o600) .with_context(|| format!("failed to persist CA key {}", key_path.display()))?; - if let Err(err) = write_atomic_create_new(&cert_path, cert_pem.as_bytes(), 0o644) + if let Err(err) = write_atomic_create_new(&cert_path, cert_pem.as_bytes(), /*mode=*/ 0o644) .with_context(|| format!("failed to persist CA cert {}", cert_path.display())) { // Avoid leaving a partially-created CA around (cert missing) if the second write fails. diff --git a/codex-rs/network-proxy/src/config.rs b/codex-rs/network-proxy/src/config.rs index e00ec1944a..8547aae553 100644 --- a/codex-rs/network-proxy/src/config.rs +++ b/codex-rs/network-proxy/src/config.rs @@ -208,9 +208,9 @@ pub(crate) fn validate_unix_socket_allowlist_paths(cfg: &NetworkProxyConfig) -> pub fn resolve_runtime(cfg: &NetworkProxyConfig) -> Result { validate_unix_socket_allowlist_paths(cfg)?; - let http_addr = resolve_addr(&cfg.network.proxy_url, 3128) + let http_addr = resolve_addr(&cfg.network.proxy_url, /*default_port=*/ 3128) .with_context(|| format!("invalid network.proxy_url: {}", cfg.network.proxy_url))?; - let socks_addr = resolve_addr(&cfg.network.socks_url, 8081) + let socks_addr = resolve_addr(&cfg.network.socks_url, /*default_port=*/ 8081) .with_context(|| format!("invalid network.socks_url: {}", cfg.network.socks_url))?; let (http_addr, socks_addr) = clamp_bind_addrs(http_addr, socks_addr, &cfg.network); diff --git a/codex-rs/network-proxy/src/http_proxy.rs b/codex-rs/network-proxy/src/http_proxy.rs index 879c9e91a2..ba04c5f597 100644 --- a/codex-rs/network-proxy/src/http_proxy.rs +++ b/codex-rs/network-proxy/src/http_proxy.rs @@ -187,7 +187,7 @@ async fn http_connect_accept( client_addr(&req), Some("CONNECT".to_string()), NetworkProtocol::HttpsConnect, - None, + /*audit_endpoint_override=*/ None, ) .await); } @@ -469,7 +469,7 @@ async fn http_plain_proxy( return Ok(proxy_disabled_response( &app_state, socket_path, - 0, + /*port=*/ 0, client_addr(&req), Some(req.method().as_str().to_string()), NetworkProtocol::Http, @@ -495,7 +495,11 @@ async fn http_plain_proxy( warn!( "unix socket blocked by method policy (client={client}, method={method}, mode=limited, allowed_methods=GET, HEAD, OPTIONS)" ); - return Ok(json_blocked("unix-socket", REASON_METHOD_NOT_ALLOWED, None)); + return Ok(json_blocked( + "unix-socket", + REASON_METHOD_NOT_ALLOWED, + /*details=*/ None, + )); } if !unix_socket_permissions_supported() { @@ -560,7 +564,11 @@ async fn http_plain_proxy( ); let client = client.as_deref().unwrap_or_default(); warn!("unix socket blocked (client={client}, path={socket_path})"); - Ok(json_blocked("unix-socket", REASON_NOT_ALLOWED, None)) + Ok(json_blocked( + "unix-socket", + REASON_NOT_ALLOWED, + /*details=*/ None, + )) } Err(err) => { warn!("unix socket check failed: {err}"); @@ -610,7 +618,7 @@ async fn http_plain_proxy( client_addr(&req), Some(req.method().as_str().to_string()), NetworkProtocol::Http, - None, + /*audit_endpoint_override=*/ None, ) .await); } diff --git a/codex-rs/network-proxy/src/policy.rs b/codex-rs/network-proxy/src/policy.rs index fb0305c82b..42edd08a55 100644 --- a/codex-rs/network-proxy/src/policy.rs +++ b/codex-rs/network-proxy/src/policy.rs @@ -58,14 +58,14 @@ fn is_non_public_ipv4(ip: Ipv4Addr) -> bool { || ip.is_unspecified() || ip.is_multicast() || ip.is_broadcast() - || ipv4_in_cidr(ip, [0, 0, 0, 0], 8) // "this network" (RFC 1122) - || ipv4_in_cidr(ip, [100, 64, 0, 0], 10) // CGNAT (RFC 6598) - || ipv4_in_cidr(ip, [192, 0, 0, 0], 24) // IETF Protocol Assignments (RFC 6890) - || ipv4_in_cidr(ip, [192, 0, 2, 0], 24) // TEST-NET-1 (RFC 5737) - || ipv4_in_cidr(ip, [198, 18, 0, 0], 15) // Benchmarking (RFC 2544) - || ipv4_in_cidr(ip, [198, 51, 100, 0], 24) // TEST-NET-2 (RFC 5737) - || ipv4_in_cidr(ip, [203, 0, 113, 0], 24) // TEST-NET-3 (RFC 5737) - || ipv4_in_cidr(ip, [240, 0, 0, 0], 4) // Reserved (RFC 6890) + || ipv4_in_cidr(ip, [0, 0, 0, 0], /*prefix=*/ 8) // "this network" (RFC 1122) + || ipv4_in_cidr(ip, [100, 64, 0, 0], /*prefix=*/ 10) // CGNAT (RFC 6598) + || ipv4_in_cidr(ip, [192, 0, 0, 0], /*prefix=*/ 24) // IETF Protocol Assignments (RFC 6890) + || ipv4_in_cidr(ip, [192, 0, 2, 0], /*prefix=*/ 24) // TEST-NET-1 (RFC 5737) + || ipv4_in_cidr(ip, [198, 18, 0, 0], /*prefix=*/ 15) // Benchmarking (RFC 2544) + || ipv4_in_cidr(ip, [198, 51, 100, 0], /*prefix=*/ 24) // TEST-NET-2 (RFC 5737) + || ipv4_in_cidr(ip, [203, 0, 113, 0], /*prefix=*/ 24) // TEST-NET-3 (RFC 5737) + || ipv4_in_cidr(ip, [240, 0, 0, 0], /*prefix=*/ 4) // Reserved (RFC 6890) } fn ipv4_in_cidr(ip: Ipv4Addr, base: [u8; 4], prefix: u8) -> bool { diff --git a/codex-rs/network-proxy/src/runtime.rs b/codex-rs/network-proxy/src/runtime.rs index d043106fa7..610c0ebdc8 100644 --- a/codex-rs/network-proxy/src/runtime.rs +++ b/codex-rs/network-proxy/src/runtime.rs @@ -253,7 +253,7 @@ impl NetworkProxyState { state, reloader, audit_metadata, - None, + /*blocked_request_observer=*/ None, ) } diff --git a/codex-rs/network-proxy/src/upstream.rs b/codex-rs/network-proxy/src/upstream.rs index 4ab6f22447..2539747929 100644 --- a/codex-rs/network-proxy/src/upstream.rs +++ b/codex-rs/network-proxy/src/upstream.rs @@ -88,7 +88,7 @@ fn read_proxy_env(keys: &[&str]) -> Option { } pub(crate) fn proxy_for_connect() -> Option { - ProxyConfig::from_env().proxy_for_protocol(true) + ProxyConfig::from_env().proxy_for_protocol(/*is_secure=*/ true) } #[derive(Clone)] diff --git a/codex-rs/otel/src/events/session_telemetry.rs b/codex-rs/otel/src/events/session_telemetry.rs index 327416093a..65d0d33fa2 100644 --- a/codex-rs/otel/src/events/session_telemetry.rs +++ b/codex-rs/otel/src/events/session_telemetry.rs @@ -359,7 +359,7 @@ impl SessionTelemetry { .unwrap_or_else(|| "none".to_string()); self.counter( API_CALL_COUNT_METRIC, - 1, + /*inc=*/ 1, &[("status", status_str.as_str()), ("success", success_str)], ); self.record_duration( @@ -385,7 +385,7 @@ impl SessionTelemetry { let success_str = if error.is_none() { "true" } else { "false" }; self.counter( WEBSOCKET_REQUEST_COUNT_METRIC, - 1, + /*inc=*/ 1, &[("success", success_str)], ); self.record_duration( @@ -486,7 +486,7 @@ impl SessionTelemetry { let kind_str = kind.as_deref().unwrap_or(WEBSOCKET_UNKNOWN_KIND); let success_str = if success { "true" } else { "false" }; let tags = [("kind", kind_str), ("success", success_str)]; - self.counter(WEBSOCKET_EVENT_COUNT_METRIC, 1, &tags); + self.counter(WEBSOCKET_EVENT_COUNT_METRIC, /*inc=*/ 1, &tags); self.record_duration(WEBSOCKET_EVENT_DURATION_METRIC, duration, &tags); log_and_trace_event!( self, @@ -540,11 +540,15 @@ impl SessionTelemetry { } } Ok(Some(Err(error))) => { - self.sse_event_failed(None, duration, error); + self.sse_event_failed(/*kind=*/ None, duration, error); } Ok(None) => {} Err(_) => { - self.sse_event_failed(None, duration, &"idle timeout waiting for SSE"); + self.sse_event_failed( + /*kind=*/ None, + duration, + &"idle timeout waiting for SSE", + ); } } } @@ -552,7 +556,7 @@ impl SessionTelemetry { fn sse_event(&self, kind: &str, duration: Duration) { self.counter( SSE_EVENT_COUNT_METRIC, - 1, + /*inc=*/ 1, &[("kind", kind), ("success", "true")], ); self.record_duration( @@ -575,7 +579,7 @@ impl SessionTelemetry { let kind_str = kind.map_or(SSE_UNKNOWN_KIND, String::as_str); self.counter( SSE_EVENT_COUNT_METRIC, - 1, + /*inc=*/ 1, &[("kind", kind_str), ("success", "false")], ); self.record_duration( @@ -789,7 +793,7 @@ impl SessionTelemetry { tags.push(("tool", tool_name)); tags.push(("success", success_str)); tags.extend_from_slice(extra_tags); - self.counter(TOOL_CALL_COUNT_METRIC, 1, &tags); + self.counter(TOOL_CALL_COUNT_METRIC, /*inc=*/ 1, &tags); self.record_duration(TOOL_CALL_DURATION_METRIC, duration, &tags); let mcp_server = mcp_server.unwrap_or(""); let mcp_server_origin = mcp_server_origin.unwrap_or(""); diff --git a/codex-rs/rmcp-client/src/auth_status.rs b/codex-rs/rmcp-client/src/auth_status.rs index 67ef0f756d..3d7e6df7ec 100644 --- a/codex-rs/rmcp-client/src/auth_status.rs +++ b/codex-rs/rmcp-client/src/auth_status.rs @@ -62,9 +62,11 @@ pub async fn determine_streamable_http_auth_status( /// Attempt to determine whether a streamable HTTP MCP server advertises OAuth login. pub async fn supports_oauth_login(url: &str) -> Result { - Ok(discover_streamable_http_oauth(url, None, None) - .await? - .is_some()) + Ok(discover_streamable_http_oauth( + url, /*http_headers=*/ None, /*env_http_headers=*/ None, + ) + .await? + .is_some()) } pub async fn discover_streamable_http_oauth( diff --git a/codex-rs/rmcp-client/src/perform_oauth_login.rs b/codex-rs/rmcp-client/src/perform_oauth_login.rs index 71ae013966..32d197bcce 100644 --- a/codex-rs/rmcp-client/src/perform_oauth_login.rs +++ b/codex-rs/rmcp-client/src/perform_oauth_login.rs @@ -92,10 +92,10 @@ pub async fn perform_oauth_login( headers, scopes, oauth_resource, - true, + /*launch_browser=*/ true, callback_port, callback_url, - None, + /*timeout_secs=*/ None, ) .await? .finish() @@ -126,7 +126,7 @@ pub async fn perform_oauth_login_return_url( headers, scopes, oauth_resource, - false, + /*launch_browser=*/ false, callback_port, callback_url, timeout_secs, diff --git a/codex-rs/rmcp-client/src/rmcp_client.rs b/codex-rs/rmcp-client/src/rmcp_client.rs index 97514ba20e..a8928616eb 100644 --- a/codex-rs/rmcp-client/src/rmcp_client.rs +++ b/codex-rs/rmcp-client/src/rmcp_client.rs @@ -734,19 +734,25 @@ impl RmcpClient { params: Option, ) -> Result<()> { self.refresh_oauth_if_needed().await; - self.run_service_operation("notifications/custom", None, move |service| { - let params = params.clone(); - async move { - service - .send_notification(ClientNotification::CustomNotification(CustomNotification { - method: method.to_string(), - params, - extensions: Extensions::new(), - })) - .await - } - .boxed() - }) + self.run_service_operation( + "notifications/custom", + /*timeout=*/ None, + move |service| { + let params = params.clone(); + async move { + service + .send_notification(ClientNotification::CustomNotification( + CustomNotification { + method: method.to_string(), + params, + extensions: Extensions::new(), + }, + )) + .await + } + .boxed() + }, + ) .await?; self.persist_oauth_tokens().await; Ok(()) @@ -759,7 +765,7 @@ impl RmcpClient { ) -> Result { self.refresh_oauth_if_needed().await; let response = self - .run_service_operation("requests/custom", None, move |service| { + .run_service_operation("requests/custom", /*timeout=*/ None, move |service| { let params = params.clone(); async move { service diff --git a/codex-rs/state/src/bin/logs_client.rs b/codex-rs/state/src/bin/logs_client.rs index e1d4e1faa8..e90bdc6a2e 100644 --- a/codex-rs/state/src/bin/logs_client.rs +++ b/codex-rs/state/src/bin/logs_client.rs @@ -205,7 +205,12 @@ async fn fetch_backfill( filter: &LogFilter, backfill: usize, ) -> anyhow::Result> { - let query = to_log_query(filter, Some(backfill), None, true); + let query = to_log_query( + filter, + Some(backfill), + /*after_id=*/ None, + /*descending=*/ true, + ); runtime .query_logs(&query) .await @@ -217,7 +222,12 @@ async fn fetch_new_rows( filter: &LogFilter, last_id: i64, ) -> anyhow::Result> { - let query = to_log_query(filter, None, Some(last_id), false); + let query = to_log_query( + filter, + /*limit=*/ None, + Some(last_id), + /*descending=*/ false, + ); runtime .query_logs(&query) .await @@ -225,7 +235,9 @@ async fn fetch_new_rows( } async fn fetch_max_id(runtime: &StateRuntime, filter: &LogFilter) -> anyhow::Result { - let query = to_log_query(filter, None, None, false); + let query = to_log_query( + filter, /*limit=*/ None, /*after_id=*/ None, /*descending=*/ false, + ); runtime .max_log_id(&query) .await diff --git a/codex-rs/state/src/runtime/memories.rs b/codex-rs/state/src/runtime/memories.rs index 0072e34fe7..cb4e310c1b 100644 --- a/codex-rs/state/src/runtime/memories.rs +++ b/codex-rs/state/src/runtime/memories.rs @@ -30,7 +30,8 @@ impl StateRuntime { /// stage-1 (`memory_stage1`) and phase-2 (`memory_consolidate_global`) /// memory pipelines. pub async fn clear_memory_data(&self) -> anyhow::Result<()> { - self.clear_memory_data_inner(false).await + self.clear_memory_data_inner(/*disable_existing_threads=*/ false) + .await } /// Resets persisted memory state for a clean-slate local start. @@ -39,7 +40,8 @@ impl StateRuntime { /// jobs, this disables memory generation for all existing threads so /// historical rollouts are not immediately picked up again. pub async fn reset_memory_data_for_fresh_start(&self) -> anyhow::Result<()> { - self.clear_memory_data_inner(true).await + self.clear_memory_data_inner(/*disable_existing_threads=*/ true) + .await } async fn clear_memory_data_inner(&self, disable_existing_threads: bool) -> anyhow::Result<()> { @@ -193,12 +195,12 @@ LEFT JOIN jobs ); push_thread_filters( &mut builder, - false, + /*archived_only=*/ false, allowed_sources, - None, - None, + /*model_providers=*/ None, + /*anchor=*/ None, SortKey::UpdatedAt, - None, + /*search_term=*/ None, ); builder.push(" AND threads.memory_mode = 'enabled'"); builder diff --git a/codex-rs/state/src/runtime/threads.rs b/codex-rs/state/src/runtime/threads.rs index 344a893640..ff91e10251 100644 --- a/codex-rs/state/src/runtime/threads.rs +++ b/codex-rs/state/src/runtime/threads.rs @@ -188,7 +188,7 @@ FROM threads model_providers, anchor, sort_key, - None, + /*search_term=*/ None, ); push_thread_order_and_limit(&mut builder, sort_key, limit); @@ -203,7 +203,7 @@ FROM threads /// Insert or replace thread metadata directly. pub async fn upsert_thread(&self, metadata: &crate::ThreadMetadata) -> anyhow::Result<()> { - self.upsert_thread_with_creation_memory_mode(metadata, None) + self.upsert_thread_with_creation_memory_mode(metadata, /*creation_memory_mode=*/ None) .await } diff --git a/codex-rs/tui/src/app.rs b/codex-rs/tui/src/app.rs index a125ed7d78..74d6597ec3 100644 --- a/codex-rs/tui/src/app.rs +++ b/codex-rs/tui/src/app.rs @@ -910,8 +910,10 @@ impl App { return; } - self.chat_widget - .add_info_message(format!("Opened {url} in your browser."), None); + self.chat_widget.add_info_message( + format!("Opened {url} in your browser."), + /*hint=*/ None, + ); } fn clear_ui_header_lines_with_version( @@ -1027,7 +1029,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 { @@ -1068,7 +1070,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; @@ -1349,7 +1351,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?; @@ -1380,7 +1385,7 @@ impl App { thread_id, session_source.get_nickname(), session_source.get_agent_role(), - false, + /*is_closed=*/ false, ); } Err(_) => { @@ -1399,7 +1404,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; } @@ -1522,7 +1527,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?; @@ -1675,13 +1680,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(); } @@ -2177,13 +2184,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( @@ -2193,7 +2206,7 @@ impl App { target_session.thread_id, &target_session.path, CwdPromptAction::Resume, - true, + /*allow_prompt=*/ true, ) .await? { @@ -2742,7 +2755,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, )); } }, @@ -2875,7 +2888,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!( @@ -2909,7 +2922,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!( @@ -2945,7 +2958,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"); @@ -2992,7 +3005,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, ); } } @@ -3524,7 +3537,7 @@ impl App { format!( "Agent thread {closed_thread_id} closed. Switched back to main thread." ), - None, + /*hint=*/ None, ); } else { self.clear_active_thread().await; @@ -3563,7 +3576,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(), @@ -3730,7 +3743,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(); } @@ -3794,7 +3807,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}")); diff --git a/codex-rs/tui/src/app/agent_navigation.rs b/codex-rs/tui/src/app/agent_navigation.rs index a77a49d96b..d57597e6d9 100644 --- a/codex-rs/tui/src/app/agent_navigation.rs +++ b/codex-rs/tui/src/app/agent_navigation.rs @@ -106,7 +106,10 @@ impl AgentNavigationState { if let Some(entry) = self.threads.get_mut(&thread_id) { entry.is_closed = true; } else { - self.upsert(thread_id, None, None, true); + self.upsert( + thread_id, /*agent_nickname=*/ None, /*agent_role=*/ None, + /*is_closed=*/ true, + ); } } @@ -202,7 +205,11 @@ impl AgentNavigationState { is_primary, ) }) - .unwrap_or_else(|| format_agent_picker_item_name(None, None, is_primary)), + .unwrap_or_else(|| { + format_agent_picker_item_name( + /*agent_nickname=*/ None, /*agent_role=*/ None, is_primary, + ) + }), ) } diff --git a/codex-rs/tui/src/app_backtrack.rs b/codex-rs/tui/src/app_backtrack.rs index 1bb2c29569..c09382b971 100644 --- a/codex-rs/tui/src/app_backtrack.rs +++ b/codex-rs/tui/src/app_backtrack.rs @@ -344,7 +344,7 @@ impl App { } else { self.backtrack.nth_user_message = usize::MAX; if let Some(Overlay::Transcript(t)) = &mut self.overlay { - t.set_highlight_cell(None); + t.set_highlight_cell(/*cell=*/ None); } } } diff --git a/codex-rs/tui/src/ascii_animation.rs b/codex-rs/tui/src/ascii_animation.rs index b2d9fc1d19..5da8974ce7 100644 --- a/codex-rs/tui/src/ascii_animation.rs +++ b/codex-rs/tui/src/ascii_animation.rs @@ -19,7 +19,7 @@ pub(crate) struct AsciiAnimation { impl AsciiAnimation { pub(crate) fn new(request_frame: FrameRequester) -> Self { - Self::with_variants(request_frame, ALL_VARIANTS, 0) + Self::with_variants(request_frame, ALL_VARIANTS, /*variant_idx=*/ 0) } pub(crate) fn with_variants( diff --git a/codex-rs/tui/src/bottom_pane/app_link_view.rs b/codex-rs/tui/src/bottom_pane/app_link_view.rs index 15596a9d7f..b819e4fb08 100644 --- a/codex-rs/tui/src/bottom_pane/app_link_view.rs +++ b/codex-rs/tui/src/bottom_pane/app_link_view.rs @@ -506,7 +506,7 @@ impl crate::render::renderable::Renderable for AppLinkView { ]) .areas(area); - let inner = content_area.inset(Insets::vh(1, 2)); + let inner = content_area.inset(Insets::vh(/*v=*/ 1, /*h=*/ 2)); let content_width = inner.width.max(1); let lines = self.content_lines(content_width); Paragraph::new(lines) diff --git a/codex-rs/tui/src/bottom_pane/chat_composer.rs b/codex-rs/tui/src/bottom_pane/chat_composer.rs index c3b73659b7..1d202cec7d 100644 --- a/codex-rs/tui/src/bottom_pane/chat_composer.rs +++ b/codex-rs/tui/src/bottom_pane/chat_composer.rs @@ -674,7 +674,12 @@ impl ChatComposer { }; let [composer_rect, popup_rect] = Layout::vertical([Constraint::Min(3), popup_constraint]).areas(area); - let mut textarea_rect = composer_rect.inset(Insets::tlbr(1, LIVE_PREFIX_COLS, 1, 1)); + let mut textarea_rect = composer_rect.inset(Insets::tlbr( + /*top=*/ 1, + LIVE_PREFIX_COLS, + /*bottom=*/ 1, + /*right=*/ 1, + )); let remote_images_height = self .remote_images_lines(textarea_rect.width) .len() @@ -1037,7 +1042,7 @@ impl ChatComposer { self.bind_mentions_from_snapshot(mention_bindings); self.relabel_attached_images_and_update_placeholders(); self.selected_remote_image_index = None; - self.textarea.set_cursor(0); + self.textarea.set_cursor(/*pos=*/ 0); self.sync_popups(); } @@ -2092,14 +2097,14 @@ impl ChatComposer { /// /// The returned string **does not** include the leading `@`. fn current_at_token(textarea: &TextArea) -> Option { - Self::current_prefixed_token(textarea, '@', false) + Self::current_prefixed_token(textarea, '@', /*allow_empty=*/ false) } fn current_mention_token(&self) -> Option { if !self.mentions_enabled() { return None; } - Self::current_prefixed_token(&self.textarea, '$', true) + Self::current_prefixed_token(&self.textarea, '$', /*allow_empty=*/ true) } /// Replace the active `@token` (the one under the cursor) with `path`. @@ -2329,7 +2334,7 @@ impl ChatComposer { r#"Unrecognized command '/{name}'. Type "/" for a list of supported commands."# ); self.app_event_tx.send(AppEvent::InsertHistoryCell(Box::new( - history_cell::new_info_event(message, None), + history_cell::new_info_event(message, /*hint=*/ None), ))); self.set_text_content_with_mention_bindings( original_input.clone(), @@ -2481,7 +2486,9 @@ impl ChatComposer { return (result, true); } - if let Some((text, text_elements)) = self.prepare_submission_text(true) { + if let Some((text, text_elements)) = + self.prepare_submission_text(/*record_history=*/ true) + { if should_queue { ( InputResult::Queued { @@ -2788,7 +2795,7 @@ impl ChatComposer { code: KeyCode::Enter, modifiers: KeyModifiers::NONE, .. - } => self.handle_submission(false), + } => self.handle_submission(/*should_queue=*/ false), input => self.handle_input_basic(input), } } @@ -4160,7 +4167,7 @@ impl Renderable for ChatComposer { } fn render(&self, area: Rect, buf: &mut Buffer) { - self.render_with_mask(area, buf, None); + self.render_with_mask(area, buf, /*mask_char=*/ None); } } @@ -4254,7 +4261,10 @@ impl ChatComposer { let right_line = if status_line_active { let full = mode_indicator_line(self.collaboration_mode_indicator, show_cycle_hint); - let compact = mode_indicator_line(self.collaboration_mode_indicator, false); + let compact = mode_indicator_line( + self.collaboration_mode_indicator, + /*show_cycle_hint=*/ false, + ); let full_width = full.as_ref().map(|l| l.width() as u16).unwrap_or(0); if can_show_left_with_context(hint_rect, left_width, full_width) { full diff --git a/codex-rs/tui/src/bottom_pane/command_popup.rs b/codex-rs/tui/src/bottom_pane/command_popup.rs index 0631f0362c..ff3ef3acd8 100644 --- a/codex-rs/tui/src/bottom_pane/command_popup.rs +++ b/codex-rs/tui/src/bottom_pane/command_popup.rs @@ -274,7 +274,9 @@ impl WidgetRef for CommandPopup { fn render_ref(&self, area: Rect, buf: &mut Buffer) { let rows = self.rows_from_matches(self.filtered()); render_rows( - area.inset(Insets::tlbr(0, 2, 0, 0)), + area.inset(Insets::tlbr( + /*top=*/ 0, /*left=*/ 2, /*bottom=*/ 0, /*right=*/ 0, + )), buf, &rows, &self.state, diff --git a/codex-rs/tui/src/bottom_pane/experimental_features_view.rs b/codex-rs/tui/src/bottom_pane/experimental_features_view.rs index 1fde95b08f..43161a406a 100644 --- a/codex-rs/tui/src/bottom_pane/experimental_features_view.rs +++ b/codex-rs/tui/src/bottom_pane/experimental_features_view.rs @@ -243,7 +243,7 @@ impl Renderable for ExperimentalFeaturesView { Constraint::Max(1), Constraint::Length(rows_height), ]) - .areas(content_area.inset(Insets::vh(1, 2))); + .areas(content_area.inset(Insets::vh(/*v=*/ 1, /*h=*/ 2))); self.header.render(header_area, buf); diff --git a/codex-rs/tui/src/bottom_pane/file_search_popup.rs b/codex-rs/tui/src/bottom_pane/file_search_popup.rs index 76f8bc1e1a..9112a9b7b8 100644 --- a/codex-rs/tui/src/bottom_pane/file_search_popup.rs +++ b/codex-rs/tui/src/bottom_pane/file_search_popup.rs @@ -141,7 +141,9 @@ impl WidgetRef for &FileSearchPopup { }; render_rows( - area.inset(Insets::tlbr(0, 2, 0, 0)), + area.inset(Insets::tlbr( + /*top=*/ 0, /*left=*/ 2, /*bottom=*/ 0, /*right=*/ 0, + )), buf, &rows_all, &self.state, diff --git a/codex-rs/tui/src/bottom_pane/footer.rs b/codex-rs/tui/src/bottom_pane/footer.rs index 1e4d5459cc..111663fec2 100644 --- a/codex-rs/tui/src/bottom_pane/footer.rs +++ b/codex-rs/tui/src/bottom_pane/footer.rs @@ -199,7 +199,14 @@ pub(crate) fn footer_height(props: &FooterProps) -> u16 { | FooterMode::ShortcutOverlay | FooterMode::EscHint => false, }; - footer_from_props_lines(props, None, false, show_shortcuts_hint, show_queue_hint).len() as u16 + footer_from_props_lines( + props, + /*collaboration_mode_indicator=*/ None, + /*show_cycle_hint=*/ false, + show_shortcuts_hint, + show_queue_hint, + ) + .len() as u16 } /// Render a single precomputed footer line. diff --git a/codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs b/codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs index 975b8701d2..7b9e56934d 100644 --- a/codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs +++ b/codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs @@ -1093,7 +1093,11 @@ impl McpServerElicitationOverlay { } self.validation_error = None; if self.request.response_mode == McpServerElicitationResponseMode::ApprovalAction { - let (decision, meta) = match self.field_value(0).as_ref().and_then(Value::as_str) { + let (decision, meta) = match self + .field_value(/*idx=*/ 0) + .as_ref() + .and_then(Value::as_str) + { Some(APPROVAL_ACCEPT_ONCE_VALUE) => (ElicitationAction::Accept, None), Some(APPROVAL_ACCEPT_SESSION_VALUE) => ( ElicitationAction::Accept, @@ -1160,7 +1164,7 @@ impl McpServerElicitationOverlay { if self.current_index() + 1 >= self.field_count() { self.submit_answers(); } else { - self.move_field(true); + self.move_field(/*next=*/ true); } } @@ -1455,7 +1459,7 @@ impl BottomPaneView for McpServerElicitationOverlay { modifiers: KeyModifiers::NONE, .. } => { - self.move_field(false); + self.move_field(/*next=*/ false); return; } KeyEvent { @@ -1468,7 +1472,7 @@ impl BottomPaneView for McpServerElicitationOverlay { modifiers: KeyModifiers::NONE, .. } => { - self.move_field(true); + self.move_field(/*next=*/ true); return; } KeyEvent { @@ -1476,7 +1480,7 @@ impl BottomPaneView for McpServerElicitationOverlay { modifiers: KeyModifiers::NONE, .. } if self.current_field_is_select() => { - self.move_field(false); + self.move_field(/*next=*/ false); return; } KeyEvent { @@ -1484,7 +1488,7 @@ impl BottomPaneView for McpServerElicitationOverlay { modifiers: KeyModifiers::NONE, .. } if self.current_field_is_select() => { - self.move_field(true); + self.move_field(/*next=*/ true); return; } _ => {} @@ -1507,10 +1511,10 @@ impl BottomPaneView for McpServerElicitationOverlay { } } KeyCode::Backspace | KeyCode::Delete => self.clear_selection(), - KeyCode::Char(' ') => self.select_current_option(true), + KeyCode::Char(' ') => self.select_current_option(/*committed=*/ true), KeyCode::Enter => { if self.selected_option_index().is_some() { - self.select_current_option(true); + self.select_current_option(/*committed=*/ true); } self.go_next_or_submit(); } @@ -1519,7 +1523,7 @@ impl BottomPaneView for McpServerElicitationOverlay { if let Some(answer) = self.current_answer_mut() { answer.selection.selected_idx = Some(option_idx); } - self.select_current_option(true); + self.select_current_option(/*committed=*/ true); self.go_next_or_submit(); } } diff --git a/codex-rs/tui/src/bottom_pane/mod.rs b/codex-rs/tui/src/bottom_pane/mod.rs index d15b03021e..92cb9eebac 100644 --- a/codex-rs/tui/src/bottom_pane/mod.rs +++ b/codex-rs/tui/src/bottom_pane/mod.rs @@ -700,14 +700,14 @@ impl BottomPane { pub(crate) fn show_esc_backtrack_hint(&mut self) { self.esc_backtrack_hint = true; - self.composer.set_esc_backtrack_hint(true); + self.composer.set_esc_backtrack_hint(/*show=*/ true); self.request_redraw(); } pub(crate) fn clear_esc_backtrack_hint(&mut self) { if self.esc_backtrack_hint { self.esc_backtrack_hint = false; - self.composer.set_esc_backtrack_hint(false); + self.composer.set_esc_backtrack_hint(/*show=*/ false); self.request_redraw(); } } @@ -729,7 +729,7 @@ impl BottomPane { )); } if let Some(status) = self.status.as_mut() { - status.set_interrupt_hint_visible(true); + status.set_interrupt_hint_visible(/*visible=*/ true); } self.sync_status_inline_message(); self.request_redraw(); @@ -943,7 +943,7 @@ impl BottomPane { ); self.pause_status_timer_for_modal(); self.set_composer_input_enabled( - false, + /*enabled=*/ false, Some("Answer the questions to continue.".to_string()), ); self.push_view(Box::new(modal)); @@ -1004,7 +1004,7 @@ impl BottomPane { ); self.pause_status_timer_for_modal(); self.set_composer_input_enabled( - false, + /*enabled=*/ false, Some("Respond to the tool suggestion to continue.".to_string()), ); self.push_view(Box::new(view)); @@ -1020,7 +1020,7 @@ impl BottomPane { ); self.pause_status_timer_for_modal(); self.set_composer_input_enabled( - false, + /*enabled=*/ false, Some("Respond to the MCP server request to continue.".to_string()), ); self.push_view(Box::new(modal)); @@ -1028,7 +1028,7 @@ impl BottomPane { fn on_active_view_complete(&mut self) { self.resume_status_timer_after_modal(); - self.set_composer_input_enabled(true, None); + self.set_composer_input_enabled(/*enabled=*/ true, /*placeholder=*/ None); } fn pause_status_timer_for_modal(&mut self) { @@ -1131,12 +1131,15 @@ impl BottomPane { } else { let mut flex = FlexRenderable::new(); if let Some(status) = &self.status { - flex.push(0, RenderableItem::Borrowed(status)); + flex.push(/*flex=*/ 0, RenderableItem::Borrowed(status)); } // Avoid double-surfacing the same summary and avoid adding an extra // row while the status line is already visible. if self.status.is_none() && !self.unified_exec_footer.is_empty() { - flex.push(0, RenderableItem::Borrowed(&self.unified_exec_footer)); + flex.push( + /*flex=*/ 0, + RenderableItem::Borrowed(&self.unified_exec_footer), + ); } let has_pending_thread_approvals = !self.pending_thread_approvals.is_empty(); let has_pending_input = !self.pending_input_preview.queued_messages.is_empty() @@ -1145,19 +1148,25 @@ impl BottomPane { self.status.is_some() || !self.unified_exec_footer.is_empty(); let has_inline_previews = has_pending_thread_approvals || has_pending_input; if has_inline_previews && has_status_or_footer { - flex.push(0, RenderableItem::Owned("".into())); + flex.push(/*flex=*/ 0, RenderableItem::Owned("".into())); } - flex.push(1, RenderableItem::Borrowed(&self.pending_thread_approvals)); + flex.push( + /*flex=*/ 1, + RenderableItem::Borrowed(&self.pending_thread_approvals), + ); if has_pending_thread_approvals && has_pending_input { - flex.push(0, RenderableItem::Owned("".into())); + flex.push(/*flex=*/ 0, RenderableItem::Owned("".into())); } - flex.push(1, RenderableItem::Borrowed(&self.pending_input_preview)); + flex.push( + /*flex=*/ 1, + RenderableItem::Borrowed(&self.pending_input_preview), + ); if !has_inline_previews && has_status_or_footer { - flex.push(0, RenderableItem::Owned("".into())); + flex.push(/*flex=*/ 0, RenderableItem::Owned("".into())); } let mut flex2 = FlexRenderable::new(); - flex2.push(1, RenderableItem::Owned(flex.into())); - flex2.push(0, RenderableItem::Borrowed(&self.composer)); + flex2.push(/*flex=*/ 1, RenderableItem::Owned(flex.into())); + flex2.push(/*flex=*/ 0, RenderableItem::Borrowed(&self.composer)); RenderableItem::Owned(Box::new(flex2)) } } diff --git a/codex-rs/tui/src/bottom_pane/multi_select_picker.rs b/codex-rs/tui/src/bottom_pane/multi_select_picker.rs index a8acf18668..3c37c72f7e 100644 --- a/codex-rs/tui/src/bottom_pane/multi_select_picker.rs +++ b/codex-rs/tui/src/bottom_pane/multi_select_picker.rs @@ -533,7 +533,7 @@ impl Renderable for MultiSelectPicker { Constraint::Length(2), Constraint::Length(rows_height), ]) - .areas(content_area.inset(Insets::vh(1, 2))); + .areas(content_area.inset(Insets::vh(/*v=*/ 1, /*h=*/ 2))); self.header.render(header_area, buf); diff --git a/codex-rs/tui/src/bottom_pane/request_user_input/mod.rs b/codex-rs/tui/src/bottom_pane/request_user_input/mod.rs index 79b1229800..3835e0fd0f 100644 --- a/codex-rs/tui/src/bottom_pane/request_user_input/mod.rs +++ b/codex-rs/tui/src/bottom_pane/request_user_input/mod.rs @@ -706,7 +706,7 @@ impl RequestUserInputOverlay { self.submit_answers(); } } else { - self.move_question(true); + self.move_question(/*next=*/ true); } } @@ -958,10 +958,10 @@ impl RequestUserInputOverlay { } } KeyCode::Up | KeyCode::Char('k') => { - state.move_up_wrap(2); + state.move_up_wrap(/*len=*/ 2); } KeyCode::Down | KeyCode::Char('j') => { - state.move_down_wrap(2); + state.move_down_wrap(/*len=*/ 2); } KeyCode::Enter => { let selected = state.selected_idx.unwrap_or(0); @@ -1024,7 +1024,7 @@ impl BottomPaneView for RequestUserInputOverlay { modifiers: KeyModifiers::NONE, .. } => { - self.move_question(false); + self.move_question(/*next=*/ false); return; } KeyEvent { @@ -1037,7 +1037,7 @@ impl BottomPaneView for RequestUserInputOverlay { modifiers: KeyModifiers::CONTROL, .. } => { - self.move_question(true); + self.move_question(/*next=*/ true); return; } KeyEvent { @@ -1045,7 +1045,7 @@ impl BottomPaneView for RequestUserInputOverlay { modifiers: KeyModifiers::NONE, .. } if self.has_options() && matches!(self.focus, Focus::Options) => { - self.move_question(false); + self.move_question(/*next=*/ false); return; } KeyEvent { @@ -1053,7 +1053,7 @@ impl BottomPaneView for RequestUserInputOverlay { modifiers: KeyModifiers::NONE, .. } if self.has_options() && matches!(self.focus, Focus::Options) => { - self.move_question(false); + self.move_question(/*next=*/ false); return; } KeyEvent { @@ -1061,7 +1061,7 @@ impl BottomPaneView for RequestUserInputOverlay { modifiers: KeyModifiers::NONE, .. } if self.has_options() && matches!(self.focus, Focus::Options) => { - self.move_question(true); + self.move_question(/*next=*/ true); return; } KeyEvent { @@ -1069,7 +1069,7 @@ impl BottomPaneView for RequestUserInputOverlay { modifiers: KeyModifiers::NONE, .. } if self.has_options() && matches!(self.focus, Focus::Options) => { - self.move_question(true); + self.move_question(/*next=*/ true); return; } _ => {} @@ -1105,7 +1105,7 @@ impl BottomPaneView for RequestUserInputOverlay { } } KeyCode::Char(' ') => { - self.select_current_option(true); + self.select_current_option(/*committed=*/ true); } KeyCode::Backspace | KeyCode::Delete => { self.clear_selection(); @@ -1119,7 +1119,7 @@ impl BottomPaneView for RequestUserInputOverlay { KeyCode::Enter => { let has_selection = self.selected_option_index().is_some(); if has_selection { - self.select_current_option(true); + self.select_current_option(/*committed=*/ true); } self.go_next_or_submit(); } @@ -1128,7 +1128,7 @@ impl BottomPaneView for RequestUserInputOverlay { if let Some(answer) = self.current_answer_mut() { answer.options_state.selected_idx = Some(option_idx); } - self.select_current_option(true); + self.select_current_option(/*committed=*/ true); self.go_next_or_submit(); } } @@ -1158,7 +1158,7 @@ impl BottomPaneView for RequestUserInputOverlay { if !self.handle_composer_input_result(result) { self.pending_submission_draft = None; if self.has_options() { - self.select_current_option(true); + self.select_current_option(/*committed=*/ true); } self.go_next_or_submit(); } diff --git a/codex-rs/tui/src/bottom_pane/skill_popup.rs b/codex-rs/tui/src/bottom_pane/skill_popup.rs index 9cff417615..ddf6ad2051 100644 --- a/codex-rs/tui/src/bottom_pane/skill_popup.rs +++ b/codex-rs/tui/src/bottom_pane/skill_popup.rs @@ -199,7 +199,9 @@ impl WidgetRef for SkillPopup { }; let rows = self.rows_from_matches(self.filtered()); render_rows_single_line( - list_area.inset(Insets::tlbr(0, 2, 0, 0)), + list_area.inset(Insets::tlbr( + /*top=*/ 0, /*left=*/ 2, /*bottom=*/ 0, /*right=*/ 0, + )), buf, &rows, &self.state, diff --git a/codex-rs/tui/src/bottom_pane/skills_toggle_view.rs b/codex-rs/tui/src/bottom_pane/skills_toggle_view.rs index 1e0230c904..881623a653 100644 --- a/codex-rs/tui/src/bottom_pane/skills_toggle_view.rs +++ b/codex-rs/tui/src/bottom_pane/skills_toggle_view.rs @@ -314,7 +314,7 @@ impl Renderable for SkillsToggleView { Constraint::Length(2), Constraint::Length(rows_height), ]) - .areas(content_area.inset(Insets::vh(1, 2))); + .areas(content_area.inset(Insets::vh(/*v=*/ 1, /*h=*/ 2))); self.header.render(header_area, buf); diff --git a/codex-rs/tui/src/bottom_pane/status_line_setup.rs b/codex-rs/tui/src/bottom_pane/status_line_setup.rs index 076ce50909..8297b3e5ca 100644 --- a/codex-rs/tui/src/bottom_pane/status_line_setup.rs +++ b/codex-rs/tui/src/bottom_pane/status_line_setup.rs @@ -205,7 +205,7 @@ impl StatusLineSetupView { if !used_ids.insert(item_id.clone()) { continue; } - items.push(Self::status_line_select_item(item, true)); + items.push(Self::status_line_select_item(item, /*enabled=*/ true)); } } @@ -214,7 +214,7 @@ impl StatusLineSetupView { if used_ids.contains(&item_id) { continue; } - items.push(Self::status_line_select_item(item, false)); + items.push(Self::status_line_select_item(item, /*enabled=*/ false)); } Self { diff --git a/codex-rs/tui/src/bottom_pane/textarea.rs b/codex-rs/tui/src/bottom_pane/textarea.rs index 81ff502837..a8ee163e5e 100644 --- a/codex-rs/tui/src/bottom_pane/textarea.rs +++ b/codex-rs/tui/src/bottom_pane/textarea.rs @@ -101,7 +101,7 @@ impl TextArea { /// as submit or slash-command dispatch clear the draft through this method and still want /// `Ctrl+Y` to recover the user's most recent kill. pub fn set_text_clearing_elements(&mut self, text: &str) { - self.set_text_inner(text, None); + self.set_text_inner(text, /*elements=*/ None); } /// Replace the visible textarea text and rebuild the provided text elements. @@ -160,7 +160,7 @@ impl TextArea { if pos <= self.cursor_pos { self.cursor_pos += text.len(); } - self.shift_elements(pos, 0, text.len()); + self.shift_elements(pos, /*removed=*/ 0, text.len()); self.preferred_col = None; } @@ -355,7 +355,7 @@ impl TextArea { code: KeyCode::Char('h'), modifiers: KeyModifiers::CONTROL, .. - } => self.delete_backward(1), + } => self.delete_backward(/*n=*/ 1), KeyEvent { code: KeyCode::Delete, modifiers: KeyModifiers::ALT, @@ -374,7 +374,7 @@ impl TextArea { code: KeyCode::Char('d'), modifiers: KeyModifiers::CONTROL, .. - } => self.delete_forward(1), + } => self.delete_forward(/*n=*/ 1), KeyEvent { code: KeyCode::Char('w'), @@ -507,27 +507,27 @@ impl TextArea { code: KeyCode::Home, .. } => { - self.move_cursor_to_beginning_of_line(false); + self.move_cursor_to_beginning_of_line(/*move_up_at_bol=*/ false); } KeyEvent { code: KeyCode::Char('a'), modifiers: KeyModifiers::CONTROL, .. } => { - self.move_cursor_to_beginning_of_line(true); + self.move_cursor_to_beginning_of_line(/*move_up_at_bol=*/ true); } KeyEvent { code: KeyCode::End, .. } => { - self.move_cursor_to_end_of_line(false); + self.move_cursor_to_end_of_line(/*move_down_at_eol=*/ false); } KeyEvent { code: KeyCode::Char('e'), modifiers: KeyModifiers::CONTROL, .. } => { - self.move_cursor_to_end_of_line(true); + self.move_cursor_to_end_of_line(/*move_down_at_eol=*/ true); } _o => { #[cfg(feature = "debug-logs")] @@ -999,7 +999,7 @@ impl TextArea { } fn add_element(&mut self, range: Range) -> u64 { - self.add_element_with_id(range, None) + self.add_element_with_id(range, /*name=*/ None) } /// Mark an existing text range as an atomic element without changing the text. @@ -1228,7 +1228,7 @@ impl TextArea { } start = idx; } - self.adjust_pos_out_of_elements(start, true) + self.adjust_pos_out_of_elements(start, /*prefer_start=*/ true) } pub(crate) fn end_of_next_word(&self) -> usize { @@ -1249,7 +1249,7 @@ impl TextArea { break; } } - self.adjust_pos_out_of_elements(end, false) + self.adjust_pos_out_of_elements(end, /*prefer_start=*/ false) } fn adjust_pos_out_of_elements(&self, pos: usize, prefer_start: bool) -> usize { diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs index a217ee3904..38fa773c04 100644 --- a/codex-rs/tui/src/chatwidget.rs +++ b/codex-rs/tui/src/chatwidget.rs @@ -1073,7 +1073,7 @@ impl ChatWidget { fn set_status_header(&mut self, header: String) { self.set_status( header, - None, + /*details=*/ None, StatusDetailsCapitalization::CapitalizeFirst, STATUS_DETAILS_DEFAULT_MAX_LINES, ); @@ -1130,7 +1130,7 @@ impl ChatWidget { let enabled = !items.is_empty(); self.bottom_pane.set_status_line_enabled(enabled); if !enabled { - self.set_status_line(None); + self.set_status_line(/*status_line=*/ None); return; } @@ -1235,7 +1235,7 @@ impl ChatWidget { fn on_session_configured(&mut self, event: codex_protocol::protocol::SessionConfiguredEvent) { self.bottom_pane .set_history_metadata(event.history_log_id, event.history_entry_count); - self.set_skills(None); + self.set_skills(/*skills=*/ None); self.session_network_proxy = event.network_proxy.clone(); self.thread_id = Some(event.session_id); self.thread_name = event.thread_name.clone(); @@ -1585,7 +1585,8 @@ impl ChatWidget { self.update_task_running_state(); self.retry_status_header = None; self.pending_status_indicator_restore = false; - self.bottom_pane.set_interrupt_hint_visible(true); + self.bottom_pane + .set_interrupt_hint_visible(/*visible=*/ true); self.set_status_header(String::from("Working")); self.full_reasoning_buffer.clear(); self.reasoning_buffer.clear(); @@ -1778,7 +1779,8 @@ impl ChatWidget { match info { Some(info) => self.apply_token_info(info), None => { - self.bottom_pane.set_context_window(None, None); + self.bottom_pane + .set_context_window(/*percent=*/ None, /*used_tokens=*/ None); self.token_info = None; } } @@ -1832,7 +1834,8 @@ impl ChatWidget { match saved { Some(info) => self.apply_token_info(info), None => { - self.bottom_pane.set_context_window(None, None); + self.bottom_pane + .set_context_window(/*percent=*/ None, /*used_tokens=*/ None); self.token_info = None; } } @@ -2059,7 +2062,7 @@ impl ChatWidget { if send_pending_steers_immediately { self.add_to_history(history_cell::new_info_event( "Model interrupted to submit steer instructions.".to_owned(), - None, + /*hint=*/ None, )); } else { self.add_to_history(history_cell::new_error_event( @@ -2323,12 +2326,13 @@ impl ChatWidget { // Surface this in the status indicator (single "waiting" surface) instead of // the transcript. Keep the header short so the interrupt hint remains visible. self.bottom_pane.ensure_status_indicator(); - self.bottom_pane.set_interrupt_hint_visible(true); + self.bottom_pane + .set_interrupt_hint_visible(/*visible=*/ true); self.set_status( "Waiting for background terminal".to_string(), command_display.clone(), StatusDetailsCapitalization::Preserve, - 1, + /*details_max_lines=*/ 1, ); match &mut self.unified_exec_wait_streak { Some(wait) if wait.process_id == ev.process_id => { @@ -2586,7 +2590,8 @@ impl ChatWidget { fn on_background_event(&mut self, message: String) { debug!("BackgroundEvent: {message}"); self.bottom_pane.ensure_status_indicator(); - self.bottom_pane.set_interrupt_hint_visible(true); + self.bottom_pane + .set_interrupt_hint_visible(/*visible=*/ true); self.set_status_header(message); } @@ -2599,7 +2604,7 @@ impl ChatWidget { message.push_str(": "); message.push_str(&status_message); } - self.add_to_history(history_cell::new_info_event(message, None)); + self.add_to_history(history_cell::new_info_event(message, /*hint=*/ None)); self.request_redraw(); } @@ -2623,7 +2628,8 @@ impl ChatWidget { fn on_undo_started(&mut self, event: UndoStartedEvent) { self.bottom_pane.ensure_status_indicator(); - self.bottom_pane.set_interrupt_hint_visible(false); + self.bottom_pane + .set_interrupt_hint_visible(/*visible=*/ false); let message = event .message .unwrap_or_else(|| "Undo in progress...".to_string()); @@ -2641,7 +2647,7 @@ impl ChatWidget { } }); if success { - self.add_info_message(message, None); + self.add_info_message(message, /*hint=*/ None); } else { self.add_error_message(message); } @@ -2781,7 +2787,7 @@ impl ChatWidget { .map(|current| self.worked_elapsed_from(current)); self.add_to_history(history_cell::FinalMessageSeparator::new( elapsed_seconds, - None, + /*runtime_metrics=*/ None, )); self.needs_final_message_separator = false; self.had_work_activity = false; @@ -3329,7 +3335,9 @@ impl ChatWidget { widget .bottom_pane .set_status_line_enabled(!widget.configured_status_line_items().is_empty()); - widget.bottom_pane.set_collaboration_modes_enabled(true); + widget + .bottom_pane + .set_collaboration_modes_enabled(/*enabled=*/ true); widget.sync_fast_command_enabled(); widget.sync_personality_command_enabled(); widget @@ -3514,7 +3522,9 @@ impl ChatWidget { widget .bottom_pane .set_status_line_enabled(!widget.configured_status_line_items().is_empty()); - widget.bottom_pane.set_collaboration_modes_enabled(true); + widget + .bottom_pane + .set_collaboration_modes_enabled(/*enabled=*/ true); widget.sync_fast_command_enabled(); widget.sync_personality_command_enabled(); widget @@ -3691,7 +3701,9 @@ impl ChatWidget { widget .bottom_pane .set_status_line_enabled(!widget.configured_status_line_items().is_empty()); - widget.bottom_pane.set_collaboration_modes_enabled(true); + widget + .bottom_pane + .set_collaboration_modes_enabled(/*enabled=*/ true); widget.sync_fast_command_enabled(); widget.sync_personality_command_enabled(); widget @@ -3992,7 +4004,7 @@ impl ChatWidget { let message = format!( "{DEFAULT_PROJECT_DOC_FILENAME} already exists here. Skipping /init to avoid overwriting it." ); - self.add_info_message(message, None); + self.add_info_message(message, /*hint=*/ None); return; } const INIT_PROMPT: &str = include_str!("../prompt_for_init_command.md"); @@ -4026,7 +4038,7 @@ impl ChatWidget { return; } if self.realtime_conversation.is_live() { - self.request_realtime_conversation_close(None); + self.request_realtime_conversation_close(/*info_message=*/ None); } else { self.start_realtime_conversation(); } @@ -4051,7 +4063,10 @@ impl ChatWidget { if let Some(mask) = collaboration_modes::plan_mask(self.models_manager.as_ref()) { self.set_collaboration_mask(mask); } else { - self.add_info_message("Plan mode unavailable right now.".to_string(), None); + self.add_info_message( + "Plan mode unavailable right now.".to_string(), + /*hint=*/ None, + ); } } SlashCommand::Collab => { @@ -4168,7 +4183,7 @@ impl ChatWidget { self.add_info_message( "`/copy` is unavailable before the first Codex output or right after a rollback." .to_string(), - None, + /*hint=*/ None, ); return; }; @@ -4231,10 +4246,13 @@ impl ChatWidget { if let Some(path) = self.rollout_path() { self.add_info_message( format!("Current rollout path: {}", path.display()), - None, + /*hint=*/ None, ); } else { - self.add_info_message("Rollout path is not available yet.".to_string(), None); + self.add_info_message( + "Rollout path is not available yet.".to_string(), + /*hint=*/ None, + ); } } SlashCommand::TestApproval => { @@ -4307,7 +4325,7 @@ impl ChatWidget { } match trimmed.to_ascii_lowercase().as_str() { "on" => self.set_service_tier_selection(Some(ServiceTier::Fast)), - "off" => self.set_service_tier_selection(None), + "off" => self.set_service_tier_selection(/*service_tier=*/ None), "status" => { let status = if matches!(self.config.service_tier, Some(ServiceTier::Fast)) { @@ -4315,7 +4333,10 @@ impl ChatWidget { } else { "off" }; - self.add_info_message(format!("Fast mode is {status}."), None); + self.add_info_message( + format!("Fast mode is {status}."), + /*hint=*/ None, + ); } _ => { self.add_error_message("Usage: /fast [on|off|status]".to_string()); @@ -4325,8 +4346,9 @@ impl ChatWidget { SlashCommand::Rename if !trimmed.is_empty() => { self.session_telemetry .counter("codex.thread.rename", 1, &[]); - let Some((prepared_args, _prepared_elements)) = - self.bottom_pane.prepare_inline_args_submission(false) + let Some((prepared_args, _prepared_elements)) = self + .bottom_pane + .prepare_inline_args_submission(/*record_history=*/ false) else { return; }; @@ -4346,8 +4368,9 @@ impl ChatWidget { if self.active_mode_kind() != ModeKind::Plan { return; } - let Some((prepared_args, prepared_elements)) = - self.bottom_pane.prepare_inline_args_submission(true) + let Some((prepared_args, prepared_elements)) = self + .bottom_pane + .prepare_inline_args_submission(/*record_history=*/ true) else { return; }; @@ -4372,8 +4395,9 @@ impl ChatWidget { } } SlashCommand::Review if !trimmed.is_empty() => { - let Some((prepared_args, _prepared_elements)) = - self.bottom_pane.prepare_inline_args_submission(false) + let Some((prepared_args, _prepared_elements)) = self + .bottom_pane + .prepare_inline_args_submission(/*record_history=*/ false) else { return; }; @@ -4388,8 +4412,9 @@ impl ChatWidget { self.bottom_pane.drain_pending_submission_state(); } SlashCommand::SandboxReadRoot if !trimmed.is_empty() => { - let Some((prepared_args, _prepared_elements)) = - self.bottom_pane.prepare_inline_args_submission(false) + let Some((prepared_args, _prepared_elements)) = self + .bottom_pane + .prepare_inline_args_submission(/*record_history=*/ false) else { return; }; @@ -4418,7 +4443,7 @@ impl ChatWidget { let view = CustomPromptView::new( title.to_string(), "Type a name and press Enter".to_string(), - None, + /*context_label=*/ None, Box::new(move |name: String| { let Some(name) = codex_core::util::normalize_thread_name(&name) else { tx.send(AppEvent::InsertHistoryCell(Box::new( @@ -4826,13 +4851,17 @@ impl ChatWidget { continue; } // `id: None` indicates a synthetic/fake id coming from replay. - self.dispatch_event_msg(None, msg, Some(ReplayKind::ResumeInitialMessages)); + self.dispatch_event_msg( + /*id=*/ None, + msg, + Some(ReplayKind::ResumeInitialMessages), + ); } } pub(crate) fn handle_codex_event(&mut self, event: Event) { let Event { id, msg } = event; - self.dispatch_event_msg(Some(id), msg, None); + self.dispatch_event_msg(Some(id), msg, /*replay_kind=*/ None); } pub(crate) fn handle_codex_event_replay(&mut self, event: Event) { @@ -4840,7 +4869,7 @@ impl ChatWidget { if matches!(msg, EventMsg::ShutdownComplete) { return; } - self.dispatch_event_msg(None, msg, Some(ReplayKind::ThreadSnapshot)); + self.dispatch_event_msg(/*id=*/ None, msg, Some(ReplayKind::ThreadSnapshot)); } /// Dispatch a protocol `EventMsg` to the appropriate handler. @@ -5144,7 +5173,7 @@ impl ChatWidget { } // Avoid toggling running state for replayed history events on resume. if !from_replay && !self.bottom_pane.is_task_running() { - self.bottom_pane.set_task_running(true); + self.bottom_pane.set_task_running(/*running=*/ true); } self.is_review_mode = true; let hint = review @@ -5174,11 +5203,11 @@ impl ChatWidget { let mut rendered: Vec> = vec!["".into()]; append_markdown( &explanation, - None, + /*width=*/ None, Some(self.config.cwd.as_path()), &mut rendered, ); - let body_cell = AgentMessageCell::new(rendered, false); + let body_cell = AgentMessageCell::new(rendered, /*is_first_line=*/ false); self.app_event_tx .send(AppEvent::InsertHistoryCell(Box::new(body_cell))); } @@ -5436,7 +5465,7 @@ impl ChatWidget { self.status_line_project_root().map(|root| { root.file_name() .map(|name| name.to_string_lossy().to_string()) - .unwrap_or_else(|| format_directory_display(&root, None)) + .unwrap_or_else(|| format_directory_display(&root, /*max_width=*/ None)) }) } @@ -5495,7 +5524,10 @@ impl ChatWidget { Some(format!("{} {label}{fast_label}", self.model_display_name())) } StatusLineItem::CurrentDir => { - Some(format_directory_display(self.status_line_cwd(), None)) + Some(format_directory_display( + self.status_line_cwd(), + /*max_width=*/ None, + )) } StatusLineItem::ProjectRoot => self.status_line_project_root_name(), StatusLineItem::GitBranch => self.status_line_branch.clone(), @@ -5630,7 +5662,10 @@ impl ChatWidget { fn clean_background_terminals(&mut self) { self.submit_op(Op::CleanBackgroundTerminals); - self.add_info_message("Stopping all background terminals.".to_string(), None); + self.add_info_message( + "Stopping all background terminals.".to_string(), + /*hint=*/ None, + ); } fn stop_rate_limit_poller(&mut self) { @@ -5644,7 +5679,7 @@ impl ChatWidget { } fn prefetch_connectors(&mut self) { - self.prefetch_connectors_with_options(false); + self.prefetch_connectors_with_options(/*force_refetch=*/ false); } fn prefetch_connectors_with_options(&mut self, force_refetch: bool) { @@ -5873,7 +5908,7 @@ impl ChatWidget { if !self.is_session_configured() { self.add_info_message( "Model selection is disabled until startup completes.".to_string(), - None, + /*hint=*/ None, ); return; } @@ -5883,7 +5918,7 @@ impl ChatWidget { Err(_) => { self.add_info_message( "Models are being updated; please try /model again in a moment.".to_string(), - None, + /*hint=*/ None, ); return; } @@ -5895,7 +5930,7 @@ impl ChatWidget { if !self.is_session_configured() { self.add_info_message( "Personality selection is disabled until startup completes.".to_string(), - None, + /*hint=*/ None, ); return; } @@ -6255,7 +6290,7 @@ impl ChatWidget { if presets.is_empty() { self.add_info_message( "No additional models are available right now.".to_string(), - None, + /*hint=*/ None, ); return; } @@ -6301,7 +6336,7 @@ impl ChatWidget { if presets.is_empty() { self.add_info_message( "No collaboration modes are available right now.".to_string(), - None, + /*hint=*/ None, ); return; } @@ -6851,7 +6886,10 @@ impl ChatWidget { tx.send(AppEvent::UpdateAskForApprovalPolicy(approval)); tx.send(AppEvent::UpdateSandboxPolicy(sandbox_clone)); tx.send(AppEvent::InsertHistoryCell(Box::new( - history_cell::new_info_event(format!("Permissions updated to {label}"), None), + history_cell::new_info_event( + format!("Permissions updated to {label}"), + /*hint=*/ None, + ), ))); })] } @@ -7802,7 +7840,7 @@ impl ChatWidget { message.push_str(" for "); message.push_str(next_mode.display_name()); message.push_str(" mode."); - self.add_info_message(message, None); + self.add_info_message(message, /*hint=*/ None); } self.request_redraw(); } @@ -7842,8 +7880,8 @@ impl ChatWidget { Box::new(history_cell::SessionHeaderHistoryCell::new_with_style( DEFAULT_MODEL_DISPLAY_NAME.to_string(), placeholder_style, - None, - false, + /*reasoning_effort=*/ None, + /*show_fast_status=*/ false, config.cwd.clone(), CODEX_CLI_VERSION, )) @@ -7934,7 +7972,7 @@ impl ChatWidget { match connectors_cache { ConnectorsCacheState::Ready(snapshot) => { if snapshot.connectors.is_empty() { - self.add_info_message("No apps available.".to_string(), None); + self.add_info_message("No apps available.".to_string(), /*hint=*/ None); } else { self.open_connectors_popup(&snapshot.connectors); } @@ -7960,8 +7998,9 @@ impl ChatWidget { } fn open_connectors_popup(&mut self, connectors: &[connectors::AppInfo]) { - self.bottom_pane - .show_selection_view(self.connectors_popup_params(connectors, None)); + self.bottom_pane.show_selection_view( + self.connectors_popup_params(connectors, /*selected_connector_id=*/ None), + ); } fn connectors_loading_popup_params(&self) -> SelectionViewParams { @@ -8056,7 +8095,10 @@ impl ChatWidget { let missing_label_for_action = missing_label.clone(); item.actions = vec![Box::new(move |tx| { tx.send(AppEvent::InsertHistoryCell(Box::new( - history_cell::new_info_event(missing_label_for_action.clone(), None), + history_cell::new_info_event( + missing_label_for_action.clone(), + /*hint=*/ None, + ), ))); })]; item.dismiss_on_select = true; @@ -8351,7 +8393,7 @@ impl ChatWidget { // Record outbound operation for session replay fidelity. crate::session_log::log_outbound_op(&op); if matches!(&op, Op::Review { .. }) && !self.bottom_pane.is_task_running() { - self.bottom_pane.set_task_running(true); + self.bottom_pane.set_task_running(/*running=*/ true); } if let Err(e) = self.codex_op_tx.send(op) { tracing::error!("failed to submit op: {e}"); @@ -8443,13 +8485,13 @@ impl ChatWidget { self.bottom_pane.set_connectors_snapshot(Some(snapshot)); } else { self.connectors_cache = ConnectorsCacheState::Failed(err); - self.bottom_pane.set_connectors_snapshot(None); + self.bottom_pane.set_connectors_snapshot(/*snapshot=*/ None); } } } if trigger_pending_force_refetch { - self.prefetch_connectors_with_options(true); + self.prefetch_connectors_with_options(/*force_refetch=*/ true); } } @@ -8478,7 +8520,7 @@ impl ChatWidget { fn refresh_plugin_mentions(&mut self) { if !self.config.features.enabled(Feature::Plugins) { - self.bottom_pane.set_plugin_mentions(None); + self.bottom_pane.set_plugin_mentions(/*plugins=*/ None); return; } @@ -8629,7 +8671,7 @@ impl ChatWidget { let view = CustomPromptView::new( "Custom review instructions".to_string(), "Type instructions and press Enter".to_string(), - None, + /*context_label=*/ None, Box::new(move |prompt: String| { let trimmed = prompt.trim().to_string(); if trimmed.is_empty() { @@ -8720,14 +8762,18 @@ impl ChatWidget { fn as_renderable(&self) -> RenderableItem<'_> { let active_cell_renderable = match &self.active_cell { - Some(cell) => RenderableItem::Borrowed(cell).inset(Insets::tlbr(1, 0, 0, 0)), + Some(cell) => RenderableItem::Borrowed(cell).inset(Insets::tlbr( + /*top=*/ 1, /*left=*/ 0, /*bottom=*/ 0, /*right=*/ 0, + )), None => RenderableItem::Owned(Box::new(())), }; let mut flex = FlexRenderable::new(); - flex.push(1, active_cell_renderable); + flex.push(/*flex=*/ 1, active_cell_renderable); flex.push( - 0, - RenderableItem::Borrowed(&self.bottom_pane).inset(Insets::tlbr(1, 0, 0, 0)), + /*flex=*/ 0, + RenderableItem::Borrowed(&self.bottom_pane).inset(Insets::tlbr( + /*top=*/ 1, /*left=*/ 0, /*bottom=*/ 0, /*right=*/ 0, + )), ); RenderableItem::Owned(Box::new(flex)) } @@ -8819,7 +8865,10 @@ impl Notification { .unwrap_or_else(|| "Agent turn complete".to_string()) } Notification::ExecApprovalRequested { command } => { - format!("Approval requested: {}", truncate_text(command, 30)) + format!( + "Approval requested: {}", + truncate_text(command, /*max_graphemes=*/ 30) + ) } Notification::EditApprovalRequested { cwd, changes } => { format!( @@ -8906,7 +8955,7 @@ impl Notification { if summary.is_empty() { None } else { - Some(truncate_text(summary, 30)) + Some(truncate_text(summary, /*max_graphemes=*/ 30)) } } } diff --git a/codex-rs/tui/src/chatwidget/realtime.rs b/codex-rs/tui/src/chatwidget/realtime.rs index 4e4f2f0e70..7ba9904377 100644 --- a/codex-rs/tui/src/chatwidget/realtime.rs +++ b/codex-rs/tui/src/chatwidget/realtime.rs @@ -183,7 +183,7 @@ impl ChatWidget { self.realtime_conversation.warned_audio_only_submission = true; self.add_info_message( "Realtime voice mode is audio-only. Use /realtime to stop.".to_string(), - None, + /*hint=*/ None, ); } else { self.request_redraw(); @@ -212,7 +212,7 @@ impl ChatWidget { pub(super) fn request_realtime_conversation_close(&mut self, info_message: Option) { if !self.realtime_conversation.is_live() { if let Some(message) = info_message { - self.add_info_message(message, None); + self.add_info_message(message, /*hint=*/ None); } return; } @@ -221,10 +221,10 @@ impl ChatWidget { self.realtime_conversation.phase = RealtimeConversationPhase::Stopping; self.submit_op(Op::RealtimeConversationClose); self.stop_realtime_local_audio(); - self.set_footer_hint_override(None); + self.set_footer_hint_override(/*items=*/ None); if let Some(message) = info_message { - self.add_info_message(message, None); + self.add_info_message(message, /*hint=*/ None); } else { self.request_redraw(); } @@ -232,7 +232,7 @@ impl ChatWidget { pub(super) fn reset_realtime_conversation_state(&mut self) { self.stop_realtime_local_audio(); - self.set_footer_hint_override(None); + self.set_footer_hint_override(/*items=*/ None); self.realtime_conversation.phase = RealtimeConversationPhase::Inactive; self.realtime_conversation.requested_close = false; self.realtime_conversation.session_id = None; @@ -282,7 +282,10 @@ impl ChatWidget { let reason = ev.reason; self.reset_realtime_conversation_state(); if !requested && let Some(reason) = reason { - self.add_info_message(format!("Realtime voice mode closed: {reason}"), None); + self.add_info_message( + format!("Realtime voice mode closed: {reason}"), + /*hint=*/ None, + ); } self.request_redraw(); } diff --git a/codex-rs/tui/src/chatwidget/skills.rs b/codex-rs/tui/src/chatwidget/skills.rs index a2a5e73e6c..b67d857bc6 100644 --- a/codex-rs/tui/src/chatwidget/skills.rs +++ b/codex-rs/tui/src/chatwidget/skills.rs @@ -61,7 +61,7 @@ impl ChatWidget { pub(crate) fn open_manage_skills_popup(&mut self) { if self.skills_all.is_empty() { - self.add_info_message("No skills available.".to_string(), None); + self.add_info_message("No skills available.".to_string(), /*hint=*/ None); return; } @@ -133,7 +133,7 @@ impl ChatWidget { } self.add_info_message( format!("{enabled_count} skills enabled, {disabled_count} skills disabled"), - None, + /*hint=*/ None, ); } diff --git a/codex-rs/tui/src/cwd_prompt.rs b/codex-rs/tui/src/cwd_prompt.rs index cb04aa0b4a..58dec8ba4c 100644 --- a/codex-rs/tui/src/cwd_prompt.rs +++ b/codex-rs/tui/src/cwd_prompt.rs @@ -212,20 +212,23 @@ impl WidgetRef for &CwdPromptScreen { "Session = latest cwd recorded in the {action_past} session" )) .dim() - .inset(Insets::tlbr(0, 2, 0, 0)), + .inset(Insets::tlbr( + /*top=*/ 0, /*left=*/ 2, /*bottom=*/ 0, /*right=*/ 0, + )), ); column.push( - Line::from("Current = your current working directory".dim()) - .inset(Insets::tlbr(0, 2, 0, 0)), + Line::from("Current = your current working directory".dim()).inset(Insets::tlbr( + /*top=*/ 0, /*left=*/ 2, /*bottom=*/ 0, /*right=*/ 0, + )), ); column.push(""); column.push(selection_option_row( - 0, + /*index=*/ 0, format!("Use session directory ({session_cwd})"), self.highlighted == CwdSelection::Session, )); column.push(selection_option_row( - 1, + /*index=*/ 1, format!("Use current directory ({current_cwd})"), self.highlighted == CwdSelection::Current, )); @@ -236,7 +239,9 @@ impl WidgetRef for &CwdPromptScreen { key_hint::plain(KeyCode::Enter).into(), " to continue".dim(), ]) - .inset(Insets::tlbr(0, 2, 0, 0)), + .inset(Insets::tlbr( + /*top=*/ 0, /*left=*/ 2, /*bottom=*/ 0, /*right=*/ 0, + )), ); column.render(area, buf); } diff --git a/codex-rs/tui/src/debug_config.rs b/codex-rs/tui/src/debug_config.rs index c9ec48a688..a01c4ef613 100644 --- a/codex-rs/tui/src/debug_config.rs +++ b/codex-rs/tui/src/debug_config.rs @@ -186,7 +186,7 @@ fn render_non_file_layer_details(layer: &ConfigLayerEntry) -> Vec> fn render_session_flag_details(config: &TomlValue) -> Vec> { let mut pairs = Vec::new(); - flatten_toml_key_values(config, None, &mut pairs); + flatten_toml_key_values(config, /*prefix=*/ None, &mut pairs); if pairs.is_empty() { return vec![" - ".dim().into()]; diff --git a/codex-rs/tui/src/diff_render.rs b/codex-rs/tui/src/diff_render.rs index 7d0ab018b8..193d6d1fbc 100644 --- a/codex-rs/tui/src/diff_render.rs +++ b/codex-rs/tui/src/diff_render.rs @@ -306,13 +306,13 @@ impl DiffSummary { impl Renderable for FileChange { fn render(&self, area: Rect, buf: &mut Buffer) { let mut lines = vec![]; - render_change(self, &mut lines, area.width as usize, None); + render_change(self, &mut lines, area.width as usize, /*lang=*/ None); Paragraph::new(lines).render(area, buf); } fn desired_height(&self, width: u16) -> u16 { let mut lines = vec![]; - render_change(self, &mut lines, width as usize, None); + render_change(self, &mut lines, width as usize, /*lang=*/ None); lines.len() as u16 } } @@ -332,7 +332,9 @@ impl From for Box { rows.push(Box::new(RtLine::from(""))); rows.push(Box::new(InsetRenderable::new( Box::new(row.change) as Box, - Insets::tlbr(0, 2, 0, 0), + Insets::tlbr( + /*top=*/ 0, /*left=*/ 2, /*bottom=*/ 0, /*right=*/ 0, + ), ))); } @@ -502,7 +504,7 @@ fn render_change( raw, width, line_number_width, - None, + /*syntax_spans=*/ None, style_context.theme, style_context.color_level, style_context.diff_backgrounds, @@ -534,7 +536,7 @@ fn render_change( raw, width, line_number_width, - None, + /*syntax_spans=*/ None, style_context.theme, style_context.color_level, style_context.diff_backgrounds, @@ -649,7 +651,7 @@ fn render_change( s, width, line_number_width, - None, + /*syntax_spans=*/ None, style_context.theme, style_context.color_level, style_context.diff_backgrounds, @@ -682,7 +684,7 @@ fn render_change( s, width, line_number_width, - None, + /*syntax_spans=*/ None, style_context.theme, style_context.color_level, style_context.diff_backgrounds, @@ -715,7 +717,7 @@ fn render_change( s, width, line_number_width, - None, + /*syntax_spans=*/ None, style_context.theme, style_context.color_level, style_context.diff_backgrounds, @@ -796,7 +798,7 @@ pub(crate) fn push_wrapped_diff_line_with_style_context( text, width, line_number_width, - None, + /*syntax_spans=*/ None, style_context.theme, style_context.color_level, style_context.diff_backgrounds, diff --git a/codex-rs/tui/src/exec_cell/render.rs b/codex-rs/tui/src/exec_cell/render.rs index 14f48529dc..dd88861570 100644 --- a/codex-rs/tui/src/exec_cell/render.rs +++ b/codex-rs/tui/src/exec_cell/render.rs @@ -681,9 +681,9 @@ impl ExecDisplayLayout { const EXEC_DISPLAY_LAYOUT: ExecDisplayLayout = ExecDisplayLayout::new( PrefixedBlock::new(" │ ", " │ "), - 2, + /*command_continuation_max_lines=*/ 2, PrefixedBlock::new(" └ ", " "), - 5, + /*output_max_lines=*/ 5, ); #[cfg(test)] diff --git a/codex-rs/tui/src/history_cell.rs b/codex-rs/tui/src/history_cell.rs index 3ae4213b80..16900daec6 100644 --- a/codex-rs/tui/src/history_cell.rs +++ b/codex-rs/tui/src/history_cell.rs @@ -782,7 +782,7 @@ fn truncate_exec_snippet(full_cmd: &str) -> String { Some((first, _)) => format!("{first} ..."), None => full_cmd.to_string(), }; - snippet = truncate_text(&snippet, 80); + snippet = truncate_text(&snippet, /*max_graphemes=*/ 80); snippet } @@ -936,7 +936,7 @@ pub(crate) fn card_inner_width(width: u16, max_inner_width: usize) -> Option>) -> Vec> { - with_border_internal(lines, None) + with_border_internal(lines, /*forced_inner_width=*/ None) } /// Render `lines` inside a border whose inner width is at least `inner_width`. @@ -1593,7 +1593,7 @@ pub(crate) fn new_active_web_search_call( query: String, animations_enabled: bool, ) -> WebSearchCell { - WebSearchCell::new(call_id, query, None, animations_enabled) + WebSearchCell::new(call_id, query, /*action=*/ None, animations_enabled) } pub(crate) fn new_web_search_call( @@ -1601,7 +1601,12 @@ pub(crate) fn new_web_search_call( query: String, action: WebSearchAction, ) -> WebSearchCell { - let mut cell = WebSearchCell::new(call_id, query, Some(action), false); + let mut cell = WebSearchCell::new( + call_id, + query, + Some(action), + /*animations_enabled=*/ false, + ); cell.complete(); cell } @@ -2278,7 +2283,7 @@ pub(crate) fn new_reasoning_summary_block( header_buffer, summary_buffer, &cwd, - false, + /*transcript_only=*/ false, )); } } @@ -2287,7 +2292,7 @@ pub(crate) fn new_reasoning_summary_block( "".to_string(), full_reasoning_buffer.to_string(), &cwd, - true, + /*transcript_only=*/ true, )) } diff --git a/codex-rs/tui/src/lib.rs b/codex-rs/tui/src/lib.rs index 43230eb2d4..f263d668fd 100644 --- a/codex-rs/tui/src/lib.rs +++ b/codex-rs/tui/src/lib.rs @@ -783,7 +783,12 @@ async fn run_ratatui_app( { Ok(page) => match page.items.first() { Some(item) => { - match resolve_session_thread_id(item.path.as_path(), None).await { + match resolve_session_thread_id( + item.path.as_path(), + /*id_str_if_uuid=*/ None, + ) + .await + { Some(thread_id) => resume_picker::SessionSelection::Fork( resume_picker::SessionTarget { path: item.path.clone(), @@ -876,30 +881,34 @@ async fn run_ratatui_app( ) .await { - Ok(Some(path)) => match resolve_session_thread_id(path.as_path(), None).await { - Some(thread_id) => { - resume_picker::SessionSelection::Resume(resume_picker::SessionTarget { - path, - thread_id, - }) + Ok(Some(path)) => { + match resolve_session_thread_id(path.as_path(), /*id_str_if_uuid=*/ None).await { + Some(thread_id) => { + resume_picker::SessionSelection::Resume(resume_picker::SessionTarget { + path, + thread_id, + }) + } + None => { + let rollout_path = path.display(); + error!( + "Error reading session metadata from latest rollout: {rollout_path}" + ); + restore(); + session_log::log_session_end(); + let _ = tui.terminal.clear(); + return Ok(AppExitInfo { + token_usage: codex_protocol::protocol::TokenUsage::default(), + thread_id: None, + thread_name: None, + update_action: None, + exit_reason: ExitReason::Fatal(format!( + "Found latest saved session at {rollout_path}, but failed to read its metadata. Run `codex resume` to choose from existing sessions." + )), + }); + } } - None => { - let rollout_path = path.display(); - error!("Error reading session metadata from latest rollout: {rollout_path}"); - restore(); - session_log::log_session_end(); - let _ = tui.terminal.clear(); - return Ok(AppExitInfo { - token_usage: codex_protocol::protocol::TokenUsage::default(), - thread_id: None, - thread_name: None, - update_action: None, - exit_reason: ExitReason::Fatal(format!( - "Found latest saved session at {rollout_path}, but failed to read its metadata. Run `codex resume` to choose from existing sessions." - )), - }); - } - }, + } _ => resume_picker::SessionSelection::StartFresh, } } else if cli.resume_picker { @@ -1220,8 +1229,13 @@ async fn load_config_or_exit( overrides: ConfigOverrides, cloud_requirements: CloudRequirementsLoader, ) -> Config { - load_config_or_exit_with_fallback_cwd(cli_kv_overrides, overrides, cloud_requirements, None) - .await + load_config_or_exit_with_fallback_cwd( + cli_kv_overrides, + overrides, + cloud_requirements, + /*fallback_cwd=*/ None, + ) + .await } async fn load_config_or_exit_with_fallback_cwd( diff --git a/codex-rs/tui/src/live_wrap.rs b/codex-rs/tui/src/live_wrap.rs index e78710dc6c..7d8bfb88f5 100644 --- a/codex-rs/tui/src/live_wrap.rs +++ b/codex-rs/tui/src/live_wrap.rs @@ -66,7 +66,7 @@ impl RowBuilder { if start < i { self.current_line.push_str(&fragment[start..i]); } - self.flush_current_line(true); + self.flush_current_line(/*explicit_break=*/ true); start = i + ch.len_utf8(); } } @@ -78,7 +78,7 @@ impl RowBuilder { /// Mark the end of the current logical line (equivalent to pushing a '\n'). pub fn end_line(&mut self) { - self.flush_current_line(true); + self.flush_current_line(/*explicit_break=*/ true); } /// Drain and return all produced rows. diff --git a/codex-rs/tui/src/markdown_render.rs b/codex-rs/tui/src/markdown_render.rs index 1b09b84c37..618524bbba 100644 --- a/codex-rs/tui/src/markdown_render.rs +++ b/codex-rs/tui/src/markdown_render.rs @@ -87,7 +87,7 @@ impl IndentContext { } pub fn render_markdown_text(input: &str) -> Text<'static> { - render_markdown_text_with_width(input, None) + render_markdown_text_with_width(input, /*width=*/ None) } /// Render markdown using the current process working directory for local file-link display. @@ -227,8 +227,8 @@ where self.push_line(Line::from("———")); self.needs_newline = true; } - Event::Html(html) => self.html(html, false), - Event::InlineHtml(html) => self.html(html, true), + Event::Html(html) => self.html(html, /*inline=*/ false), + Event::InlineHtml(html) => self.html(html, /*inline=*/ true), Event::FootnoteReference(_) => {} Event::TaskListMarker(_) => {} } @@ -352,8 +352,11 @@ where self.push_blank_line(); self.needs_newline = false; } - self.indent_stack - .push(IndentContext::new(vec![Span::from("> ")], None, false)); + self.indent_stack.push(IndentContext::new( + vec![Span::from("> ")], + /*marker=*/ None, + /*is_list=*/ false, + )); } fn end_blockquote(&mut self) { @@ -512,8 +515,11 @@ where let indent_len = if is_ordered { width + 2 } else { width + 1 }; vec![Span::from(" ".repeat(indent_len))] }; - self.indent_stack - .push(IndentContext::new(indent_prefix, marker, true)); + self.indent_stack.push(IndentContext::new( + indent_prefix, + marker, + /*is_list=*/ true, + )); self.needs_newline = false; } @@ -538,8 +544,8 @@ where self.indent_stack.push(IndentContext::new( vec![indent.unwrap_or_default()], - None, - false, + /*marker=*/ None, + /*is_list=*/ false, )); self.needs_newline = true; } @@ -659,7 +665,7 @@ where let was_pending = self.pending_marker_line; self.current_initial_indent = self.prefix_spans(was_pending); - self.current_subsequent_indent = self.prefix_spans(false); + self.current_subsequent_indent = self.prefix_spans(/*pending_marker_line=*/ false); self.current_line_style = style; self.current_line_content = Some(line); self.current_line_in_code_block = self.in_code_block; diff --git a/codex-rs/tui/src/model_migration.rs b/codex-rs/tui/src/model_migration.rs index 9c28cc1ea1..3d0b1bd21f 100644 --- a/codex-rs/tui/src/model_migration.rs +++ b/codex-rs/tui/src/model_migration.rs @@ -307,7 +307,9 @@ impl ModelMigrationScreen { column.push( Paragraph::new(line.clone()) .wrap(Wrap { trim: false }) - .inset(Insets::tlbr(0, 2, 0, 0)), + .inset(Insets::tlbr( + /*top=*/ 0, /*left=*/ 2, /*bottom=*/ 0, /*right=*/ 0, + )), ); } } @@ -326,7 +328,12 @@ impl ModelMigrationScreen { column.push( Paragraph::new(line) .wrap(Wrap { trim: false }) - .inset(Insets::tlbr(0, horizontal_inset, 0, 0)), + .inset(Insets::tlbr( + /*top=*/ 0, + horizontal_inset, + /*bottom=*/ 0, + /*right=*/ 0, + )), ); } } @@ -336,7 +343,9 @@ impl ModelMigrationScreen { column.push( Paragraph::new("Choose how you'd like Codex to proceed.") .wrap(Wrap { trim: false }) - .inset(Insets::tlbr(0, 2, 0, 0)), + .inset(Insets::tlbr( + /*top=*/ 0, /*left=*/ 2, /*bottom=*/ 0, /*right=*/ 0, + )), ); column.push(Line::from("")); @@ -359,7 +368,9 @@ impl ModelMigrationScreen { key_hint::plain(KeyCode::Enter).into(), " to confirm".dim(), ]) - .inset(Insets::tlbr(0, 2, 0, 0)), + .inset(Insets::tlbr( + /*top=*/ 0, /*left=*/ 2, /*bottom=*/ 0, /*right=*/ 0, + )), ); } } diff --git a/codex-rs/tui/src/multi_agents.rs b/codex-rs/tui/src/multi_agents.rs index 00a1c0429c..55adbab77e 100644 --- a/codex-rs/tui/src/multi_agents.rs +++ b/codex-rs/tui/src/multi_agents.rs @@ -224,7 +224,7 @@ pub(crate) fn interaction_end(ev: CollabAgentInteractionEndEvent) -> PlainHistor nickname: receiver_agent_nickname.as_deref(), role: receiver_agent_role.as_deref(), }, - None, + /*spawn_request=*/ None, ); let mut details = Vec::new(); @@ -244,7 +244,11 @@ pub(crate) fn waiting_begin(ev: CollabWaitingBeginEvent) -> PlainHistoryCell { let receiver_agents = merge_wait_receivers(&receiver_thread_ids, receiver_agents); let title = match receiver_agents.as_slice() { - [receiver] => title_with_agent("Waiting for", agent_label_from_ref(receiver), None), + [receiver] => title_with_agent( + "Waiting for", + agent_label_from_ref(receiver), + /*spawn_request=*/ None, + ), [] => title_text("Waiting for agents"), _ => title_text(format!("Waiting for {} agents", receiver_agents.len())), }; @@ -290,7 +294,7 @@ pub(crate) fn close_end(ev: CollabCloseEndEvent) -> PlainHistoryCell { nickname: receiver_agent_nickname.as_deref(), role: receiver_agent_role.as_deref(), }, - None, + /*spawn_request=*/ None, ), Vec::new(), ) @@ -313,7 +317,7 @@ pub(crate) fn resume_begin(ev: CollabResumeBeginEvent) -> PlainHistoryCell { nickname: receiver_agent_nickname.as_deref(), role: receiver_agent_role.as_deref(), }, - None, + /*spawn_request=*/ None, ), Vec::new(), ) @@ -337,7 +341,7 @@ pub(crate) fn resume_end(ev: CollabResumeEndEvent) -> PlainHistoryCell { nickname: receiver_agent_nickname.as_deref(), role: receiver_agent_role.as_deref(), }, - None, + /*spawn_request=*/ None, ), vec![status_summary_line(&status)], ) diff --git a/codex-rs/tui/src/onboarding/auth.rs b/codex-rs/tui/src/onboarding/auth.rs index fdc2b6bdad..e2f524324b 100644 --- a/codex-rs/tui/src/onboarding/auth.rs +++ b/codex-rs/tui/src/onboarding/auth.rs @@ -137,19 +137,19 @@ impl KeyboardHandler for AuthModeWidget { match key_event.code { KeyCode::Up | KeyCode::Char('k') => { - self.move_highlight(-1); + self.move_highlight(/*delta=*/ -1); } KeyCode::Down | KeyCode::Char('j') => { - self.move_highlight(1); + self.move_highlight(/*delta=*/ 1); } KeyCode::Char('1') => { - self.select_option_by_index(0); + self.select_option_by_index(/*index=*/ 0); } KeyCode::Char('2') => { - self.select_option_by_index(1); + self.select_option_by_index(/*index=*/ 1); } KeyCode::Char('3') => { - self.select_option_by_index(2); + self.select_option_by_index(/*index=*/ 2); } KeyCode::Enter => { let sign_in_state = { (*self.sign_in_state.read().unwrap()).clone() }; diff --git a/codex-rs/tui/src/onboarding/trust_directory.rs b/codex-rs/tui/src/onboarding/trust_directory.rs index 87cdac5236..2c87cf78fe 100644 --- a/codex-rs/tui/src/onboarding/trust_directory.rs +++ b/codex-rs/tui/src/onboarding/trust_directory.rs @@ -56,7 +56,7 @@ impl WidgetRef for &TrustDirectoryWidget { "Do you trust the contents of this directory? Working with untrusted contents comes with higher risk of prompt injection.".to_string(), ) .wrap(Wrap { trim: true }) - .inset(Insets::tlbr(0, 2, 0, 0)), + .inset(Insets::tlbr(/*top=*/ 0, /*left=*/ 2, /*bottom=*/ 0, /*right=*/ 0)), ); column.push(""); @@ -80,7 +80,9 @@ impl WidgetRef for &TrustDirectoryWidget { Paragraph::new(error.to_string()) .red() .wrap(Wrap { trim: true }) - .inset(Insets::tlbr(0, 2, 0, 0)), + .inset(Insets::tlbr( + /*top=*/ 0, /*left=*/ 2, /*bottom=*/ 0, /*right=*/ 0, + )), ); column.push(""); } @@ -95,7 +97,9 @@ impl WidgetRef for &TrustDirectoryWidget { " to continue".dim() }, ]) - .inset(Insets::tlbr(0, 2, 0, 0)), + .inset(Insets::tlbr( + /*top=*/ 0, /*left=*/ 2, /*bottom=*/ 0, /*right=*/ 0, + )), ); column.render(area, buf); diff --git a/codex-rs/tui/src/pager_overlay.rs b/codex-rs/tui/src/pager_overlay.rs index a6d415da18..38e3c1edfc 100644 --- a/codex-rs/tui/src/pager_overlay.rs +++ b/codex-rs/tui/src/pager_overlay.rs @@ -457,7 +457,7 @@ impl TranscriptOverlay { pub(crate) fn new(transcript_cells: Vec>) -> Self { Self { view: PagerView::new( - Self::render_cells(&transcript_cells, None), + Self::render_cells(&transcript_cells, /*highlight_cell=*/ None), "T R A N S C R I P T".to_string(), usize::MAX, ), @@ -495,7 +495,10 @@ impl TranscriptOverlay { if !c.is_stream_continuation() && i > 0 { cell_renderable = Box::new(InsetRenderable::new( cell_renderable, - Insets::tlbr(1, 0, 0, 0), + Insets::tlbr( + /*top=*/ 1, /*left=*/ 0, /*bottom=*/ 0, + /*right=*/ 0, + ), )); } v.push(cell_renderable); @@ -528,8 +531,12 @@ impl TranscriptOverlay { { // The tail was rendered as the only entry, so it lacks a top // inset; add one now that it follows a committed cell. - Box::new(InsetRenderable::new(tail, Insets::tlbr(1, 0, 0, 0))) - as Box + Box::new(InsetRenderable::new( + tail, + Insets::tlbr( + /*top=*/ 1, /*left=*/ 0, /*bottom=*/ 0, /*right=*/ 0, + ), + )) as Box } else { tail }; @@ -649,7 +656,12 @@ impl TranscriptOverlay { let paragraph = Paragraph::new(Text::from(lines)).wrap(Wrap { trim: false }); let mut renderable: Box = Box::new(CachedRenderable::new(paragraph)); if has_prior_cells && !is_stream_continuation { - renderable = Box::new(InsetRenderable::new(renderable, Insets::tlbr(1, 0, 0, 0))); + renderable = Box::new(InsetRenderable::new( + renderable, + Insets::tlbr( + /*top=*/ 1, /*left=*/ 0, /*bottom=*/ 0, /*right=*/ 0, + ), + )); } renderable } @@ -721,7 +733,7 @@ impl StaticOverlay { pub(crate) fn with_renderables(renderables: Vec>, title: String) -> Self { Self { - view: PagerView::new(renderables, title, 0), + view: PagerView::new(renderables, title, /*scroll_offset=*/ 0), is_done: false, } } diff --git a/codex-rs/tui/src/public_widgets/composer_input.rs b/codex-rs/tui/src/public_widgets/composer_input.rs index 46a7e72bcf..f4d1867455 100644 --- a/codex-rs/tui/src/public_widgets/composer_input.rs +++ b/codex-rs/tui/src/public_widgets/composer_input.rs @@ -37,7 +37,13 @@ impl ComposerInput { let (tx, rx) = tokio::sync::mpsc::unbounded_channel(); let sender = AppEventSender::new(tx.clone()); // `enhanced_keys_supported=true` enables Shift+Enter newline hint/behavior. - let inner = ChatComposer::new(true, sender, true, "Compose new task".to_string(), false); + let inner = ChatComposer::new( + /*has_input_focus=*/ true, + sender, + /*enhanced_keys_supported=*/ true, + "Compose new task".to_string(), + /*disable_paste_burst=*/ false, + ); Self { inner, _tx: tx, rx } } @@ -80,7 +86,7 @@ impl ComposerInput { /// Clear any previously set custom hint items and restore the default hints. pub fn clear_hint_items(&mut self) { - self.inner.set_footer_hint_override(None); + self.inner.set_footer_hint_override(/*items=*/ None); } /// Desired height (in rows) for a given width. diff --git a/codex-rs/tui/src/resume_picker.rs b/codex-rs/tui/src/resume_picker.rs index 793e0b947d..8d4fac4d11 100644 --- a/codex-rs/tui/src/resume_picker.rs +++ b/codex-rs/tui/src/resume_picker.rs @@ -416,7 +416,13 @@ impl PickerState { let path = row.path.clone(); let thread_id = match row.thread_id { Some(thread_id) => Some(thread_id), - None => crate::resolve_session_thread_id(path.as_path(), None).await, + None => { + crate::resolve_session_thread_id( + path.as_path(), + /*id_str_if_uuid=*/ None, + ) + .await + } }; if let Some(thread_id) = thread_id { return Ok(Some(self.action.selection(path, thread_id))); @@ -1255,14 +1261,14 @@ fn calculate_column_metrics(rows: &[Row], include_cwd: bool) -> ColumnMetrics { let created = format_created_label(row); let updated = format_updated_label(row); let branch_raw = row.git_branch.clone().unwrap_or_default(); - let branch = right_elide(&branch_raw, 24); + let branch = right_elide(&branch_raw, /*max=*/ 24); let cwd = if include_cwd { let cwd_raw = row .cwd .as_ref() .map(|p| display_path_for(p, std::path::Path::new("/"))) .unwrap_or_default(); - right_elide(&cwd_raw, 24) + right_elide(&cwd_raw, /*max=*/ 24) } else { String::new() }; diff --git a/codex-rs/tui/src/selection_list.rs b/codex-rs/tui/src/selection_list.rs index 25a6450feb..c842350a7a 100644 --- a/codex-rs/tui/src/selection_list.rs +++ b/codex-rs/tui/src/selection_list.rs @@ -12,7 +12,7 @@ pub(crate) fn selection_option_row( label: String, is_selected: bool, ) -> Box { - selection_option_row_with_dim(index, label, is_selected, false) + selection_option_row_with_dim(index, label, is_selected, /*dim=*/ false) } pub(crate) fn selection_option_row_with_dim( diff --git a/codex-rs/tui/src/status_indicator_widget.rs b/codex-rs/tui/src/status_indicator_widget.rs index cb4f9c5ab4..753caaca9a 100644 --- a/codex-rs/tui/src/status_indicator_widget.rs +++ b/codex-rs/tui/src/status_indicator_widget.rs @@ -209,7 +209,7 @@ impl StatusIndicatorWidget { let opts = RtOptions::new(usize::from(width)) .initial_indent(Line::from(DETAILS_PREFIX.dim())) .subsequent_indent(Line::from(Span::from(" ".repeat(prefix_width)).dim())) - .break_words(true); + .break_words(/*break_words=*/ true); let mut out = word_wrap_lines(details.lines().map(|line| vec![line.dim()]), opts); diff --git a/codex-rs/tui/src/streaming/controller.rs b/codex-rs/tui/src/streaming/controller.rs index 7f7346265e..c2fc51b352 100644 --- a/codex-rs/tui/src/streaming/controller.rs +++ b/codex-rs/tui/src/streaming/controller.rs @@ -167,13 +167,16 @@ impl PlanStreamController { } self.state.clear(); - self.emit(out_lines, true) + self.emit(out_lines, /*include_bottom_padding=*/ true) } /// Step animation: commit at most one queued line and handle end-of-drain cleanup. pub(crate) fn on_commit_tick(&mut self) -> (Option>, bool) { let step = self.state.step(); - (self.emit(step, false), self.state.is_idle()) + ( + self.emit(step, /*include_bottom_padding=*/ false), + self.state.is_idle(), + ) } /// Step animation: commit at most `max_lines` queued lines. @@ -185,7 +188,10 @@ impl PlanStreamController { max_lines: usize, ) -> (Option>, bool) { let step = self.state.drain_n(max_lines.max(1)); - (self.emit(step, false), self.state.is_idle()) + ( + self.emit(step, /*include_bottom_padding=*/ false), + self.state.is_idle(), + ) } /// Returns the current number of queued plan lines waiting to be displayed. diff --git a/codex-rs/tui/src/theme_picker.rs b/codex-rs/tui/src/theme_picker.rs index 65c31c4696..fd87b5c824 100644 --- a/codex-rs/tui/src/theme_picker.rs +++ b/codex-rs/tui/src/theme_picker.rs @@ -242,7 +242,13 @@ impl Renderable for ThemePreviewWideRenderable { } fn render(&self, area: Rect, buf: &mut Buffer) { - render_preview(area, buf, &WIDE_PREVIEW_ROWS, true, WIDE_PREVIEW_LEFT_INSET); + render_preview( + area, + buf, + &WIDE_PREVIEW_ROWS, + /*center_vertically=*/ true, + WIDE_PREVIEW_LEFT_INSET, + ); } } @@ -252,7 +258,13 @@ impl Renderable for ThemePreviewNarrowRenderable { } fn render(&self, area: Rect, buf: &mut Buffer) { - render_preview(area, buf, &NARROW_PREVIEW_ROWS, false, 0); + render_preview( + area, + buf, + &NARROW_PREVIEW_ROWS, + /*center_vertically=*/ false, + /*left_inset=*/ 0, + ); } } @@ -274,7 +286,7 @@ fn theme_picker_subtitle(codex_home: Option<&Path>, terminal_width: Option) let themes_dir = codex_home.map(|home| home.join("themes")); let themes_dir_display = themes_dir .as_deref() - .map(|path| format_directory_display(path, None)); + .map(|path| format_directory_display(path, /*max_width=*/ None)); let available_width = subtitle_available_width(terminal_width); if let Some(path) = themes_dir_display diff --git a/codex-rs/tui/src/wrapping.rs b/codex-rs/tui/src/wrapping.rs index 960b8fed54..bb2c64dd8c 100644 --- a/codex-rs/tui/src/wrapping.rs +++ b/codex-rs/tui/src/wrapping.rs @@ -464,7 +464,7 @@ fn is_domain_label(label: &str) -> bool { pub(crate) fn url_preserving_wrap_options<'a>(opts: RtOptions<'a>) -> RtOptions<'a> { opts.word_separator(textwrap::WordSeparator::AsciiSpace) .word_splitter(textwrap::WordSplitter::Custom(split_non_url_word)) - .break_words(false) + .break_words(/*break_words=*/ false) } /// Custom `textwrap::WordSplitter` callback. Returns empty (no split diff --git a/codex-rs/utils/git/src/branch.rs b/codex-rs/utils/git/src/branch.rs index f65de0c6bf..19f770473e 100644 --- a/codex-rs/utils/git/src/branch.rs +++ b/codex-rs/utils/git/src/branch.rs @@ -41,7 +41,7 @@ pub fn merge_base_with_head( OsString::from(head), OsString::from(preferred_ref), ], - None, + /*env=*/ None, )?; Ok(Some(merge_base)) @@ -55,7 +55,7 @@ fn resolve_branch_ref(repo_root: &Path, branch: &str) -> Result, OsString::from("--verify"), OsString::from(branch), ], - None, + /*env=*/ None, ); match rev { @@ -77,7 +77,7 @@ fn resolve_upstream_if_remote_ahead( OsString::from("--symbolic-full-name"), OsString::from(format!("{branch}@{{upstream}}")), ], - None, + /*env=*/ None, ) { Ok(name) => { let trimmed = name.trim(); @@ -98,7 +98,7 @@ fn resolve_upstream_if_remote_ahead( OsString::from("--count"), OsString::from(format!("{branch}...{upstream}")), ], - None, + /*env=*/ None, ) { Ok(counts) => counts, Err(GitToolingError::GitCommand { .. }) => return Ok(None), diff --git a/codex-rs/utils/git/src/ghost_commits.rs b/codex-rs/utils/git/src/ghost_commits.rs index e56cefa529..481ba84ff0 100644 --- a/codex-rs/utils/git/src/ghost_commits.rs +++ b/codex-rs/utils/git/src/ghost_commits.rs @@ -489,7 +489,7 @@ fn restore_to_commit_inner( restore_args.push(OsString::from(".")); } - run_git_for_status(repo_root, restore_args, None)?; + run_git_for_status(repo_root, restore_args, /*env=*/ None)?; Ok(()) } @@ -532,7 +532,7 @@ fn capture_status_snapshot( args.push(prefix.as_os_str().to_os_string()); } - let output = run_git_for_stdout_all(repo_root, args, None)?; + let output = run_git_for_stdout_all(repo_root, args, /*env=*/ None)?; if output.is_empty() { return Ok(StatusSnapshot::default()); } @@ -599,20 +599,26 @@ fn capture_status_snapshot( } } b'1' => { - if let Some(path) = extract_status_path_after_fields(entry, 8) { + if let Some(path) = + extract_status_path_after_fields(entry, /*fields_before_path=*/ 8) + { let normalized = normalize_relative_path(Path::new(path))?; snapshot.tracked_paths.push(normalized); } } b'2' => { - if let Some(path) = extract_status_path_after_fields(entry, 9) { + if let Some(path) = + extract_status_path_after_fields(entry, /*fields_before_path=*/ 9) + { let normalized = normalize_relative_path(Path::new(path))?; snapshot.tracked_paths.push(normalized); } expect_rename_source = true; } b'u' => { - if let Some(path) = extract_status_path_after_fields(entry, 10) { + if let Some(path) = + extract_status_path_after_fields(entry, /*fields_before_path=*/ 10) + { let normalized = normalize_relative_path(Path::new(path))?; snapshot.tracked_paths.push(normalized); } diff --git a/codex-rs/utils/git/src/operations.rs b/codex-rs/utils/git/src/operations.rs index 415d63d568..50ea9f8da2 100644 --- a/codex-rs/utils/git/src/operations.rs +++ b/codex-rs/utils/git/src/operations.rs @@ -14,7 +14,7 @@ pub(crate) fn ensure_git_repository(path: &Path) -> Result<(), GitToolingError> OsString::from("rev-parse"), OsString::from("--is-inside-work-tree"), ], - None, + /*env=*/ None, ) { Ok(output) if output.trim() == "true" => Ok(()), Ok(_) => Err(GitToolingError::NotAGitRepository { @@ -37,7 +37,7 @@ pub(crate) fn resolve_head(path: &Path) -> Result, GitToolingErro OsString::from("--verify"), OsString::from("HEAD"), ], - None, + /*env=*/ None, ) { Ok(sha) => Ok(Some(sha)), Err(GitToolingError::GitCommand { status, .. }) if status.code() == Some(128) => Ok(None), @@ -84,7 +84,7 @@ pub(crate) fn resolve_repository_root(path: &Path) -> Result