Public report of openai/codex, published 26 October 2026. It has the same score, grades and number of findings as the full report. The details of security findings (where they are in the code, which known vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive report Measured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.10.5). Watchdog signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey → Signed and filed in the standard's public register, 26 October 2026, 21:34 UTC · Survey ID cd_f84696fc57194eedb1215c82932c3c29

openai/codex

Measured 26 October 2026, 21:14 UTC, at code version eb3572f

No regression since the last survey

A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.

CAI score 56out of 100 At risk Down 2 since the last survey

The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.

A very large codebase: 1,104,646 lines of product code in 183 projects, tests not counted · Estimated rebuild effort: about 19.4 person-years · Weakest lens: Security and Compliance, 47

Findings by how serious they are

62 critical 4388 serious 241 minor

11 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.

This survey was produced by

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
26 October 2026, 21:14 UTC

A measurement, not a certificate. The Code Assurance Index records a number together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee the code. The standard was written by Canine Development, which also builds Watchdog. It is open to any tool that implements it, and today Watchdog is the only one that does.

A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.

The score is deterministic, which means the same code always gets the same score. Watchdog works it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸

90of 90 dimensions measured by tools.
4504of 4691 findings point to an exact file and line, so you can open each one in the code. The other 187 concern the repository as a whole, such as missing documentation.
90dimensions across 9 lenses, read from 1,104,646 lines of product code in 183 projects.
Chapters

Executive summary

openai/codex is rated At risk because critical security findings are open. Its score is held back in part because two of the dependencies have a known vulnerability. It scores 56 out of 100, which the At risk rating leaves unchanged.

Security and Compliance, at 47, is the weakest lens and counts most in the score. The best first step is moving the keys out of the code, worth about 7 points. Fixing the 18 secrets exposed to more of the pipeline than needed is another step, worth about 3 points. Raising Security and Compliance to 70 would lift the score to about 62.

Twenty-three known security holes in the packages the code depends on can be used by attackers. Eighteen secrets can leak from the build pipeline, and eight weaknesses in the code could be used by an attacker. Updating the vulnerable packages, limiting each secret to its own step and fixing the weaknesses the scanner points to would close these risks. Setting a waiting period for automatic updates would fix the automatic dependency update that takes a new release at once, and the unsafe setting in infrastructure or container files needs changing to safe values. The three inner parts of the code that depend on an outer part need turning around so they point inward.

The product code is 1,104,646 lines, about €2,800,000 to rebuild.

A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.

How the score is built: what each lens counts for The lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Security and Compliance 47 · counts for 45%Accessibility 57 · counts for 25%Production Readiness 62 · counts for 14%Code Health 63 · counts for 8%Maturity 76 · counts for 4%Architecture 85 · counts for 2%Performance 87 · counts for 1%Domain Modelling 91 · counts for 1%Event Sourcing 100 · counts for 0%

If Security and Compliance rose from 47 to 70, the lowest score rated Strong, the score would rise from 56 to about 62.

Code composition: what the lines of code are
Product code 53%Tests 47%
New since the last survey: 410 findings

These 410 critical or serious findings weren't in the previous survey, on 12 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.

  • Cyclomatic Complexity · TranscriptView::handle_select_mode_key (cyclomatic 48) codex-rs/tui/src/transcript_view/select_mode.rs
  • Cyclomatic Complexity · codex_guardian_context::transcript::collect_transcript_for_target (cyclomatic 47) codex-rs/guardian-context/src/transcript.rs
  • Cyclomatic Complexity · ChatWidget::status_line_value_for_item (cyclomatic 37) codex-rs/tui/src/chatwidget/status_surfaces.rs
  • Cyclomatic Complexity · FeedbackRequestProcessor::feedback_response (cyclomatic 35) codex-rs/app-server/src/request_processors/feedback_processor.rs
  • Cyclomatic Complexity · codex_tui::resume_picker::sources::spawn (cyclomatic 35) codex-rs/tui/src/resume_picker/sources.rs
  • Cyclomatic Complexity · CredentialBrokerState::register (cyclomatic 32) codex-rs/network-proxy/src/credential_broker.rs
  • Cyclomatic Complexity · codex_exec_server::shell_snapshot_credentials::prepare (cyclomatic 29) codex-rs/exec-server/src/shell_snapshot_credentials.rs
  • Cyclomatic Complexity · App::select_mode_owns_chord (cyclomatic 27) codex-rs/tui/src/app/input/select_mode.rs
  • Cyclomatic Complexity · codex_thread_store::local::thread_history_materialization::read_projection_batches (cyclomatic 24) codex-rs/thread-store/src/local/thread_history_materialization.rs
  • Cyclomatic Complexity · ScanState::observe (cyclomatic 23) codex-rs/app-server-protocol/src/export.rs
  • Cyclomatic Complexity · App::select_session_model (cyclomatic 23) codex-rs/tui/src/app/model_defaults.rs
  • Cyclomatic Complexity · codex_tui::app::user_turn_submission::try_submit_user_turn (cyclomatic 23) codex-rs/tui/src/app/user_turn_submission.rs
  • Cyclomatic Complexity · SampleTask::run (cyclomatic 22) codex-rs/app-server/src/thread_sample.rs
  • Cyclomatic Complexity · Discovery::handle_reply (cyclomatic 22) codex-rs/rmcp-client/src/local_stdio_transport.rs
  • Cyclomatic Complexity · codex_mcp::mcp::auth::compute_auth_status (cyclomatic 21) codex-rs/codex-mcp/src/mcp/auth.rs
  • Cyclomatic Complexity · ThreadEnvironments::update_selections_with_bindings (cyclomatic 21) codex-rs/core/src/environment_selection.rs
  • Cyclomatic Complexity · codex_exec_server::discoverV2::capability_discoveries::parse_root (cyclomatic 21) codex-rs/exec-server/src/discoverV2/capability_discoveries.rs
  • Cyclomatic Complexity · codex_sandboxing::bwrap::find_executable_in_search_paths (cyclomatic 21) codex-rs/sandboxing/src/bwrap.rs
  • Cyclomatic Complexity · LocalThreadStore::resolve_rollout_lineage_with_mode (cyclomatic 21) codex-rs/thread-store/src/local/rollout_lineage.rs
  • Cyclomatic Complexity · TranscriptOverlay::handle_key (cyclomatic 21) codex-rs/tui/src/pager_overlay/transcript.rs
  • Cyclomatic Complexity · BoardTool::execute (cyclomatic 20) codex-rs/message-board/src/tools.rs
  • Cyclomatic Complexity · codex_rollout_trace::protocol_event::tool_runtime_trace_event (cyclomatic 20) codex-rs/rollout-trace/src/protocol_event.rs
  • Cyclomatic Complexity · ChatWidget::handle_quick_dial_menu (cyclomatic 20) codex-rs/tui/src/chatwidget/quick_dials.rs
  • Cyclomatic Complexity · codex_tui::resume_picker::run_session_picker_event_loop (cyclomatic 20) codex-rs/tui/src/resume_picker.rs
  • Cyclomatic Complexity · McpCatalogBuilder::build (cyclomatic 19) codex-rs/codex-mcp/src/catalog.rs
  • Cyclomatic Complexity · Session::record_prepared_conversation_items (cyclomatic 19) codex-rs/core/src/session/mod.rs
  • Cyclomatic Complexity · PluginContributor::selected_plugins (cyclomatic 19) codex-rs/ext/mcp/src/plugin.rs
  • Cyclomatic Complexity · LocalStdioServerLauncher::launch_server (cyclomatic 19) codex-rs/rmcp-client/src/stdio_server_launcher.rs
  • Cyclomatic Complexity · codex_thread_store::local::read_thread::read_thread (cyclomatic 19) codex-rs/thread-store/src/local/read_thread.rs
  • Cyclomatic Complexity · App::active_keymap_contexts (cyclomatic 19) codex-rs/tui/src/app/input.rs
  • Cyclomatic Complexity · TranscriptView::handle_key (cyclomatic 19) codex-rs/tui/src/transcript_view/input.rs
  • Cyclomatic Complexity · McpRequestProcessor::list_mcp_server_status_response (cyclomatic 18) codex-rs/app-server/src/request_processors/mcp_processor.rs
  • Cyclomatic Complexity · codex_app_server_daemon::release_pruning::prune (cyclomatic 18) codex-rs/app-server-daemon/src/release_pruning.rs
  • Cyclomatic Complexity · codex_core::compact_remote_v2::collect_compaction_output (cyclomatic 18) codex-rs/core/src/compact_remote_v2.rs
  • Cyclomatic Complexity · codex_core::compact_remote_v2_installation::build_and_install_compaction (cyclomatic 18) codex-rs/core/src/compact_remote_v2_installation.rs
  • Cyclomatic Complexity · SkillsThreadState::refresh_cloud_catalog (cyclomatic 18) codex-rs/ext/skills/src/state.rs
  • Cyclomatic Complexity · InMemoryAgentMessageBoard::post_inner (cyclomatic 18) codex-rs/message-board/src/in_memory.rs
  • Cyclomatic Complexity · LocalAgentMessageBoard::post_inner (cyclomatic 18) codex-rs/message-board/src/local.rs
  • Cyclomatic Complexity · AwsSigV4Signer::sign (cyclomatic 18) codex-rs/network-proxy/src/aws_sigv4.rs
  • Cyclomatic Complexity · codex_shell_command::command_safety::windows_dangerous_commands::classify_powershell_words (cyclomatic 18) codex-rs/shell-command/src/command_safety/windows_dangerous_commands.rs
  • Cyclomatic Complexity · PickerState::handle_background_event (cyclomatic 18) codex-rs/tui/src/resume_picker.rs
  • Cyclomatic Complexity · EnterpriseLoginState::start (cyclomatic 17) codex-rs/app-server/src/request_processors/account_processor/enterprise_login.rs
  • Cyclomatic Complexity · NetworkMitmToml::validate_action_definitions (cyclomatic 17) codex-rs/config/src/permissions_toml.rs
  • Cyclomatic Complexity · codex_config::loader::validate_project_mitm_profiles (cyclomatic 17) codex-rs/config/src/loader/mod.rs
  • Cyclomatic Complexity · codex_config::tui_keymap::normalize_keybinding_stroke (cyclomatic 17) codex-rs/config/src/tui_keymap.rs
  • Cyclomatic Complexity · FeaturesToml::entries (cyclomatic 17) codex-rs/features/src/lib.rs
  • Cyclomatic Complexity · RmcpClient::call_tool_inner (cyclomatic 17) codex-rs/rmcp-client/src/rmcp_client.rs
  • Cyclomatic Complexity · codex_rmcp_client::request_input::request (cyclomatic 17) codex-rs/rmcp-client/src/request_input.rs
  • Cyclomatic Complexity · CustomPromptView::handle_key_event_at (cyclomatic 17) codex-rs/tui/src/bottom_pane/custom_prompt_view.rs
  • Cyclomatic Complexity · ChatWidget::submit_initial_user_message_if_pending (cyclomatic 17) codex-rs/tui/src/chatwidget/input_restore.rs
  • Cyclomatic Complexity · TurnRequestProcessor::turn_start_inner (cyclomatic 16) codex-rs/app-server/src/request_processors/turn_processor.rs
  • Cyclomatic Complexity · Daemon::try_restart_if_running (cyclomatic 16) codex-rs/app-server-daemon/src/lib.rs
  • Cyclomatic Complexity · Daemon::bootstrap_locked (cyclomatic 16) codex-rs/app-server-daemon/src/lib.rs
  • Cyclomatic Complexity · codex_app_server_protocol::export::build_schema_bundle (cyclomatic 16) codex-rs/app-server-protocol/src/export.rs
  • Cyclomatic Complexity · codex_app_server_transport::transport::websocket::run_websocket_inbound_loop (cyclomatic 16) codex-rs/app-server-transport/src/transport/websocket.rs
  • Cyclomatic Complexity · RealtimeWebsocketEvents::next_event (cyclomatic 16) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs
  • Cyclomatic Complexity · RealtimeWebsocketEvents::update_active_transcript (cyclomatic 16) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs
  • Cyclomatic Complexity · codex_mcp::rmcp_client::start_server_task (cyclomatic 16) codex-rs/codex-mcp/src/rmcp_client.rs
  • Cyclomatic Complexity · Session::replace_compacted_history (cyclomatic 16) codex-rs/core/src/session/mod.rs
  • Cyclomatic Complexity · codex_external_agent_migration::sessions::records_cla::summarize_session (cyclomatic 16) codex-rs/external-agent-migration/src/sessions/records_cla.rs
  • Cyclomatic Complexity · BodySecretSubstitution::apply (cyclomatic 16) codex-rs/network-proxy/src/secret_substitution.rs
  • Cyclomatic Complexity · codex_prompts::permissions_instructions::approval_text (cyclomatic 16) codex-rs/prompts/src/permissions_instructions.rs
  • Cyclomatic Complexity · App::save_config_preference (cyclomatic 16) codex-rs/tui/src/app/config_panel.rs
  • Cyclomatic Complexity · App::resume_config_for_target (cyclomatic 16) codex-rs/tui/src/app/resume_config.rs
  • Cyclomatic Complexity · App::confirm_directory_trust (cyclomatic 16) codex-rs/tui/src/app/resume_config.rs
  • Cyclomatic Complexity · ChatWidget::on_task_complete (cyclomatic 16) codex-rs/tui/src/chatwidget/turn_runtime.rs
  • Cognitive Complexity · codex_tui::resume_picker::sources::spawn (cognitive 96) codex-rs/tui/src/resume_picker/sources.rs
  • Cognitive Complexity · codex_guardian_context::transcript::collect_transcript_for_target (cognitive 84) codex-rs/guardian-context/src/transcript.rs
  • Cognitive Complexity · FeedbackRequestProcessor::feedback_response (cognitive 63) codex-rs/app-server/src/request_processors/feedback_processor.rs
  • Cognitive Complexity · codex_tui::app::user_turn_submission::try_submit_user_turn (cognitive 50) codex-rs/tui/src/app/user_turn_submission.rs
  • Cognitive Complexity · codex_app_server_protocol::export::build_schema_bundle (cognitive 41) codex-rs/app-server-protocol/src/export.rs
  • Cognitive Complexity · TranscriptView::handle_select_mode_key (cognitive 41) codex-rs/tui/src/transcript_view/select_mode.rs
  • Cognitive Complexity · ThreadEnvironments::update_selections_with_bindings (cognitive 39) codex-rs/core/src/environment_selection.rs
  • Cognitive Complexity · codex_thread_store::local::thread_history_materialization::read_projection_batches (cognitive 39) codex-rs/thread-store/src/local/thread_history_materialization.rs
  • Cognitive Complexity · codex_tui::resume_picker::run_session_picker_event_loop (cognitive 39) codex-rs/tui/src/resume_picker.rs
  • Cognitive Complexity · codex_core::compact_remote_v2::collect_compaction_output (cognitive 37) codex-rs/core/src/compact_remote_v2.rs
  • Cognitive Complexity · codex_exec_server::shell_snapshot_credentials::prepare (cognitive 35) codex-rs/exec-server/src/shell_snapshot_credentials.rs
  • Cognitive Complexity · codex_app_server_daemon::release_pruning::prune (cognitive 34) codex-rs/app-server-daemon/src/release_pruning.rs
  • Cognitive Complexity · McpRequestProcessor::list_mcp_server_status_response (cognitive 33) codex-rs/app-server/src/request_processors/mcp_processor.rs
  • Cognitive Complexity · LocalThreadStore::resolve_rollout_lineage_with_mode (cognitive 33) codex-rs/thread-store/src/local/rollout_lineage.rs
  • Cognitive Complexity · EnterpriseTokenSource::acquire_token (cognitive 32) codex-rs/codex-mcp/src/ema_token_source.rs
  • Cognitive Complexity · codex_mcp::mcp::auth::compute_auth_status (cognitive 32) codex-rs/codex-mcp/src/mcp/auth.rs
  • Cognitive Complexity · App::select_session_model (cognitive 32) codex-rs/tui/src/app/model_defaults.rs
  • Cognitive Complexity · codex_model_provider_info::merge_configured_model_providers (cognitive 28) codex-rs/model-provider-info/src/lib.rs
  • Cognitive Complexity · App::select_mode_owns_chord (cognitive 27) codex-rs/tui/src/app/input/select_mode.rs
  • Cognitive Complexity · App::begin_reconnect_inner (cognitive 27) codex-rs/tui/src/app/reconnect.rs
  • Cognitive Complexity · codex_app_server::request_processors::account_processor::workspace_routing::workspace_config_load_reason (cognitive 26) codex-rs/app-server/src/request_processors/account_processor/workspace_routing.rs
  • Cognitive Complexity · codex_core::compact_remote_v2_installation::build_and_install_compaction (cognitive 26) codex-rs/core/src/compact_remote_v2_installation.rs
  • Cognitive Complexity · TranscriptView::handle_key (cognitive 26) codex-rs/tui/src/transcript_view/input.rs
  • Cognitive Complexity · Daemon::bootstrap_locked (cognitive 25) codex-rs/app-server-daemon/src/lib.rs
  • Cognitive Complexity · ExecutorSkillProvider::list_from_discovery_v2 (cognitive 25) codex-rs/ext/skills/src/provider/executor/discovery_v2.rs
  • Cognitive Complexity · codex_http_client::windows_proxy_auth::connect_windows_proxy (cognitive 25) codex-rs/http-client/src/windows_proxy_auth.rs
  • Cognitive Complexity · codex_sandboxing::bwrap::find_executable_in_search_paths (cognitive 25) codex-rs/sandboxing/src/bwrap.rs
  • Cognitive Complexity · codex_hooks::engine::plugin_fingerprint::plugin_content_hash (cognitive 24) codex-rs/hooks/src/engine/plugin_fingerprint.rs
  • Cognitive Complexity · ChatWidget::submit_initial_user_message_if_pending (cognitive 24) codex-rs/tui/src/chatwidget/input_restore.rs
  • Cognitive Complexity · NetworkMitmToml::validate_action_definitions (cognitive 23) codex-rs/config/src/permissions_toml.rs
  • Cognitive Complexity · codex_config::loader::validate_project_mitm_profiles (cognitive 23) codex-rs/config/src/loader/mod.rs
  • Cognitive Complexity · Discovery::handle_reply (cognitive 23) codex-rs/rmcp-client/src/local_stdio_transport.rs
  • Cognitive Complexity · codex_rmcp_client::request_input::request (cognitive 23) codex-rs/rmcp-client/src/request_input.rs
  • Cognitive Complexity · TranscriptOverlay::handle_key (cognitive 23) codex-rs/tui/src/pager_overlay/transcript.rs

Watchdog compares every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.

Fixed since the last survey: 196 findings

These 196 critical or serious findings were in the previous survey, on 12 October 2026, and are gone from this one. The first 100 are listed here.

  • Cyclomatic Complexity · codex_guardian_context::transcript::collect_transcript (cyclomatic 42) codex-rs/guardian-context/src/transcript.rs
  • Cyclomatic Complexity · ChatWidget::status_line_value (cyclomatic 37) codex-rs/tui/src/chatwidget/status_surfaces.rs
  • Cyclomatic Complexity · FeedbackRequestProcessor::upload_feedback_response (cyclomatic 32) codex-rs/app-server/src/request_processors/feedback_processor.rs
  • Cyclomatic Complexity · MultiSelectPicker::handle_key_event (cyclomatic 23) codex-rs/tui/src/bottom_pane/multi_select_picker.rs
  • Cyclomatic Complexity · ThreadEnvironments::update_selections (cyclomatic 18) codex-rs/core/src/environment_selection.rs
  • Cyclomatic Complexity · codex_core::event_mapping::parse_user_message (cyclomatic 18) codex-rs/core/src/event_mapping.rs
  • Cyclomatic Complexity · BoardTool::execute (cyclomatic 18) codex-rs/ext/agent-message-board/src/tools.rs
  • Cyclomatic Complexity · ModifierDiff::queue (cyclomatic 18) codex-rs/tui/src/insert_history.rs
  • Cyclomatic Complexity · codex_tui::resume_picker::run_session_picker_with_loader (cyclomatic 18) codex-rs/tui/src/resume_picker.rs
  • Cyclomatic Complexity · codex_core::session::turn_input::start_if_idle (cyclomatic 17) codex-rs/core/src/session/turn_input.rs
  • Cyclomatic Complexity · LocalThreadStore::resolve_rollout_lineage_with_representation (cyclomatic 17) codex-rs/thread-store/src/local/rollout_lineage.rs
  • Cyclomatic Complexity · codex_thread_store::local::thread_history_materialization::read_projection_steps_sync (cyclomatic 17) codex-rs/thread-store/src/local/thread_history_materialization.rs
  • Cyclomatic Complexity · HooksBrowserView::handle_key_event (cyclomatic 17) codex-rs/tui/src/bottom_pane/hooks_browser_view.rs
  • Cyclomatic Complexity · codex_tui::startup_draft_input::handle_startup_draft_key (cyclomatic 17) codex-rs/tui/src/startup_draft_input.rs
  • Cyclomatic Complexity · codex_rmcp_client::tool_input::call_tool (cyclomatic 16) codex-rs/rmcp-client/src/tool_input.rs
  • Cyclomatic Complexity · codex_shell_command::command_safety::windows_dangerous_commands::is_dangerous_powershell_words (cyclomatic 16) codex-rs/shell-command/src/command_safety/windows_dangerous_commands.rs
  • Cognitive Complexity · codex_guardian_context::transcript::collect_transcript (cognitive 78) codex-rs/guardian-context/src/transcript.rs
  • Cognitive Complexity · FeedbackRequestProcessor::upload_feedback_response (cognitive 56) codex-rs/app-server/src/request_processors/feedback_processor.rs
  • Cognitive Complexity · codex_tui::resume_picker::run_session_picker_with_loader (cognitive 38) codex-rs/tui/src/resume_picker.rs
  • Cognitive Complexity · ThreadEnvironments::update_selections (cognitive 29) codex-rs/core/src/environment_selection.rs
  • Cognitive Complexity · codex_thread_store::local::thread_history_materialization::read_projection_steps_sync (cognitive 28) codex-rs/thread-store/src/local/thread_history_materialization.rs
  • Cognitive Complexity · LocalThreadStore::resolve_rollout_lineage_with_representation (cognitive 26) codex-rs/thread-store/src/local/rollout_lineage.rs
  • Cognitive Complexity · codex_rmcp_client::tool_input::call_tool (cognitive 24) codex-rs/rmcp-client/src/tool_input.rs
  • Cognitive Complexity · App::begin_reconnect (cognitive 24) codex-rs/tui/src/app/reconnect.rs
  • Cognitive Complexity · Environment::discover_capability_roots (cognitive 20) codex-rs/exec-server/src/environment.rs
  • Cognitive Complexity · ComposedContext::into_annotated_messages (cognitive 20) codex-rs/guardian-context/src/composition.rs
  • Cognitive Complexity · GatewayAuthManager::refresh (cognitive 20) codex-rs/login/src/gateway_auth.rs
  • Cognitive Complexity · codex_core::event_mapping::parse_user_message (cognitive 18) codex-rs/core/src/event_mapping.rs
  • Cognitive Complexity · codex_core_plugins::executor_hooks::executor_plugin_hook_sources (cognitive 18) codex-rs/core-plugins/src/executor_hooks.rs
  • Cognitive Complexity · ModifierDiff::queue (cognitive 18) codex-rs/tui/src/insert_history.rs
  • Cognitive Complexity · TranscriptView::entry_layout (cognitive 18) codex-rs/tui/src/transcript_view/layout.rs
  • Cognitive Complexity · codex_core::session::turn_input::start_or_steer (cognitive 17) codex-rs/core/src/session/turn_input.rs
  • Cognitive Complexity · codex_core::session::turn_input::start_if_idle (cognitive 17) codex-rs/core/src/session/turn_input.rs
  • Cognitive Complexity · InMemoryAgentMessageBoard::post_inner (cognitive 16) codex-rs/ext/agent-message-board/src/in_memory.rs
  • Cognitive Complexity · codex_shell_command::command_safety::windows_dangerous_commands::is_dangerous_powershell_words (cognitive 16) codex-rs/shell-command/src/command_safety/windows_dangerous_commands.rs
  • God Classes · MethodTooLong: Session.new codex-rs/core/src/session/session.rs
  • God Classes · MethodTooLong: Classification.run codex-rs/ext/guardian-v2/src/async_scorer/classification.rs
  • God Classes · FunctionTooLong: codex_guardian_context::transcript::collect_transcript codex-rs/guardian-context/src/transcript.rs
  • God Classes · MethodTooLong: BoardTool.execute codex-rs/ext/agent-message-board/src/tools.rs
  • God Classes · MethodTooLong: FeedbackRequestProcessor.upload_feedback_response codex-rs/app-server/src/request_processors/feedback_processor.rs
  • God Classes · FunctionTooLong: codex_thread_store::local::thread_history_materialization::read_projection_steps_sync codex-rs/thread-store/src/local/thread_history_materialization.rs
  • God Classes · MethodTooLong: ThreadItem.from codex-rs/app-server-protocol/src/protocol/v2/item.rs
  • God Classes · FunctionTooLong: codex_tui::keymap_setup::actions::binding_slot codex-rs/tui/src/keymap_setup/actions.rs
  • God Classes · MethodTooLong: ModelClientSession.stream_responses_api codex-rs/core/src/client.rs
  • God Classes · FunctionTooLong: codex_core::tools::handlers::multi_agents_v2::spawn::handle_spawn_agent codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs
  • God Classes · FunctionTooLong: codex_core::compact_remote_v2::run_remote_compact_task_inner_impl codex-rs/core/src/compact_remote_v2.rs
  • God Classes · FunctionTooLong: codex_core::tools::network_approval::begin_network_approval codex-rs/core/src/tools/network_approval.rs
  • God Classes · FileTooLong: src/extension.rs codex-rs/ext/skills/src/extension.rs
  • God Classes · FunctionTooLong: codex_thread_store::local::list_threads::list_section_threads codex-rs/thread-store/src/local/list_threads.rs
  • God Classes · MethodTooLong: LocalThreadStore.resolve_rollout_lineage_with_representation codex-rs/thread-store/src/local/rollout_lineage.rs
  • God Classes · MethodTooLong: ChatWidget.status_line_value codex-rs/tui/src/chatwidget/status_surfaces.rs
  • God Classes · TooManyMethods: HooksBrowserView codex-rs/tui/src/bottom_pane/hooks_browser_view.rs
  • God Classes · FunctionTooLong: codex_core_plugins::marketplace_add::add_marketplace_sync_with_cloner codex-rs/core-plugins/src/marketplace_add.rs
  • God Classes · FunctionTooLong: codex_core::session::turn_input::start_or_steer codex-rs/core/src/session/turn_input.rs
  • God Classes · MethodTooLong: LocalAgentMessageBoard.post_inner codex-rs/ext/agent-message-board/src/local.rs
  • Code Duplication · Near-duplicate member pair (48 shared lines) codex-rs/external-agent-migration/src/sessions/records_cla.rs
  • Code Duplication · Near-duplicate member pair (43 shared lines) codex-rs/rollout-trace/src/protocol_event.rs
  • Code Duplication · Edited copy of a member (66 corresponding lines) scripts/mcp_conformance/server.py
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) codex-rs/core/src/session/mcp.rs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) codex-rs/hooks/src/events/compact.rs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) codex-rs/tui/src/config_panel/render.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/analytics/src/events.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/app-server-daemon/src/backend/pid.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/app-server/src/request_processors/apps_processor.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/cli/src/migrate_rollouts.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/core-plugins/src/remote.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/core/src/client_common.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/hooks/src/events/post_tool_use.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/tui/src/bottom_pane/chat_composer.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/tui/src/bottom_pane/experimental_features_view.rs
  • Code Duplication · Duplicated block (55 lines × 2) codex-rs/tui/src/custom_terminal.rs
  • Code Duplication · Duplicated block (27–28 lines × 2) codex-rs/cli/src/login.rs
  • Code Duplication · Duplicated block (26 lines × 2) codex-rs/core/src/session/mcp.rs
  • Code Duplication · Duplicated block (26 lines × 2) codex-rs/windows-sandbox-rs/src/setup.rs
  • Code Duplication · Duplicated block (24 lines × 2) codex-rs/rollout/src/list.rs
  • Code Duplication · Duplicated block (20 lines × 2) codex-rs/tui/src/bottom_pane/multi_select_picker.rs
  • Code Duplication · Duplicated block (18 lines × 3) codex-rs/tui/src/bottom_pane/list_selection_view.rs
  • Code Duplication · Duplicated block (17–18 lines × 2) codex-rs/core/src/mcp_tool_call.rs
  • Code Duplication · Duplicated block (18 lines × 2) codex-rs/rollout/src/list.rs
  • Code Duplication · Duplicated block (16–17 lines × 2) codex-rs/app-server/src/bespoke_event_handling.rs
  • Code Duplication · Duplicated block (16–17 lines × 2) codex-rs/hooks/src/events/pre_tool_use.rs
  • Code Duplication · Duplicated block (17 lines × 2) codex-rs/rollout/src/search.rs
  • Code Duplication · Duplicated block (16 lines × 3) codex-rs/rollout/src/list.rs
  • Code Duplication · Duplicated block (15–16 lines × 2) codex-rs/thread-store/src/local/thread_history.rs
  • Code Duplication · Duplicated block (15 lines × 3) codex-rs/analytics/src/events.rs
  • Code Duplication · Duplicated block (15 lines × 2) codex-rs/analytics/src/reducer.rs
  • Code Duplication · Duplicated block (15 lines × 2) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs
  • Code Duplication · Duplicated block (14 lines × 2) codex-rs/exec/src/event_processor_with_human_output.rs
  • Code Duplication · Duplicated block (14 lines × 2) codex-rs/login/src/gateway_auth.rs
  • Code Duplication · Duplicated block (14 lines × 2) codex-rs/windows-sandbox-rs/src/bin/command_runner/win.rs
  • Code Duplication · Duplicated block (13 lines × 3) codex-rs/external-agent-migration/src/sessions/records_cla.rs
  • Code Duplication · Duplicated block (12–13 lines × 2) codex-rs/app-server-protocol/src/protocol/item_builders.rs
  • Code Duplication · Duplicated block (13 lines × 2) codex-rs/codex-mcp/src/mcp/mod.rs
  • Code Duplication · Duplicated block (13 lines × 2) codex-rs/codex-mcp/src/mcp/mod.rs
  • Code Duplication · Duplicated block (13 lines × 2) codex-rs/ext/agent-message-board/src/in_memory/queries.rs
  • Code Duplication · Duplicated block (13 lines × 2) codex-rs/hooks/src/engine/dispatcher.rs
  • Code Duplication · Duplicated block (13 lines × 2) codex-rs/windows-sandbox-rs/src/setup_provisioning/firewall.rs
  • Code Duplication · Duplicated block (12 lines × 3) codex-rs/core/src/session/mcp.rs
  • Code Duplication · Duplicated block (12 lines × 2) codex-rs/app-server/src/request_processors/thread_processor.rs
  • Code Duplication · Duplicated block (12 lines × 2) codex-rs/rollout-trace/src/protocol_event.rs
Rebuild cost: about €2,800,000 · Estimate
Cost to rebuild€940,000 to €4,700,000, for 15,648 to 49,641 hours of work, about 19.4 person-years for 11 to 37 engineers
Difficulty of the problemHigh, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.8 at a score of 56. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeVery large: 1,104,646 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

How the estimate is made: Watchdog prices the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.

Top priorities

The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.

1
Load cryptographic key and salt material from configuration, an environment variable or a secrets manager rather than fixing it in the source, and fail fast at startup when it is absent — a default that silently works is the one that reaches production.
Rotate anything already committed: it must be treated as disclosed. Salts should be generated per password and stored with the hash, never shared across installations.
Raises the score by about 7 points · Medium effort · Web-Security Posture
2
Resolve the 3 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED, REDACTED.
Raises the score by about 1 point · Low effort · Static Analysis (SAST)
3
Resolve the 18 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (7), REDACTED (5), REDACTED (4).
Raises the score by about 3 points · Medium effort · Static Analysis (SAST)

Diagnosis: what the measurements show together

Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.

Where the investment is most exposed · Value at risk
This code would cost about €2,800,000 to build again, about 19.4 person-years of work. Its weakest lens is Security and Compliance, at 47 (Weak). Security and Compliance is about how well the product is protected, and how it handles personal data. Because the weakest lens counts most in the score, work on Security and Compliance also moves the score most.
Based on: the rebuild estimate · the Security and Compliance grade · how much each lens counts
What to do: Start with the Security and Compliance actions in Top priorities.
If you do one thing first · First action
Load cryptographic key and salt material from configuration, an environment variable or a secrets manager rather than fixing it in the source, and fail fast at startup when it is absent — a default that silently works is the one that reaches production. Of all the actions in this report, it raises the score most for the work it takes: about 7 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 6.4 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 4% to 9% on every change. The history of the code shows how much it changes: about 1,604,631 lines over the last 90 days, which is about 6,507,670 lines a year. At that pace, the extra work comes to an estimated 647.4 to 3884.2 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — module dependency graph

Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.

arch codex-app-server codex-app-server codex-app-server-protocol codex-app-server-protocol codex-app-server->codex-app-server-protocol codex-config codex-config codex-app-server->codex-config codex-core codex-core codex-app-server->codex-core codex-core-plugins codex-core-plugins codex-app-server->codex-core-plugins codex-exec-server codex-exec-server codex-app-server->codex-exec-server codex-extension-api codex-extension-api codex-app-server->codex-extension-api codex-git-utils codex-git-utils codex-app-server->codex-git-utils codex-http-client codex-http-client codex-app-server->codex-http-client codex-login codex-login codex-app-server->codex-login codex-mcp codex-mcp codex-app-server->codex-mcp codex-model-provider codex-model-provider codex-app-server->codex-model-provider codex-otel codex-otel codex-app-server->codex-otel codex-protocol codex-protocol codex-app-server->codex-protocol codex-rollout codex-rollout codex-app-server->codex-rollout codex-tools codex-tools codex-app-server->codex-tools codex-utils-absolute-path codex-utils-absolute-path codex-app-server->codex-utils-absolute-path codex-utils-path-uri codex-utils-path-uri codex-app-server->codex-utils-path-uri codex-app-server-protocol->codex-protocol codex-app-server-protocol->codex-rollout codex-app-server-protocol->codex-utils-absolute-path codex-app-server-protocol->codex-utils-path-uri codex-cli codex-cli codex-cli->codex-app-server codex-cli->codex-app-server-protocol codex-cli->codex-config codex-cli->codex-core codex-cli->codex-core-plugins codex-cli->codex-exec-server codex-cli->codex-extension-api codex-cli->codex-git-utils codex-cli->codex-http-client codex-cli->codex-login codex-cli->codex-mcp codex-cli->codex-model-provider codex-cli->codex-protocol codex-cli->codex-rollout codex-tui codex-tui codex-cli->codex-tui codex-cli->codex-utils-absolute-path codex-cli->codex-utils-path-uri codex-config->codex-git-utils codex-config->codex-http-client codex-config->codex-protocol codex-config->codex-utils-absolute-path codex-config->codex-utils-path-uri codex-core->codex-app-server-protocol codex-core->codex-config codex-core->codex-core-plugins codex-core->codex-exec-server codex-core->codex-extension-api codex-core->codex-git-utils codex-core->codex-http-client codex-core->codex-login codex-core->codex-mcp codex-core->codex-model-provider codex-core->codex-otel codex-core->codex-protocol codex-core->codex-rollout codex-core->codex-tools codex-core->codex-utils-absolute-path codex-core->codex-utils-path-uri codex-core-plugins->codex-app-server-protocol codex-core-plugins->codex-config codex-core-plugins->codex-exec-server codex-core-plugins->codex-git-utils codex-core-plugins->codex-http-client codex-core-plugins->codex-login codex-core-plugins->codex-mcp codex-core-plugins->codex-model-provider codex-core-plugins->codex-otel codex-core-plugins->codex-protocol codex-core-plugins->codex-tools codex-core-plugins->codex-utils-absolute-path codex-core-plugins->codex-utils-path-uri codex-exec-server->codex-config codex-exec-server->codex-http-client codex-exec-server->codex-otel codex-exec-server->codex-protocol codex-exec-server->codex-utils-absolute-path codex-exec-server->codex-utils-path-uri codex-extension-api->codex-config codex-extension-api->codex-mcp codex-extension-api->codex-protocol codex-extension-api->codex-tools codex-extension-api->codex-utils-absolute-path codex-extension-api->codex-utils-path-uri codex-git-utils->codex-protocol codex-git-utils->codex-utils-absolute-path codex-git-utils->codex-utils-path-uri codex-login->codex-config codex-login->codex-http-client codex-login->codex-otel codex-login->codex-protocol codex-mcp->codex-config codex-mcp->codex-exec-server codex-mcp->codex-login codex-mcp->codex-model-provider codex-mcp->codex-otel codex-mcp->codex-protocol codex-mcp->codex-utils-absolute-path codex-mcp->codex-utils-path-uri codex-model-provider->codex-http-client codex-model-provider->codex-login codex-model-provider->codex-otel codex-model-provider->codex-protocol codex-otel->codex-http-client codex-otel->codex-protocol codex-otel->codex-utils-absolute-path codex-protocol->codex-http-client codex-protocol->codex-utils-absolute-path codex-protocol->codex-utils-path-uri codex-rollout->codex-git-utils codex-rollout->codex-otel codex-rollout->codex-protocol codex-rollout->codex-utils-absolute-path codex-tools->codex-protocol codex-tools->codex-utils-path-uri codex-tui->codex-app-server-protocol codex-tui->codex-config codex-tui->codex-core-plugins codex-tui->codex-exec-server codex-tui->codex-git-utils codex-tui->codex-http-client codex-tui->codex-login codex-tui->codex-model-provider codex-tui->codex-otel codex-tui->codex-protocol codex-tui->codex-rollout codex-tui->codex-utils-absolute-path codex-tui->codex-utils-path-uri codex-utils-path-uri->codex-utils-absolute-path __more__ +163 more projects

Architecture: which parts of the code depend on which

The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.

3217 modules, with 11200 dependencies between them. 18 loops run through 856 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 3177 more are left out to keep it readable.

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses →1 codex_agent_message_board_client.notifications2 codex_app_server_protocol.protocol.v2.permissions3 codex_app_server_protocol.protocol.v2.shared4 codex_http_client.outbound_proxy5 codex_protocol.models.item_metadata6 codex_protocol.thread_id7 codex_shell_command.shell_snapshot_render8 codex_context_fragments.fragment9 codex_protocol.openai_models10 codex_utils_absolute_path11 codex_config.types12 codex_tui.empty_state_animation.geometry13 codex_utils_path_uri14 codex_exec_server_protocol.protocol15 codex_protocol.protocol16 codex_app_server_protocol.rpc17 codex_history18 codex_protocol.models19 codex_app_server_protocol.protocol.v2.turn20 codex_app_server_protocol.protocol.v2.thread21 codex_app_server_protocol.protocol.v2.item22 codex_app_server_protocol.protocol.v2.thread_data23 codex_login.auth.manager24 codex_cloud_client.types25 codex_code_mode_runtime.session_runtime.types26 codex_protocol.config_types27 codex_app_server_protocol.protocol.v2.config28 codex_tools.tool_spec29 codex_config.state30 codex_core.thread_manager31 codex_core.config32 codex_core.session.turn_context33 codex_tui.app_server_session34 codex_core.session.session35 codex_core.codex_thread36 codex_core.tools.context37 codex_core.unified_exec.async_watcher38 codex_tui.bottom_pane39 codex_tui.chatwidget40 codex_tui.app
1 codex_agent_message_board_client.notifications
2 codex_app_server_protocol.protocol.v2.permissions
3 codex_app_server_protocol.protocol.v2.shared
4 codex_http_client.outbound_proxy
5 codex_protocol.models.item_metadata
6 codex_protocol.thread_id
7 codex_shell_command.shell_snapshot_render
8 codex_context_fragments.fragment43
9 codex_protocol.openai_models22
10 codex_utils_absolute_path3
11 codex_config.types13248
12 codex_tui.empty_state_animation.geometry1
13 codex_utils_path_uri1
14 codex_exec_server_protocol.protocol112811
15 codex_protocol.protocol611274182311032477
16 codex_app_server_protocol.rpc31
17 codex_history3422
18 codex_protocol.models421221111
19 codex_app_server_protocol.protocol.v2.turn1321135
20 codex_app_server_protocol.protocol.v2.thread91957421412315
21 codex_app_server_protocol.protocol.v2.item5211
22 codex_app_server_protocol.protocol.v2.thread_data12221
23 codex_login.auth.manager11102213
24 codex_cloud_client.types12
25 codex_code_mode_runtime.session_runtime.types1
26 codex_protocol.config_types3211
27 codex_app_server_protocol.protocol.v2.config92119
28 codex_tools.tool_spec1
29 codex_config.state4124
30 codex_core.thread_manager119116766513
31 codex_core.config4612422311521325
32 codex_core.session.turn_context411223232221521
33 codex_tui.app_server_session262153212322136271
34 codex_core.session.session1912123111713512521531136
35 codex_core.codex_thread145212226314712
36 codex_core.tools.context128121
37 codex_core.unified_exec.async_watcher1122
38 codex_tui.bottom_pane1121112
39 codex_tui.chatwidget2211231181338222113
40 codex_tui.app16541113251344241152
Uses a module listed above itPart of a loopThe module itself
1 codex_agent_message_board_client.notifications2 codex_app_server_protocol.protocol.v2.permissions3 codex_app_server_protocol.protocol.v2.shared4 codex_http_client.outbound_proxy5 codex_protocol.models.item_metadata6 codex_protocol.thread_id7 codex_shell_command.shell_snapshot_render8 codex_context_fragments.fragment9 codex_protocol.openai_models10 codex_utils_absolute_path11 codex_config.types12 codex_tui.empty_state_animation.geometry13 codex_utils_path_uri14 codex_exec_server_protocol.protocol15 codex_protocol.protocol16 codex_app_server_protocol.rpc17 codex_history18 codex_protocol.models19 codex_app_server_protocol.protocol.v2.turn20 codex_app_server_protocol.protocol.v2.thread21 codex_app_server_protocol.protocol.v2.item22 codex_app_server_protocol.protocol.v2.thread_data23 codex_login.auth.manager24 codex_cloud_client.types25 codex_code_mode_runtime.session_runtime.types26 codex_protocol.config_types27 codex_app_server_protocol.protocol.v2.config28 codex_tools.tool_spec29 codex_config.state30 codex_core.thread_manager31 codex_core.config32 codex_core.session.turn_context33 codex_tui.app_server_session34 codex_core.session.session35 codex_core.codex_thread36 codex_core.tools.context37 codex_core.unified_exec.async_watcher38 codex_tui.bottom_pane39 codex_tui.chatwidget40 codex_tui.appcodex_agent_message_board_client.notifications1codex_app_server_protocol.protocol.v2.permissions2codex_app_server_protocol.protocol.v2.shared3codex_http_client.outbound_proxy4codex_protocol.models.item_metadata5codex_protocol.thread_id6codex_shell_command.shell_snapshot_render7codex_context_fragments.fragment8codex_protocol.openai_models9codex_utils_absolute_path10codex_config.types11codex_tui.empty_state_animation.geometry12codex_utils_path_uri13codex_exec_server_protocol.protocol14codex_protocol.protocol15codex_app_server_protocol.rpc16codex_history17codex_protocol.models18codex_app_server_protocol.protocol.v2.turn19codex_app_server_protocol.protocol.v2.thread20codex_app_server_protocol.protocol.v2.item21codex_app_server_protocol.protocol.v2.thread_data22codex_login.auth.manager23codex_cloud_client.types24codex_code_mode_runtime.session_runtime.types25codex_protocol.config_types26codex_app_server_protocol.protocol.v2.config27codex_tools.tool_spec28codex_config.state29codex_core.thread_manager30codex_core.config31codex_core.session.turn_context32codex_tui.app_server_session33codex_core.session.session34codex_core.codex_thread35codex_core.tools.context36codex_core.unified_exec.async_watcher37codex_tui.bottom_pane38codex_tui.chatwidget39codex_tui.app4043223132481111281161127418231103247731342242122111113211359195742141231552111222111102213121321192119141241191167665134612422311521325411223232221521262153212322136271191212311171351252153113614521222631471212812111221121112221123118133822211316541113251344241152+3177 more modules (most-connected shown)

At a glance — Code Health · 63% · Adequate · gated by D2, X4 ·

At a glance — Architecture · 85% · Strong ·

At a glance — Maturity · 76% · Strong ·

At a glance — Readiness · 62% · Adequate · gated by P7 ·

At a glance — Security · 47% · Weak · gated by D29, D30, S1 ·

At a glance — Domain Modelling · 91% · Exemplary ·

At a glance — Event Sourcing · 100% · Exemplary ·

At a glance — Accessibility · 57% · Adequate ·

At a glance — Performance · 87% · Strong ·

Security & Compliance — OWASP Top-10 mapping

Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).

OWASP categoryFindingsSeverity
A03:2025 — Software Supply Chain Failures77High / Critical
A05:2025 — Injection35High / Critical
A02:2025 — Security Misconfiguration2High / Critical

Roadmap

Immediately rotate all committed cryptographic keys and salts, ensuring they are loaded from secure configuration sources rather than hardcoded in the source. Resolve the 18 static analysis secrets findings by updating CI workflows and address the 19 high-severity dependency vulnerabilities in your lock files. Finally, enforce accessibility standards by integrating automated checks into your CI pipeline and correcting visual issues such as missing focus styles and low-contrast colors.

Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.

Do thisHelpsEffortDimension
Load cryptographic key and salt material from configuration, an environment variable or a secrets manager rather than fixing it in the source, and fail fast at startup when it is absent — a default that silently works is the one that reaches production. Rotate anything already committed: it must be treated as disclosed. Salts should be generated per password and stored with the hash, never shared across installations.+7.1 ptsMediumWeb-Security Posture
Resolve the 3 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED, REDACTED.+1.1 ptsLowStatic Analysis (SAST)
Resolve the 18 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (7), REDACTED (5), REDACTED (4).+2.9 ptsMediumStatic Analysis (SAST)
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4).+1.1 ptsLowStatic Analysis (SAST)
Resolve the 2 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2).+1.1 ptsLowDependency Vulnerabilities
Resolve the 2 High vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (2).+1.1 ptsLowDependency Vulnerabilities
Resolve the 1 High IaC finding(s) in IaC & Container Security — start with REDACTED.+1.1 ptsLowIaC & Container Security
Enforce accessibility in the toolchain: add an accessibility check that can read your UI — no component framework was detected and your pages are rendered by server-side templates, which neither the JSX/Vue ESLint plugins nor the HTML-template linters can parse; run axe/pa11y over the rendered pages, or assert the accessibility invariants over that rendered HTML in the test suite you already have, then assert with jest-axe in tests, then gate axe/pa11y/Lighthouse in CI.+1.8 ptsMediumA11y enforcement

File quality

Per-file score 0–10 — a quality signature. Of 1099 files carrying findings, judged against the Production bar: 1% slop · 67% mixed · 32% near-clean.

FileScoreBandWorst signal
REDACTED0.0SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED0.4SlopDependency Vulnerabilities: High CVE: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.5SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED4.9MixedStatic Analysis (SAST): Medium: REDACTED
codex-rs/core/src/mcp.rs4.9MixedCyclomatic Complexity: McpManager::runtime_config_with_context (cyclomatic 29)
REDACTED5.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED5.0MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedIaC & Container Security: High IaC: REDACTED
REDACTED5.4MixedStatic Analysis (SAST): High: REDACTED
codex-rs/tui/src/bottom_pane/chat_composer.rs5.5MixedCyclomatic Complexity: ChatComposer::render_with_options (cyclomatic 87)
codex-rs/network-proxy/src/http_proxy.rs5.5MixedCyclomatic Complexity: codex_network_proxy::http_proxy::http_plain_proxy (cyclomatic 29)
codex-rs/tui/src/markdown_render.rs5.5MixedCyclomatic Complexity: Writer::start_tag (cyclomatic 26)
codex-rs/core/src/client.rs5.5MixedCyclomatic Complexity: ModelClientSession::stream_responses_websocket (cyclomatic 25)
codex-rs/cli/src/mcp_cmd.rs5.5MixedCyclomatic Complexity: codex_cli::mcp_cmd::run_get (cyclomatic 20)
codex-rs/cloud-tasks-client/src/http.rs5.5MixedCyclomatic Complexity: Apply::run (cyclomatic 17)
codex-rs/tui/src/app_event.rs5.5MixedGod Classes: FileTooLong: src/app_event.rs

How the grades work

Every finding carries one of four grades. Three say how serious it is. The fourth says this survey could not settle it — and it is a grade, not a gap.

Critical — 62

A definite problem that already costs you something and drags the score down: a missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here tends to cause failures elsewhere.

Serious — 4388

Likely wrong, but not failing yet. It degrades the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to carry for two years either.

Minor — 241

Recorded, with no effect on how the codebase functions. Present so the survey is complete, not because it needs doing.

Could not be resolved — 11

Something this survey could not settle from the outside, and which could be critical or serious. Either a control was required and no positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean result. These are excluded from the score rather than awarded a pass, so the number on the cover neither rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each one is named under Limitations.

Methodology & how to trust this report

Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 90 of 90 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); none rely on LLM judgement. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.

Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.

What we checked — 90 dimensions across the health lenses
D1D2D3D4D5D6D9D10D12D13D14D15D16D17D19D20D26D28D29D30D31D34D35D36D37D43D44AC2AC3AC5AC6AC7AX10AX3AX4AX5AX8AX9C2DM4DM5DM6ES1ES2M1M2M3M4P1P10P2P3P4P6P7P8PF1PF3R1R10R2R3R4R6R7R8R9S1X1X12X13X14X15X16X17X18X19X21X22X23X24X25X26X27X28X29X3X30X4X5

Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.

How to trust any code-health report — three questions
  1. Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 4504 of 4691 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.

This report answers yes to all three. That's the bar to hold any assessment to.

Tools & methods

The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Watchdog duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivy · checkovSecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3 · 3.2.533✓ deterministic
LLM (sampled · advisory)Documentation quality, ADR conformance, naming — sampled over a bounded sample; advisory, never a deterministic measurement—◐ LLM · sampled · advisory

Every finding is locatable in findings.md. Run 01a17a10-64b4-73b9-85d4-9e4d2d74e734.

The exact command behind every deep-scan dimension — tool, version, invocation and retained raw output — is in Appendix B — Reproduction & audit trail.

Run transparency — what happened this run

What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.

  • D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — the dependency install for sdk/typescript/ failed in the analyzer sandbox (ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)), so the suite never ran. Coverage is excluded from the score rather than counted as a near-zero. This is OUR limitation, not a defect in the repo. In the meantime, commit (or publish into the working tree) the lcov/Cobertura report your CI produces and the real number is read on the next scan. You can widen what we reach: optional: commit the lcov/Cobertura report your CI produces, and the real number is read on the next scan.
  • D10 Test Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 46 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 2,289 test source file(s) (.py, .rs) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
  • D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability NOT MEASURED: the JavaScript/TypeScript suite could not be re-run in the analyzer sandbox — the dependency install for sdk/typescript/ failed in the analyzer sandbox (ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)), so the suite never ran. This is OUR limitation, not a defect in the repo — it is excluded from the score.
  • D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the jest suite in sdk/typescript/ was NOT MEASURED: the dependency install for sdk/typescript/ failed in the analyzer sandbox (ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
  • D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its crate dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Python REDACTED/requirements.txt (pip/uv/Poetry), but the licence verdict published here was taken over its crate dependencies. Nothing was read about its Python dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D15 Churn × Complexity Hotspots — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. A hotspot's complexity is meant to be the worst body its churn actually touched. For codex-rs/tui/src/keymap/bindings.rs, codex-rs/app-server-protocol/src/protocol/common.rs, codex-rs/tui/src/keymap_setup/actions.rs that could not be established — the complexity reader for the file reports no body extents, or the history carries no per-line attribution — so the row quotes the file's worst body, which the counted changes may never have touched. The churn count is unaffected.
  • D19 Documentation Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
  • D19 Documentation Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
  • D21 Naming Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
  • D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • D27 Navigability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • AXR1 Runtime accessibility — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via ToolchainServer (codex-rs/app-server). the service did not build — `cargo build --locked --bin 'codex-app-server'` exited 1: info: syncing channel updates for 1.99.1-x86_64-unknown-linux-gnu error: could not download file from 'https://static.rust-lang.org/dist/channel-rust-1.99.1.toml.sha256' to '/usr/local/rustup/tmp/elfw…; runtime evidence skipped (launch chosen because 'axum' dependency in codex-rs/app-server/Cargo.toml, binary 'codex-app-server').
  • ED5 Idempotency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check decides whether a handler's mutation is safe to re-run by recognising its persistence writes (a database save, a repository write, an event publish) and its guards. Those markers are .NET member names, so in this repository's language a write such as `repository.save(order)` is not recognised and a same-named call on an unrelated library type could be. The handlers were found; their idempotency was neither confirmed nor ruled out.
  • GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Python, Rust, c is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python, Rust, c is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9). Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • X4 Structured logging — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 1018 further occurrence(s) are not listed individually; the score already reflects all 1058.

Repo exclusion declarations: 18 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.

Limitations & what we did not check

Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.

Per-dimension blind spots

For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
  • AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
  • AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
  • AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
  • AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • DM4 Rich vs anemic domain model: Behaviour is detected as state mutation inside a method body — a method that enforces an invariant by validating-and-throwing without mutating reads as a query, and mutation delegated through an interface the scan can't resolve isn't credited; entities with zero public properties still drop out of the population. It detects that state changes, not whether the rule is correct.
  • DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
  • M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 · Cyclomatic Complexity4.1 / 10Weak✓ Tool-verified

What it measures: How tangled the control flow is — methods with many branches are hard to test and change.

Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.

Maturity: Documented → Verified → Prevented · effective 4.1 / 10 · rule-coverage 100% · ceiling Prevented

678 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was App::handle_event at 622. A further 58 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being codex_tui::keymap::bindings::configured_binding_for_action at 160 — they are counted neither in the figure above nor in this dimension's score. 35 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: codex-rs/tui/src/keymap/bindings.rs (codex_tui::keymap::bindings::configured_binding_for_action at 160), codex-rs/tui/src/keymap_setup/actions.rs (codex_tui::keymap_setup::actions::binding_slot at 155), codex-rs/app-server-protocol/src/protocol/common.rs (ServerNotification::to_params at 87), codex-rs/tui/src/app/app_server_event_targets.rs (codex_tui::app::app_server_event_targets::server_notification_thread_target at 67), codex-rs/tui/src/slash_command.rs (SlashCommand::description at 63), and 30 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.

codex_tui::startup_orchestration::run_main_inner (cyclomatic 125) · ×56codex-rs/tui/src/startup_orchestration.rs:10
App::handle_event (cyclomatic 622) · ×49codex-rs/tui/src/app/event_dispatch.rs:29
ChatWidget::dispatch_command_from_source (cyclomatic 93) · ×37codex-rs/tui/src/chatwidget/slash_dispatch.rs:162
codex_core::session::turn::try_run_sampling_request (cyclomatic 107) · ×28codex-rs/core/src/session/turn.rs:2657
codex_cli::cli_main (cyclomatic 100) · ×13codex-rs/cli/src/main.rs:1053

+ 269 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 1 body over 240 down to 240 or less in Cyclomatic Complexity — start with App::handle_event (cyclomatic 622). — Refactoring it lifts Cyclomatic Complexity from 4.1 to about 5.1/10.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.

D2 · Cognitive Complexity2.0 / 10Critical✓ Tool-verified

What it measures: How hard the code is for a person to follow, beyond raw branching.

Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.

Maturity: Documented → Verified → Prevented · effective 2.0 / 10 · rule-coverage 100% · ceiling Prevented

1147 method(s) exceeded the cognitive complexity threshold of 15; the worst was codex_cloud_tasks::run_main at 758.

codex_tui::analytics::normalize::history (cognitive 190) · ×98codex-rs/tui/src/analytics/normalize.rs:30
App::handle_event (cognitive 676) · ×57codex-rs/tui/src/app/event_dispatch.rs:29
codex_core::session::turn::try_run_sampling_request (cognitive 213) · ×53codex-rs/core/src/session/turn.rs:2657
ChatWidget::submit_user_message_with_prepared_images (cognitive 103) · ×44codex-rs/tui/src/chatwidget/input_submission.rs:130
codex_cli::cli_main (cognitive 120) · ×24codex-rs/cli/src/main.rs:1053

+ 381 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 4 bodies over 240 down to 240 or less in Cognitive Complexity — start with codex_cloud_tasks::run_main (cognitive 758), App::handle_event (cognitive 676), App::run (cognitive 390). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 4 together lifts Cognitive Complexity from 2.0 to about 3.5/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.

D3 · God Classes7.8 / 10Strong✓ Tool-verified

What it measures: Over-large classes that try to do too much ("god classes").

Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.

Maturity: Documented → Verified → Prevented · effective 7.8 / 10 · rule-coverage 100% · ceiling Prevented

907 god class(es) detected.

MethodTooLong: App.handle_event · ×274codex-rs/tui/src/app/event_dispatch.rs:29
FileTooLong: request_processors/thread_processor.rs · ×250codex-rs/app-server/src/request_processors/thread_processor.rs
FunctionTooLong: codex_cloud_tasks::run_main · ×203codex-rs/cloud-tasks/src/lib.rs:753
ClassTooLong: ThreadRequestProcessor · ×75codex-rs/app-server/src/request_processors/thread_processor.rs:481
TooManyMethods: ChatWidget · ×65codex-rs/tui/src/chatwidget.rs:522

+ 2 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 274 MethodTooLong finding(s) in God Classes — start with mod.rs (15), thread_processor.rs (8), render.rs (6). — One of this dimension's main actionable groups (274 warning-level).
  2. Resolve the 250 FileTooLong finding(s) in God Classes — start with REDACTED (15), mod.rs (10), client.rs (5). — One of this dimension's main actionable groups (250 warning-level).
  3. Resolve the 203 FunctionTooLong finding(s) in God Classes — start with REDACTED (10), turn.rs (5), mod.rs (4). — One of this dimension's main actionable groups (203 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.

D4 · Code Duplication9.7 / 10Stronggated by 721 serious findings✓ Tool-verified

What it measures: Copy-pasted code that should be shared instead.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.

Maturity: Documented → Verified → Prevented · effective 9.7 / 10 · rule-coverage 100% · ceiling Verified

699 duplicated block group(s) detected. A further 22 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 20 of the 721 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.

Duplicated block (7 lines × 2) · ×52codex-rs/app-server-protocol/src/protocol/thread_history.rs:1457
Duplicated block (8 lines × 2) · ×50codex-rs/app-server-transport/src/transport/remote_control/mod.rs:438
Duplicated block (10 lines × 2) · ×49codex-rs/app-server-daemon/src/lib.rs:493
Duplicated block (9 lines × 2) · ×47codex-rs/app-server/src/request_processors/account_processor.rs:725
Duplicated block (11 lines × 2) · ×45codex-rs/app-server-daemon/src/backend/pid.rs:669

+ 124 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 52 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with http.rs (2), mod.rs (2), REDACTED (2). — One of this dimension's main actionable groups (52 warning-level).
  2. Resolve the 50 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with mod.rs (4), markdown_render.rs (4), client.rs (2). — One of this dimension's main actionable groups (50 warning-level).
  3. Resolve the 49 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with REDACTED (2), experimental_features_view.rs (2), multi_select_picker.rs (2). — One of this dimension's main actionable groups (49 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.

D5 · Coupling7.4 / 10Strong✓ Tool-verified

What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.

Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.

Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 7.4 / 10 · rule-coverage 100% · ceiling Prevented

183 production modules (Cargo+npm+Python+Bazel), 0 dependency cycle(s), 18 unstable depended-on module(s). Read from the build's own module declarations; 39 module(s) off the main sequence, with abstractness counted on 145 of the 183 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).

Off the main sequence: codex-backend-openapi-models · ×38
Unstable project codex-app-server
Unstable project codex-app-server-client
Unstable project codex-app-server-transport
Unstable project codex-cloud-tasks

+ 15 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 38 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (38 warning-level).
  2. Resolve the 1 Unstable project codex-app-server finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 Unstable project codex-app-server-client finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
  4. Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.

D6 · Cohesion (LCOM4)9.9 / 10Stronggated by 16 serious findings✓ Tool-verified

What it measures: Whether a class's methods are focused on a single responsibility.

Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.

Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 9.9 / 10 · rule-coverage 100% · ceiling Verified

16 of 1365 classes have LCOM4 above 3.

Low cohesion: LocalThreadStore (LCOM4 40) · ×16codex-rs/thread-store/src/local/mod.rs:147

What to do

  1. Resolve the 16 Low cohesion finding(s) in Cohesion (LCOM4) — start with extension.rs (3), mod.rs (2), client.rs (2). — One of this dimension's main actionable groups (16 warning-level).
  2. Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.

D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.

Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

22333 test methods: 18173 unit, 4140 integration, 0 BDD, 20 e2e. The JavaScript/TypeScript suite contributes 46 `it`/`test` case(s) across 6 test file(s) declaring at least one; its tier split is read from package names and paths only. The Rust suite contributes 21789 `#[test]` function(s) across 2679 file(s) declaring at least one; its unit/integration split is Cargo's own — 665 of those file(s) are integration-test targets under a crate's tests/ directory, and the rest are #[test] functions compiled into the crate they test. The Python suite contributes 498 test function(s) across 40 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

D10 · Test Quality9.3 / 10Stronggated by 2 serious findings✓ Tool-verified

What it measures: Whether the tests truly assert behaviour rather than just running the code.

Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.

Maturity: Documented → Verified → Prevented · effective 9.3 / 10 · rule-coverage 100% · ceiling Prevented

0 skipped, 2 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 46 tests. Measured on the JavaScript/TypeScript suite only — at least 2,289 test source file(s) (.py, .rs) went unread, so its test quality is unmeasured and is not in these counts.

No assertions: does not introduce shipping, intermediate, or modern official conformance regressions · ×2sdk/typescript/tests/mcpConformance.test.ts:39

What to do

  1. Resolve the 2 No assertions finding(s) in Test Quality — start with mcpConformance.test.ts (2). — One of this dimension's main actionable groups (2 warning-level).
  2. Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.

D12 · Dependency Hygiene8.0 8.0 / 10Strong✓ Tool-verified

What it measures: Whether dependencies are current, secure, and not bloated.

Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.

Maturity: Documented → Verified → Prevented · effective 8.0 / 10 · rule-coverage 100% · ceiling Verified

92 outdated, 0 yanked direct Cargo dependencies. 237 of 238 direct crates were graded against crates.io (0 not published there, 1 not resolved by a committed REDACTED). Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.

Outdated: anyhow · ×92

What to do

  1. Improve Dependency Hygiene — currently 8.0/10. — 92 outdated, 0 yanked direct Cargo dependencies. 237 of 238 direct crates were graded against crates.io (0 not published there, 1 not resolved by a committed REDACTED). Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.

Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.

D13 · Secret Scanning10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.

Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

Secret scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

D14 · License Compliance10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether the licenses of third-party packages are compatible with your policy.

Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 1274 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's REDACTED closed over its manifests' `[dependencies]` and `[build-dependencies]`. Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. A further 11 crate(s) in the closure resolve from git, a path or a private registry and publish no licence this pass can read; they are outside this verdict. This repository publishes itself under Apache-2.0, which is its own choice and is not judged here. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares package.json and a Python REDACTED/requirements.txt (pip/uv/Poetry), and the licences of those dependency graphs were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots9.1 / 10Stronggated by 410 serious findings✓ Tool-verified

What it measures: Files that change often and are also complex — the riskiest hotspots.

Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.

Maturity: Documented → Verified → Prevented · effective 9.1 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: codex-rs/tui/src/app/event_dispatch.rs (171×622=106362); codex-rs/tui/src/app/startup.rs (100×207=20700); codex-rs/core/src/session/session.rs (185×97=17945)

Hotspot: codex-rs/tui/src/app/event_dispatch.rs · ×410codex-rs/tui/src/app/event_dispatch.rs:29

What to do

  1. Resolve the 410 Hotspot finding(s) in Churn × Complexity Hotspots — start with REDACTED (13), mod.rs (11), render.rs (6). — One of this dimension's main actionable groups (410 warning-level).

Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.

D16 · Bus Factor9.0 / 10Strong✓ Tool-verified

What it measures: Whether knowledge is concentrated in too few people (the "bus factor").

Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.

Maturity: Documented → Verified → Prevented · effective 9.0 / 10 · rule-coverage 100% · ceiling Documented

250 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is codex-rs/tui/src/ide_context/ipc.rs. Counted over 2511 of the 3339 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Off-boarding risk: anonymized user #1 · ×24
Further sole-owners (lower concentration)

What to do

  1. Resolve the 24 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (24 recommendation-level).
  2. Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.

D17 · Explicit Debt9.9 / 10Stronggated by 281 serious findings✓ Tool-verified

What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.

Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.

Maturity: Documented → Verified → Prevented · effective 9.9 / 10 · rule-coverage 100% · ceiling Prevented

281 deducted task-comment markers across 1104646 LoC (0.0/KLoC) → score 9.9. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.

TodoComment · ×280sdk/typescript/tests/run.test.ts:553
FixmeCommentcodex-rs/core-plugins/src/executor_hooks.rs:121

What to do

  1. Resolve the 280 TodoComment finding(s) in Explicit Debt — start with unified_exec.rs (28), rmcp_client.rs (15), permissions.rs (11). — One of this dimension's main actionable groups (280 warning-level).
  2. Resolve the 1 FixmeComment finding(s) in Explicit Debt — start with executor_hooks.rs. — One of this dimension's main actionable groups (1 warning-level).
  3. Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.

D19 · Documentation Quality10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether the project's documentation is clear, complete, and useful.

Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

1 of 1 documentation facets pass in full. 71 document(s) read across 1 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

D20 · ADR Quality0.0 / 10Critical✓ Tool-verified

What it measures: Whether architecture decisions are recorded well (context, decision, consequences).

Method: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

No architecture decision records were found.

No ADRs found

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.

D26 · Project Cohesion8.8 / 10Strong✓ Tool-verified

What it measures: Whether each project is a focused, coherent unit rather than an oversized grab-bag.

Method: Project size overshoot penalties (LoC / public-type count / namespace count, 2-of-3 flag) weighted by log magnitude. Exhaustive across projects, deterministic, LLM-independent.

Maturity: Documented → Verified → Prevented · effective 8.8 / 10 · rule-coverage 100% · ceiling Documented

10 of 169 build units (Cargo, Python, npm) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

  1. Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.

D28 · Secrets (history)10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.

Method: Secret scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

gitleaks scanned the full history AND the current working tree and found no secrets.

✓ On the Gold path — maintain.

Detailed fixes: d28_recommendation.md.

D29 · Static Analysis (SAST)0.1 / 10Critical✓ Tool-verified

What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.

Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.

Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).

Maturity: Documented → Verified → Prevented · effective 0.1 / 10 · rule-coverage 100% · ceiling Documented

35 finding(s): 0 critical, 28 high, 4 medium, 3 low. semgrep hit a parse error in 26 file(s) — `.github/workflows/zstd` (line 4), `codex-rs/app-server-daemon/src/release_pruning.rs` (line 60), `codex-rs/app-server/src/request_processors/account_processor/workspace_routing.rs` (line 289), `codex-rs/core/src/context/world_state/mod.rs` (line 364), `codex-rs/core/src/context_manager/history.rs` (line 1222), … (+21 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 12 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 4 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 18 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (7), REDACTED (5), REDACTED (4). — One of this dimension's main actionable groups (18 issue-level).
  2. Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4). — One of this dimension's main actionable groups (4 issue-level).
  3. Resolve the 3 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (3 issue-level).

Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.

D30 · Dependency Vulnerabilities0.0 / 10Critical✓ Tool-verified

What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.

Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

66 finding(s): 2 critical, 21 high, 41 medium, 2 low.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 3 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 19 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (14), REDACTED (3), REDACTED (2). — One of this dimension's main actionable groups (19 issue-level).
  2. Resolve the 2 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
  3. Resolve the 2 High vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).

Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.

D31 · IaC & Container Security9.6 / 10Adequategated by 1 critical finding✓ Tool-verified

What it measures: Whether Dockerfiles / Terraform / Kubernetes config follow security best practices.

Method: IaC/container misconfiguration scan via trivy config (Dockerfile/Terraform/K8s/Helm/CloudFormation); severity rules to 0-10 moderate normalizer. NotApplicable without manifests. Exhaustive, deterministic.

Maturity: Documented → Verified → Prevented · effective 9.6 / 10 · rule-coverage 100% · ceiling Documented

2 finding(s): 0 critical, 1 high, 1 medium, 0 low.

REDACTED
REDACTED

What to do

  1. Resolve the 1 High IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 1 Medium IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.

D34 · Knowledge Freshness10.0 / 10Adequategated by 1 critical finding✓ Tool-verified

What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.

Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

10 of 2511 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is codex-rs/cloud-tasks/src/ui.rs. Counted over 2511 of the 3339 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledgecodex-rs/cloud-tasks/src/ui.rs:1
Orphaned file · ×9codex-rs/utils/stream-parser/src/tagged_line_parser.rs:1
Further orphaned files (smaller)

What to do

  1. Resolve the 1 Orphaned knowledge finding(s) in Knowledge Freshness — start with ui.rs. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 9 Orphaned file finding(s) in Knowledge Freshness — start with REDACTED (2), tagged_line_parser.rs, scrollable_diff.rs. — One of this dimension's main actionable groups (9 recommendation-level).
  3. Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.

D35 · Change Coupling9.6 / 10Stronggated by 69 serious findings✓ Tool-verified

What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.

Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.

Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.

Maturity: Documented → Verified → Prevented · effective 9.6 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: realtime.rs↔realtime_conversation.rs 100%; event_dispatch.rs↔windows_sandbox.rs 90%; plugins.rs↔tests.rs 88%

Change coupling: realtime.rs ↔ realtime_conversation.rs · ×56codex-rs/app-server-protocol/src/protocol/v2/realtime.rs:1
Change-coupling hub: windows_sandbox.rs → config_persistence.rs, event_dispatch.rs, permission_popups.rs, windows_sandbox_prompts.rs · ×13codex-rs/tui/src/windows_sandbox.rs

What to do

  1. Resolve the 56 Change coupling finding(s) in Change Coupling — start with extension.rs (2), mcp.rs (2), app_event.rs (2). — One of this dimension's main actionable groups (56 warning-level).
  2. Resolve the 13 Change-coupling hub finding(s) in Change Coupling — start with tests.rs (3), mod.rs (2), windows_sandbox.rs. — One of this dimension's main actionable groups (13 warning-level).

Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.

D36 · Supply-chain Provenance & Signing7.5 / 10Strong✓ Tool-verified

What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.

Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.

Maturity: Documented → Verified → Prevented · effective 7.5 / 10 · rule-coverage 100% · ceiling Documented

3/4 supply-chain integrity signals present (provenance, signing, SBOM, pinned actions).

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 7 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (7 warning-level).
  2. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.

D37 · Vulnerability-disclosure Policy10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.

Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

A vulnerability-disclosure policy (SECURITY.md) is published with a reporting contact.

✓ On the Gold path — maintain.

Detailed fixes: d37_recommendation.md.

D43 · Malicious Dependencies10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.

Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No dependency in any ecosystem this repository declares is published as malicious.

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

D44 · Platform End-of-Life10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.

Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 4 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.

✓ On the Gold path — maintain.

Detailed fixes: d44_recommendation.md.

Frontend & cross-cutting dimensions

R = React/JS · M = Maturity · P = Readiness.

AC2 · Forms & labels10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.

Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

AC3 · Page structure5.0 / 10Adequate✓ Tool-verified

Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.

Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×2) — codex-rs/login/src/assets/error.html:2, codex-rs/login/src/assets/success_legacy.html:2

What to do

  • Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
AC5 · ARIA correctness10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.

Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

AC6 · Visual & motion safety4.3 / 10Weak✓ Tool-verified

Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.

Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.

Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • `.form-range` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — codex-rs/tui/assets/inline_visualization/visualize.css:771
  • `.form-switch .form-check-input::before` moves (`transition: transform 200ms cubic-bezier(0, 0, 0.2, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — codex-rs/tui/assets/inline_visualization/visualize.css:748

What to do

  • Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
AC7 · A11y enforcement4.0 / 10Weak✓ Tool-verified

Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.

Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.

Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.

  • No accessibility enforcement found — no a11y linter (an accessibility check that can read your UI — no component framework was detected and your pages are rendered by server-side templates, which neither the JSX/Vue ESLint plugins nor the HTML-template linters can parse; run axe/pa11y over the rendered pages, or assert the accessibility invariants over that rendered HTML in the test suite you already have) and no axe/pa11y/Lighthouse in tests or CI. Start by running that check over your rendered pages in CI. What was searched, so you can tell an absence from a miss: the 4 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.

What to do

  • Enforce accessibility in the toolchain: add an accessibility check that can read your UI — no component framework was detected and your pages are rendered by server-side templates, which neither the JSX/Vue ESLint plugins nor the HTML-template linters can parse; run axe/pa11y over the rendered pages, or assert the accessibility invariants over that rendered HTML in the test suite you already have, then assert with jest-axe in tests, then gate axe/pa11y/Lighthouse in CI.
AX10 · Code composition9.6 / 10Exemplary✓ Tool-verified

Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.

Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.

Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.

What to do

  • The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).

Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.

AX4 · Dependency direction7.6 / 10Strong✓ Tool-verified

Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.

Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.

  • `codex-core` is a Domain project but references `codex-api`, a Web project. The clean-architecture rule is that dependencies point INWARD — the domain/application core must not depend on outer layers (infrastructure/web). Invert it: define the abstraction in the inner layer and implement it in the outer one.
  • `codex-core` is a Domain project but references `codex-extension-api`, a Web project. The clean-architecture rule is that dependencies point INWARD — the domain/application core must not depend on outer layers (infrastructure/web). Invert it: define the abstraction in the inner layer and implement it in the outer one.
  • `codex-model-provider` is a Domain project but references `codex-api`, a Web project. The clean-architecture rule is that dependencies point INWARD — the domain/application core must not depend on outer layers (infrastructure/web). Invert it: define the abstraction in the inner layer and implement it in the outer one.

What to do

  • Keep dependencies pointing inward: domain/application define interfaces, infrastructure/web implement them (Dependency Inversion).
AX5 · Architecture & structure10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether the codebase has a recognisable, scale-appropriate structure (a named architectural style, or modular enough for its size) rather than being an ad-hoc ball of mud.

Method: Roslyn plus csproj analysis: architecture style detection (DDD, clean, vertical-slice, CQRS) and structure fitness for repo size. Deterministic.

AX8 · Test isolation7.5 / 10Strong✓ Tool-verified

Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.

Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.

  • `codex-cli` (production) references the test project `codex-app-server-test-client`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.

What to do

  • Remove every production → test project reference: extract any shared test helper into a production support library (which the tests reference), or invert the dependency so the test project depends on production — not the reverse.
AX9 · CQS / query purity10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.

Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.

Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.

  • `LocalSecretsBackend.load_or_create_passphrase` performs a durable write on a read path (a persist to a store/repository). The name announces the lazy initialisation, so the write is deliberate — the risk is that callers who only meant to READ still trigger it. Expose a read-only variant that returns nothing when the value is absent, and keep this one for the callers that genuinely want the create. — codex-rs/secrets/src/local.rs:267

What to do

  • Keep query handlers read-only — move the writes/event-publishes into a command handler so reads stay safe to retry, cache, and route to a read replica.
C2 · Access Controls10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.

Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.

DM4 · Rich vs anemic domain model8.0 / 10Strong✓ Tool-verified

Other · Domain Modelling — Whether domain entities own their behaviour (invariant-enforcing commands) rather than being data-only structs driven by a foreign service.

Method: Roslyn (DDD-gated): entity method BODIES classified mutator-vs-query — only methods that mutate the entity's own declared state count as invariant-protecting behaviour, so a getter/passthrough doesn't rescue an anemic class. Deterministic, exhaustive over domain-layer entities.

Coverage: Population: entities by name/base convention; rich-vs-anemic judged by classifying each method body mutator-vs-query — logic-bearing domain types outside the convention are invisible.

  • `Completion` is a data-only domain entity with `pub` mutable state and no invariant-enforcing behaviour of its own, while the repo holds the logic in a foreign service/manager/use-case — the anemic domain model. Move the behaviour onto the entity so it enforces its own invariants (or make it an immutable value object with private fields) rather than being driven from outside. — codex-rs/core/src/unified_exec/oneshot.rs:21

What to do

  • Move the domain logic onto the entity (invariant-enforcing `&mut self` commands) instead of a foreign service.
DM5 · Encapsulated state10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether a domain type's identity-bearing field stays immutable — a `pub` mutable field under a hand-rolled Hash/PartialEq breaks the value-identity invariant.

Method: Roslyn (DDD-gated): entities scanned for publicly writable state — public setters, and (C#/VB) own mutable collections handed out through an auto-property, a public field or a bare-field expression getter, where a computed/copying getter is never charged. One finding per entity; score softened when Marten/EF rehydration frameworks present. Deterministic, framework-aware.

Coverage: Population: entities by convention; encapsulation (setter shape) checked exhaustively within the set.

DM6 · Domain ↔ infrastructure boundary10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies — a domain aggregate fused to a persistence ORM (diesel/sea-orm/sqlx) on its own declaration (active-record) couples the domain to infrastructure. The clean-architecture dependency rule.

Method: Roslyn (DDD-gated): domain-layer types scanned for infrastructure usage in member SIGNATURES and inside method/accessor BODIES — resolved calls and object-creations into EF/Marten/HTTP/Mongo/Redis/message-bus types (not just a namespace allowlist). Deterministic, symbol-resolved, exhaustive over domain-layer bodies, DDD-native.

Coverage: Domain layer identified by NAMESPACE heuristic; infrastructure then resolved by symbol in member SIGNATURES and method/accessor BODIES — rename the layer and the check evaporates.

ES1 · Fold determinism10.0 / 10Exemplary✓ Tool-verified

Other · Event Sourcing — Whether the recovery-replay fold is deterministic — state derived purely from each event's own fields, no clock/random/IO on the replay path.

Method: Roslyn syntax scan (event-sourcing gated): Apply/When folds checked for forbidden tokens (DateTime.Now, Guid.NewGuid, Random, IO), stripped of comments/strings. Deterministic, hard fact per fold.

ES2 · Immutable events10.0 / 10Exemplary✓ Tool-verified

Other · Event Sourcing — Whether domain events stay immutable (private fields, set once) rather than carrying mutable state.

Method: Roslyn scan (event-sourcing gated): persisted events checked for public setters; immutability verified per property/field. Deterministic, hard fact.

M1 · Documentation (README)7.2 / 10Strong✓ Tool-verified

Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.

Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.

What to do

  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
  • Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
  • Add a README to the 130 of 173 project(s) that lack one — worth up to 1.5 pts.
M2 · Architecture documentation5.0 / 10Adequate✓ Tool-verified

Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.

Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.

  • No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.

What to do

  • Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repo is organised deliberately — src/test separation and consistent project naming.

Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.

M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).

Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.

P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether an automated pipeline builds and tests every change.

Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.

P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.

Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.

P2 · Observability9.5 / 10Exemplary✓ Tool-verified

Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.

Method: Filesystem/Roslyn scan: structured-logging frameworks (Serilog, NLog), OpenTelemetry, and health-check endpoint patterns. Exhaustive, deterministic.

  • Only 72/87 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `codex-cli`, `codex-rs/apply-patch`, `codex-rs/bwrap`, `codex-rs/config-schema` and 10 more.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
P3 · Security & performance tooling8.0 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).

Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.

What to do

  • Dependabot is configured but does not watch `npm`, `pip` — add those `package-ecosystem` entries to .github/dependabot.yml so those dependencies get the same automatic update and advisory pressure as the ones it already covers.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback7.0 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.

Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.

P6 · Release Hygiene10.0 / 10Exemplary✓ Tool-verified

Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.

Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.

P7 · Outbound HTTP resilience3.0 / 10Weak✓ Tool-verified

Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.

Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.

  • `reqwest::Client::new(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — codex-rs/http-client/src/client_builder.rs:356
  • `reqwest::Client::builder(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — codex-rs/http-client/src/client_builder.rs:382
  • `urllib.request.urlopen(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×3) — REDACTED:163, REDACTED:191, REDACTED:223

What to do

  • Give every client a whole-request bound: `reqwest::Client::builder().timeout(Duration::from_secs(10))` (never `reqwest::get` or `Client::new()`, which have none), ureq's `timeout_global`, or wrap the call in `tokio::time::timeout`; add retry with back-off (`reqwest-retry`'s `RetryTransientMiddleware`, `backoff`) around dependencies that fail.
  • Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.
P8 · Schema migrations10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether database schema changes go through versioned migrations rather than being auto-created from the model at startup.

Method: Roslyn scan: EF Core DbContext for a versioned migrations directory versus bare EnsureCreated usage; off .NET, a file scan of dependency manifests, migration histories (Flyway, Liquibase, Alembic, Django, Rails, Prisma, TypeORM, Knex/Sequelize, golang-migrate, goose, Laravel, Doctrine, Diesel/sqlx) and schema auto-create in production source or config. Exhaustive, deterministic.

PF1 · Benchmark discipline9.0 / 10Exemplary✓ Tool-verified

Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.

Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.

PF3 · Async & latency hygiene8.5 / 10Strong✓ Tool-verified

Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.

Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from the language model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.

  • `run_upgrade` is async and calls block_on — a blocking call inside async code stalls the executor thread, and every task scheduled on it for as long as it runs. — codex-rs/cli/src/marketplace_cmd.rs:367

What to do

  • Rust: `.await` the future instead of `block_on` (on a Tokio runtime thread it panics outright) and use `tokio::time::sleep(..).await` instead of `std::thread::sleep`; where synchronous code must run, move it to `tokio::task::spawn_blocking` or `block_in_place`.
R1 · Type Safety9.5 / 10Exemplary✓ Tool-verified

React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.

Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.

What to do

  • Migrate the remaining .js/.jsx files to TypeScript.
R10 · Code Duplication9.4 / 10Exemplary✓ Tool-verified

React / JS · Code Health — Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm over JS/TS tokens, D-386): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.

Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Deterministic.

  • codex-cli/bin/codex.js:25 · sdk/typescript/src/exec.ts:357 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — codex-cli/bin/codex.js:25
  • codex-cli/bin/codex.js:267 · codex-rs/responses-api-proxy/npm/bin/codex-responses-api-proxy.js:83 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — codex-cli/bin/codex.js:267

What to do

  • Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
R2 · Cyclomatic Complexity8.9 / 10Strong✓ Tool-verified

React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.

Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.

  • run has cyclomatic complexity 42 and cognitive complexity 50; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — sdk/typescript/src/exec.ts:94
  • findCodexPath has cyclomatic complexity 16 and cognitive complexity 12; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — sdk/typescript/src/exec.ts:356
  • detectPackageManager has cyclomatic complexity 13 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — codex-cli/bin/codex.js:177
  • toTomlValue has cyclomatic complexity 12 and cognitive complexity 19; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — sdk/typescript/src/exec.ts:314
  • flattenConfigOverrides has cyclomatic complexity 12 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — sdk/typescript/src/exec.ts:274
  • determineTargetTriple has cyclomatic complexity 11 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — codex-rs/responses-api-proxy/npm/bin/codex-responses-api-proxy.js:12

What to do

  • Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
R3 · Large Files6.4 / 10Adequate✓ Tool-verified

React / JS · Code Health — How many source files exceed the large-file threshold.

Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.

  • sdk/typescript/src/exec.ts has 444 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — sdk/typescript/src/exec.ts:1

What to do

  • Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
R4 · Test Coverage5.7 / 10Adequate✓ Tool-verified

React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.

Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.

  • No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×3) — codex-cli/bin/codex.js:1, codex-rs/responses-api-proxy/npm/bin/codex-responses-api-proxy.js:1, codex-rs/code-mode-runtime/src/runtime/settled.js:1

What to do

  • Add tests that import the unreached modules (directly or through their public entry).
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified

React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.

Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.

R7 · Dead Code9.9 / 10Exemplary✓ Tool-verified

React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).

Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.

  • Nothing in its class reads or assigns this private field (for a constructor parameter property: it is stored and never read), and no string key or test reaches it by name. Remove it, or use it where it was meant to take effect. — sdk/typescript/src/thread.ts:70
R8 · Dependency Hygiene6.0 / 10Adequate✓ Tool-verified

React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.

Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.

  • Imported but not declared in any reachable package.json — installs work only by hoisting accident. (×2) — sdk/typescript/eslint.config.js:1, sdk/typescript/tests/setupCodexHome.ts:5

What to do

  • Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
R9 · Circular Imports10.0 / 10Exemplary✓ Tool-verified

React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.

Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.

S1 · Web-Security Posture0.0 / 10Critical✓ Tool-verified

Other · Security — Read from this repository's Rust source: cryptographic hygiene (weak hash or cipher, key material fixed in the source) and outbound TLS (certificate validation, protocol version) — facts about code that hold whether or not it serves anything itself. Markup this repository SHIPS is scored for third-party script integrity whether or not the repository serves it itself, since a page handed to a consumer runs in that consumer’s origin. This repository serves HTTP itself (`axum::serve(` (codex-rs/tui/src/dynamic_tools_mcp.rs:203)), so its Rust source was also read for the server controls: TLS served or HSTS set, security response headers, cookie flags and inbound validation — each credited where its Rust spelling appears in production source, not proven on every route. A Rocket 0.5 application is credited the headers Rocket's default `Shield` sends unless it attaches its own, and its cookie jar's SameSite=Strict default; a session middleware its default cookie flags.

Method: Roslyn plus filesystem scan: HSTS/security headers, secure cookies, input validation, middleware order, weak crypto (MD5/SHA1/DES); HTTPS-metadata context-aware. On a repository with no .NET source it reads JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Elixir source itself (test, vendored, generated and minified paths not) for the arms that hold whether or not the code serves HTTP: a weak hash or cipher, key material fixed in the source, a TLS client that accepts any certificate, and (JavaScript/TypeScript, Ruby, Scala, Rust and Elixir) an obsolete TLS version; the server controls are not assessed there, and a Dart, Ruby, Scala, Rust or Elixir repository that serves no HTTP of its own is N/A on them. Deterministic.

  • `CLOUD_CONFIG_BUNDLE_CACHE_WRITE_HMAC_KEY` is the secret key and is a compile-time constant, so the secret this operation depends on is published with the source. A key that ships with the source is not secret: every contributor, fork, mirror and released binary carries it, so anyone holding the repository can decrypt what any installation encrypted, and there is no way to invalidate what was already protected because every deployment built from this source shares the value. Where the constant is a password salt the consequence differs but is no smaller — one global salt means precomputation amortises across every installation, which is the property salting exists to destroy. Read the value from configuration, an environment variable or a secrets manager at startup and FAIL FAST when it is absent, so a missing key stops the process instead of silently falling back to a shared default; treat the committed value as disclosed and rotate it rather than only deleting the line. For a salt, generate a fresh random one per password and store it alongside the hash. — codex-rs/cloud-config/src/cache.rs:31
  • MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call. (×11) — codex-rs/analytics/src/accepted_lines.rs:64, codex-rs/analytics/src/reducer.rs:1480, codex-rs/analytics/src/reducer.rs:4146, …
  • `https://unpkg.com/@floating-ui/core@1.7.3/dist/floating-ui.core.umd.min.js` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. 3 such include(s) across the repository's markup. — codex-rs/tui/assets/inline_visualization/visualize.html:2
  • None of the 11 security response headers the OWASP Secure Headers Project recommends (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options, …) is set on a response this repository's Rust server sends — defense in depth, even when a proxy could set them. (−2.0 on this card.) The server: `axum::serve(` (codex-rs/tui/src/dynamic_tools_mcp.rs:203).

What to do

  • Load cryptographic key and salt material from configuration, an environment variable or a secrets manager rather than fixing it in the source, and fail fast at startup when it is absent — a default that silently works is the one that reaches production. Rotate anything already committed: it must be treated as disclosed. Salts should be generated per password and stored with the hash, never shared across installations.
  • Review each MD5/SHA1 use by what it protects: replace it with SHA-256+ (or a KDF for passwords) where the digest is security-relevant, and switch it to a non-cryptographic hash (xxhash, murmurhash) where it only derives an identifier such as a cache key. This repository constructs a collision-broken hash (MD5/SHA1) at 11 sites, not one: `codex-rs/analytics/src/accepted_lines.rs:64` (`Sha1::new`), `codex-rs/analytics/src/reducer.rs:1480` (`Sha1::digest`), `codex-rs/analytics/src/reducer.rs:4146` (`Sha1::new`), `codex-rs/codex-mcp/src/tool_catalog_cache.rs:381` (`Sha1::new`), `codex-rs/codex-mcp/src/tool_catalog_cache.rs:448` (`Sha1::new`), `codex-rs/codex-mcp/src/tools.rs:237` (`Sha1::new`), `codex-rs/connectors/src/connector_runtime/persistence.rs:228` (`Sha1::new`), `codex-rs/connectors/src/directory_cache.rs:109` (`Sha1::new`), and 3 further site(s). Each is a separate decision — fixing only the line this row cites leaves the others in place.
  • Pin third-party scripts and verify them: name an exact version in the URL and add an `integrity="sha384-…"` hash alongside `crossorigin="anonymous"` (both are required — an integrity hash on a cross-origin script without `crossorigin` is not evaluated, it blocks the script). Where the vendor ships a continuously-updated loader and publishes no stable hash (tag managers, analytics, chat widgets), Subresource Integrity is not available: constrain it instead with a `Content-Security-Policy` that names the exact origins allowed to execute, and drop the script from the pages that do not need it. Where the page is shipped inside a package that others host, prefer vendoring the asset and serving it from the app’s own origin, so no consumer inherits a third-party dependency they did not choose.
  • Set security response headers on what the server sends — actix-web's `DefaultHeaders::new().add((header::X_CONTENT_TYPE_OPTIONS, "nosniff"))`, tower-http's `SetResponseHeaderLayer::overriding(…)` on an axum router, or keep Rocket's default `Shield` — with `Content-Security-Policy`, `X-Content-Type-Options` and a frame policy on every response.
X1 · Async correctness10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.

Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.

X12 · Unreachable branch10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.

Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.

X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.

Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.

X14 · Bypassable address classification10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.

Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.

X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.

Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.

X16 · Unfloored truncation loop10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.

Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.

X17 · Uncapped recursion over a caller-supplied document3.5 / 10Weak✓ Tool-verified

Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.

Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.

  • `map_jsonrpc_error` is public, takes a document from its caller (line 86) and hands it to `_is_server_overloaded`, which calls itself at line 77 (`_is_server_overloaded`) with a piece of `data` (and at line 81) — and nowhere in `_is_server_overloaded` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_is_server_overloaded` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — sdk/python/src/openai_codex/errors.py:77

What to do

  • Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
X18 · Disposal-pattern correctness10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.

Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.

X19 · Unrestored process-global state10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.

Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.

X21 · Side-effecting pattern guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.

Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.

X22 · Contradicted release guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back.

Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.

X23 · Unguarded diagnostic materialisation10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.

Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.

X24 · Document value interpolated into markup unescaped10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.

Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.

X25 · Inert configuration knob10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.

Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.

X26 · Unsynchronised callback handoff10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.

Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.

X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `for` loop leaves the `RefCell` it is walking alone — safe Rust rejects a body that changes the collection its loop borrows at compile time, except through interior mutability: a `RefCell` borrowed in the loop's header stays borrowed until the loop ends, so a `borrow_mut()` of it inside the body panics with `already borrowed: BorrowMutError` and the remaining elements are never seen. Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.

Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.

X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.

Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.

X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.

Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.

X3 · Exception handling6.0 / 10Adequate✓ Tool-verified

Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.

Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.

  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×7) — sdk/typescript/src/exec.ts:261, sdk/typescript/src/outputSchemaFile.ts:24, sdk/python/src/openai_codex/client.py:576, …
  • `except BaseException` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×2) — sdk/python/src/openai_codex/async_client.py:273, sdk/python/src/openai_codex/async_client.py:320

What to do

  • Swallowed exception (empty catch)
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.

Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.

X4 · Structured logging3.5 / 10Weak✓ Tool-verified

Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.

Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.

  • `error!` at line 68 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/app_event_sender.rs:68
  • `warn!` at line 1251 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/app_server_session.rs:1251
  • `warn!` at line 1262 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/app_server_session.rs:1262
  • `error!` at line 1888 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/chatwidget.rs:1888
  • `debug!` at line 301 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/clipboard_copy.rs:301
  • `debug!` at line 306 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/clipboard_copy.rs:306
  • `debug!` at line 72 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/clipboard_paste.rs:72
  • `debug!` at line 89 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/clipboard_paste.rs:89
  • `debug!` at line 182 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/clipboard_paste.rs:182
  • `debug!` at line 224 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/clipboard_paste.rs:224
  • `debug!` at line 228 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/clipboard_paste.rs:228
  • `debug!` at line 232 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/clipboard_paste.rs:232
  • `warn!` at line 195 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/custom_terminal.rs:195
  • `warn!` at line 95 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/file_search.rs:95
  • `error!` at line 1218 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/lib.rs:1218
  • `error!` at line 1477 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/lib.rs:1477
  • `warn!` at line 59 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. (×2) — codex-rs/tui/src/session_log.rs:59, codex-rs/tui/src/startup_hooks_review.rs:59
  • `warn!` at line 63 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/session_log.rs:63
  • `warn!` at line 67 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/session_log.rs:67
  • `warn!` at line 70 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/session_log.rs:70
  • `error!` at line 105 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/session_log.rs:105
  • `warn!` at line 132 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/session_start.rs:132
  • `warn!` at line 944 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/startup_orchestration.rs:944
  • `warn!` at line 441 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/tui.rs:441
  • `warn!` at line 458 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/tui.rs:458
  • `warn!` at line 465 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/tui.rs:465
  • `warn!` at line 511 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/tui.rs:511
  • `warn!` at line 577 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/tui.rs:577
  • `warn!` at line 602 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/tui.rs:602
  • `warn!` at line 989 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/tui.rs:989
  • `warn!` at line 992 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/tui.rs:992
  • `warn!` at line 1007 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/tui.rs:1007
  • `warn!` at line 1010 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/tui.rs:1010
  • `warn!` at line 123 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/unarchive_prompt.rs:123
  • `error!` at line 97 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/update_prompt.rs:97
  • `error!` at line 47 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/updates.rs:47
  • `debug!` at line 238 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/render/highlight.rs:238
  • `warn!` at line 1115 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/onboarding/auth.rs:1115
  • `error!` at line 872 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — codex-rs/tui/src/onboarding/onboarding_screen.rs:872

What to do

  • Interpolated log message defeats structured logging
X5 · Nullable reference types10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.

Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.

WCAG coverage — what static analysis assessed

Statically assessed 10 of 55 WCAG 2.2 Level A/AA success criteria (18%; ≈20% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 45 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).

DimensionWCAG 2.2 A/AA criteriaCoverage
AC2 · Forms & labels1.3.1, 3.3.2, 4.1.2Partial signal
AC3 · Page structure1.4.4, 2.2.1, 2.4.1, 2.4.2, 3.1.1, 4.1.2Partial signal
AC5 · ARIA correctness4.1.2Partial signal
AC6 · Visual & motion safety1.4.3, 2.4.7Partial — literal CSS only
AC7 · A11y enforcementenforcement — no page criterionEnforcement posture (process)

Not statically assessed — these 45 Level A/AA criteria need runtime or manual evaluation (WCAG-EM): 1.1.1, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.4.1, 1.4.2, 1.4.5, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 2.1.1, 2.1.2, 2.1.4, 2.2.2, 2.3.1, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.11, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.7, 2.5.8, 3.1.2, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.6, 3.3.1, 3.3.3, 3.3.4, 3.3.7, 3.3.8, 4.1.3.

Reference — by lens

The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.

LensScoreRatingImpact
Code Health63%Adequate — gated by D2, X4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture85%StrongSolid.
Maturity76%StrongSolid.
Readiness62%Adequate — gated by P7Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security47%Weak — gated by D29, D30, S1Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Domain Modelling91%ExemplarySolid.
Event Sourcing100%ExemplaryStrongest area.
Accessibility57%AdequateAcceptable, with room to improve.
Performance87%StrongSolid.
Unscored — 3 check(s) recorded observations but carry no score

These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.

  • X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 35 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X9 Subsumed condition operand — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 control(s) we could not find positive evidence for

These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.

  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 45 check(s) not relevant to this codebase

These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.

  • AC1 Text alternatives — No image/media element found in the parsed markup — AC1 not applicable here.
  • AC4 Keyboard semantics — No interactive element found in the parsed markup — AC4 not applicable here.
  • AX1 Captive dependencies — Not applicable: this repository's JavaScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; Rust with no dependency-injection crate has no container to hand one lifetime's instance to another — every value is owned by the code that builds it, and the borrow checker rejects a longer-lived value keeping a borrow of a shorter-lived one; this repository's TypeScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
  • AX6 Interface segregation — no exported interface declares behaviour
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — the service did not build — `cargo build --locked --bin 'codex-app-server'` exited 1: info: syncing channel updates for 1.99.1-x86_64-unknown-linux-gnu error: could not download file from 'https://static.rust-lang.org/dist/channel-rust-1.99.1.toml.sha256' to '/usr/local/rustup/tmp/elfw…; runtime evidence skipped (launch chosen because 'axum' dependency in codex-rs/app-server/Cargo.toml, binary 'codex-app-server') This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
  • C1 Data Protection — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no data at rest for these controls to protect.
  • C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data whose lifetime a retention limit would bound.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D11 Test Reliability — Test reliability not measured — JavaScript/TypeScript suite did not run
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D21 Naming Consistency — Naming consistency is measured on C# only; JavaScript, Python, Rust, TypeScript, html not measured.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed Python, Rust surface was not measured.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ projects each declaring an entity of their own. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C# and Visual Basic comments only — this repository's production source is .py, .rs, .ts, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D25 ADR Conformance — no ADRs to check
  • D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.rs), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not measured — JavaScript/TypeScript suite
  • DM1 Aggregate boundaries — this Rust crate declares no domain aggregate (a struct with private state and its own command methods), so DM1's aggregate-boundary read has no population to be taken over
  • DM2 Strongly-typed ids — the crate defines newtype typed-ids but declares no domain aggregate that could carry an id — so DM2's adoption ratio has no population to be taken over
  • DM3 Integration-event coupling — no integration events detected — coupling check not applicable
  • DM7 Repository granularity — no repository abstraction detected (e.g. uses a document session)
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
  • ED5 Idempotency — Not assessed, and this one is on us: 1 command handler(s) or message consumer(s) were found here, but this check does not yet recognise persistence writes in this repository's language. Idempotency was neither confirmed nor ruled out — this is a limit of the analyzer, not a finding about your code.
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
  • P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • PF2 Allocation hygiene — Not applicable: Rust spells out every heap allocation and makes borrowed slices (&[T], &str) its ordinary parameter types, so the allocation-aware style this card rewards elsewhere is the language's baseline rather than a rung to climb.
  • R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
  • R5 Dependency Freshness — uses a pnpm lockfile — dependency freshness not measured here; JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X2 Cancellation propagation — no C# was loaded; this repository's Python and Rust were read, and no request in it can be cancelled by a caller — a Python request takes no token: asyncio cancels the task and trio or anyio the scope that made it, from outside the call, and requests, httpx, aiohttp and gRPC take a timeout, not a cancellation; a Rust request takes no token: a future is cancelled by dropping it, from outside the call (select!, a timeout, an aborted task), and reqwest, hyper and tonic take none
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.

Critical — 62 finding(s)
D30 · Dependency Vulnerabilities · High CVE · ×19
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
AX4 · Dependency direction · Dependency-rule violation · ×3
  • Dependency-rule violation: codex-core (Domain) → codex-api (Web) — `codex-core` is a Domain project but references `codex-api`, a Web project. The clean-architecture rule is that dependencies point INWARD — the domain/application core must not depend on outer layers (infrastructure/web). Invert it: define the abstraction in the inner layer and implement it in the outer one.
  • Dependency-rule violation: codex-core (Domain) → codex-extension-api (Web) — `codex-core` is a Domain project but references `codex-extension-api`, a Web project. The clean-architecture rule is that dependencies point INWARD — the domain/application core must not depend on outer layers (infrastructure/web). Invert it: define the abstraction in the inner layer and implement it in the outer one.
  • Dependency-rule violation: codex-model-provider (Domain) → codex-api (Web) — `codex-model-provider` is a Domain project but references `codex-api`, a Web project. The clean-architecture rule is that dependencies point INWARD — the domain/application core must not depend on outer layers (infrastructure/web). Invert it: define the abstraction in the inner layer and implement it in the outer one.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Critical CVE · ×2
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · High vulnerability · ×2
  • REDACTED
  • REDACTED
AX8 · Test isolation · Production project references a test project · ×1
  • Production project references a test project: codex-cli → codex-app-server-test-client — `codex-cli` (production) references the test project `codex-app-server-test-client`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
AX9 · CQS / query purity · Query writes persistent state on the read path · ×1
  • Query writes persistent state on the read path: LocalSecretsBackend.load_or_create_passphrase codex-rs/secrets/src/local.rs:267 — `LocalSecretsBackend.load_or_create_passphrase` performs a durable write on a read path (a persist to a store/repository). The name announces the lazy initialisation, so the write is deliberate — the risk is that callers who only meant to READ still trigger it. Expose a read-only variant that returns nothing when the value is absent, and keep this one for the callers that genuinely want the create.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D31 · IaC & Container Security · High IaC · ×1
  • REDACTED
D34 · Knowledge Freshness · Orphaned knowledge · ×1
  • Orphaned knowledge codex-rs/cloud-tasks/src/ui.rs:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
DM4 · Rich vs anemic domain model · Anemic domain model · ×1
  • Anemic domain model: Completion codex-rs/core/src/unified_exec/oneshot.rs:21 — `Completion` is a data-only domain entity with `pub` mutable state and no invariant-enforcing behaviour of its own, while the repo holds the logic in a foreign service/manager/use-case — the anemic domain model. Move the behaviour onto the entity so it enforces its own invariants (or make it an immutable value object with private fields) rather than being driven from outside.
R8 · Dependency Hygiene · Unlisted import '@eslint/js' · ×1
  • Unlisted import '@eslint/js' sdk/typescript/eslint.config.js:1 — Imported but not declared in any reachable package.json — installs work only by hoisting accident.
R8 · Dependency Hygiene · Unlisted import '@jest/globals' · ×1
  • Unlisted import '@jest/globals' sdk/typescript/tests/setupCodexHome.ts:5 — Imported but not declared in any reachable package.json — installs work only by hoisting accident.
S1 · Web-Security Posture · Cryptographic key material is a compile-time constant · ×1
  • Cryptographic key material is a compile-time constant codex-rs/cloud-config/src/cache.rs:31 — `CLOUD_CONFIG_BUNDLE_CACHE_WRITE_HMAC_KEY` is the secret key and is a compile-time constant, so the secret this operation depends on is published with the source. A key that ships with the source is not secret: every contributor, fork, mirror and released binary carries it, so anyone holding the repository can decrypt what any installation encrypted, and there is no way to invalidate what was already protected because every deployment built from this source shares the value. Where the constant is a password salt the consequence differs but is no smaller — one global salt means precomputation amortises across every installation, which is the property salting exists to destroy. Read the value from configuration, an environment variable or a secrets manager at startup and FAIL FAST when it is absent, so a missing key stops the process instead of silently falling back to a shared default; treat the committed value as disclosed and rotate it rather than only deleting the line. For a salt, generate a fresh random one per password and store it alongside the hash.
Serious — 4388 finding(s)
D15 · Churn × Complexity Hotspots · Hotspot · ×410
  • Hotspot: codex-rs/tui/src/app/event_dispatch.rs codex-rs/tui/src/app/event_dispatch.rs:29 — codex-rs/tui/src/app/event_dispatch.rs changed 171 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 622 in App::handle_event at line 29. 4 of those changes were fix/bug commits, and the other 167 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/tui/src/app/event_dispatch.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/tui/src/app/startup.rs codex-rs/tui/src/app/startup.rs:232 — codex-rs/tui/src/app/startup.rs changed 100 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 207 in App::run at line 232. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/tui/src/app/startup.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/core/src/session/session.rs codex-rs/core/src/session/session.rs:812 — codex-rs/core/src/session/session.rs changed 185 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 97 in Session::new at line 812. 2 of those changes were fix/bug commits, and the other 183 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/core/src/session/session.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/core/src/config/mod.rs codex-rs/core/src/config/mod.rs:3333 — codex-rs/core/src/config/mod.rs changed 158 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 105 in Config::load_config_with_layer_stack at line 3333. 2 of those changes were fix/bug commits, and the other 156 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/core/src/config/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/core/src/session/turn.rs codex-rs/core/src/session/turn.rs:2657 — codex-rs/core/src/session/turn.rs changed 138 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 107 in codex_core::session::turn::try_run_sampling_request at line 2657. 1 of those changes was a fix/bug commit, and the other 137 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/core/src/session/turn.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/tui/src/lib.rs codex-rs/tui/src/lib.rs:1179 — codex-rs/tui/src/lib.rs changed 130 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 113 in codex_tui::run_ratatui_app at line 1179. 2 of those changes were fix/bug commits, and the other 128 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/tui/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/app-server/src/message_processor.rs codex-rs/app-server/src/message_processor.rs:1098 — codex-rs/app-server/src/message_processor.rs changed 75 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 184 in MessageProcessor::handle_initialized_client_request at line 1098. 2 of those changes were fix/bug commits, and the other 73 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/app-server/src/message_processor.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/tui/src/app.rs codex-rs/tui/src/app.rs:861 — codex-rs/tui/src/app.rs changed 127 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 91 in App::handle_tui_event at line 861. 2 of those changes were fix/bug commits, and the other 125 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/tui/src/app.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/core/src/session/mod.rs codex-rs/core/src/session/mod.rs:4670 — codex-rs/core/src/session/mod.rs changed 301 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in Session::build_initial_context_with_world_state at line 4670. 2 of those changes were fix/bug commits, and the other 299 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/core/src/session/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/app-server/src/request_processors/thread_processor.rs codex-rs/app-server/src/request_processors/thread_processor.rs:5236 — codex-rs/app-server/src/request_processors/thread_processor.rs changed 94 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 100 in ThreadRequestProcessor::thread_fork_inner at line 5236. 4 of those changes were fix/bug commits, and the other 90 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/app-server/src/request_processors/thread_processor.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/tui/src/bottom_pane/chat_composer.rs codex-rs/tui/src/bottom_pane/chat_composer.rs:4532 — codex-rs/tui/src/bottom_pane/chat_composer.rs changed 92 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 87 in ChatComposer::render_with_options at line 4532. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/tui/src/bottom_pane/chat_composer.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/app-server/src/lib.rs codex-rs/app-server/src/lib.rs:508 — codex-rs/app-server/src/lib.rs changed 61 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 111 in codex_app_server::run_main_with_transport_options at line 508. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/app-server/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/cli/src/main.rs codex-rs/cli/src/main.rs:1053 — codex-rs/cli/src/main.rs changed 66 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 100 in codex_cli::cli_main at line 1053. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/cli/src/main.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/app-server-protocol/src/protocol/common.rs codex-rs/app-server-protocol/src/protocol/common.rs:1755 — codex-rs/app-server-protocol/src/protocol/common.rs changed 65 times in last 90 days, max cyclomatic complexity 87 in ServerNotification::to_params at line 1755. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/app-server-protocol/src/protocol/common.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/tui/src/app/agents_overview.rs codex-rs/tui/src/app/agents_overview.rs:441 — codex-rs/tui/src/app/agents_overview.rs changed 68 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 81 in App::attach_agents_overview_thread at line 441. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/tui/src/app/agents_overview.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/tui/src/startup_orchestration.rs codex-rs/tui/src/startup_orchestration.rs:10 — codex-rs/tui/src/startup_orchestration.rs changed 42 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 125 in codex_tui::startup_orchestration::run_main_inner at line 10. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/tui/src/startup_orchestration.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/tui/src/chatwidget/slash_dispatch.rs codex-rs/tui/src/chatwidget/slash_dispatch.rs:162 — codex-rs/tui/src/chatwidget/slash_dispatch.rs changed 51 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 93 in ChatWidget::dispatch_command_from_source at line 162. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/tui/src/chatwidget/slash_dispatch.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/tui/src/keymap_setup/actions.rs codex-rs/tui/src/keymap_setup/actions.rs:93 — codex-rs/tui/src/keymap_setup/actions.rs changed 30 times in last 90 days, max cyclomatic complexity 155 in codex_tui::keymap_setup::actions::binding_slot at line 93. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/tui/src/keymap_setup/actions.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/app-server/src/bespoke_event_handling.rs codex-rs/app-server/src/bespoke_event_handling.rs:147 — codex-rs/app-server/src/bespoke_event_handling.rs changed 45 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 101 in codex_app_server::bespoke_event_handling::apply_bespoke_event_handling at line 147. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/app-server/src/bespoke_event_handling.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/codex-mcp/src/connection_manager.rs codex-rs/codex-mcp/src/connection_manager.rs:350 — codex-rs/codex-mcp/src/connection_manager.rs changed 50 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 88 in McpConnectionSet::new at line 350. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/codex-mcp/src/connection_manager.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/core/src/agent/control/spawn.rs codex-rs/core/src/agent/control/spawn.rs:1059 — codex-rs/core/src/agent/control/spawn.rs changed 80 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 53 in LocalAgentControl::prepare_forked_history at line 1059. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/core/src/agent/control/spawn.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/tui/src/keymap/bindings.rs codex-rs/tui/src/keymap/bindings.rs:181 — codex-rs/tui/src/keymap/bindings.rs changed 26 times in last 90 days, max cyclomatic complexity 160 in codex_tui::keymap::bindings::configured_binding_for_action at line 181. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/tui/src/keymap/bindings.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/core/src/thread_manager.rs codex-rs/core/src/thread_manager.rs:2118 — codex-rs/core/src/thread_manager.rs changed 92 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in ThreadManagerState::spawn_thread at line 2118. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/core/src/thread_manager.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/features/src/lib.rs codex-rs/features/src/lib.rs:671 — codex-rs/features/src/lib.rs changed 146 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in Features::apply_map at line 671. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/features/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: codex-rs/core/src/guardian/review_session.rs codex-rs/core/src/guardian/review_session.rs:331 — codex-rs/core/src/guardian/review_session.rs changed 90 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 42 in codex_core::guardian::review_session::run_review_on_session at line 331. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-28..2026-10-26, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-28 21:08:15 +00:00' --until='2026-10-26 21:08:15 +00:00' --full-history --no-merges -- codex-rs/core/src/guardian/review_session.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • + 385 more in this group — see findings.md.
D17 · Explicit Debt · TodoComment · ×280
  • TodoComment sdk/typescript/tests/run.test.ts:553 — // TODO(anp): Add the sandbox helper to the SDK workflow so this can use a deny-read override. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment sdk/typescript/tests/run.test.ts:867 — // TODO(pakrym): remove timeout — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment scripts/codex_package/smoke_tests/test_codex_package.py:98 — # TODO(anp): Assert resolved rg paths once Windows sandbox PATH finds them. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/windows-sandbox-rs/src/unified_exec/mod.rs:26 — // TODO(anp): Reconcile the Windows backend copy with the supplied sandbox — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/sandboxing/src/spawn.rs:18 — // TODO(anp): Reconcile the Windows backend copy with the supplied sandbox — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/utils/path-uri/src/lib.rs:233 — /// TODO(anp): Once `PathUri` carries an environment identifier, prefer the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/chatwidget.rs:887 — // TODO(anp): Keep this as PathUri once `tui::approval_events::ExecApprovalRequestEvent` and — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/clipboard_paste.rs:274 — // TODO: We'll improve the implementation/unit tests over time, as appropriate. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/config_update.rs:401 — // TODO(anp): Support foreign skill paths through skills/config/write and persisted config. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/debug_config.rs:343 — // TODO(gt): Expand this debug output with detailed skills and rules display. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/insert_history.rs:360 — // TODO(nornagon): is this supported on Windows? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/insert_history.rs:380 — // TODO(nornagon): is this supported on Windows? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/lib.rs:424 — // TODO(jif) delete after 22/11/2026. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/status/helpers.rs:42 — // TODO(anp): Rationalize instruction-source summaries with the TUI's broader foreign-path — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/chatwidget/input_submission.rs:305 — // TODO(anp): Preserve executor path identity through both structured skill input paths — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/chatwidget/protocol_requests.rs:37 — // TODO(anp): Remove this native-path localization error path once core permission — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/app/thread_routing.rs:365 — // TODO(anp): Remove this native-path localization error path once core permission — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/chatwidget/protocol_requests.rs:79 — // TODO(anp): Remove this native-path localization error path once core permission paths — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/app-server/src/bespoke_event_handling.rs:1871 — // TODO(anp): Remove this native-path localization error path once core permission paths — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/chatwidget/streaming.rs:312 — // TODO: Replace streamed output with the final plan item text if plan streaming is — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/chatwidget/user_messages.rs:771 — // TODO: Include audio inputs in pending steer comparison. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/chatwidget/user_messages.rs:772 — // TODO: Include audio inputs in pending steer comparison. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/chatwidget/user_messages.rs:791 — // TODO(kc) preserve file-backed images when the TUI can resolve or replay them. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/chatwidget/user_messages.rs:840 — // TODO: Include audio inputs in the user message display. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment codex-rs/tui/src/chatwidget/user_messages.rs:841 — // TODO: Include audio inputs in the user message display. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • + 255 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×274
  • MethodTooLong: App.handle_event codex-rs/tui/src/app/event_dispatch.rs:29 — MethodTooLong — handle_event runs 2667 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 2567 over it, 26.67× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Config.load_config_with_layer_stack codex-rs/core/src/config/mod.rs:3333 — MethodTooLong — load_config_with_layer_stack runs 1242 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1142 over it, 12.42× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: RuntimeKeymap.from_config codex-rs/tui/src/keymap.rs:672 — MethodTooLong — from_config runs 703 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 603 over it, 7.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MessageProcessor.handle_initialized_client_request codex-rs/app-server/src/message_processor.rs:1098 — MethodTooLong — handle_initialized_client_request runs 690 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 590 over it, 6.90× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: McpConnectionSet.new codex-rs/codex-mcp/src/connection_manager.rs:350 — MethodTooLong — new runs 624 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 524 over it, 6.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ThreadRequestProcessor.thread_fork_inner codex-rs/app-server/src/request_processors/thread_processor.rs:5236 — MethodTooLong — thread_fork_inner runs 531 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 431 over it, 5.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ThreadRequestProcessor.thread_resume_inner codex-rs/app-server/src/request_processors/thread_processor.rs:3951 — MethodTooLong — thread_resume_inner runs 468 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 368 over it, 4.68× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ToolOrchestrator.run codex-rs/core/src/tools/orchestrator.rs:125 — MethodTooLong — run runs 388 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 288 over it, 3.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChatComposer.render_with_options codex-rs/tui/src/bottom_pane/chat_composer.rs:4532 — MethodTooLong — render_with_options runs 386 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 286 over it, 3.86× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Session.spawn_internal codex-rs/core/src/session/mod.rs:603 — MethodTooLong — spawn_internal runs 369 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 269 over it, 3.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: App.attach_agents_overview_thread codex-rs/tui/src/app/agents_overview.rs:441 — MethodTooLong — attach_agents_overview_thread runs 347 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 247 over it, 3.47× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ConfigRequirements.try_from codex-rs/config/src/config_requirements.rs:1784 — MethodTooLong — try_from runs 346 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 246 over it, 3.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CredentialBroker.virtualize_env codex-rs/network-proxy/src/credential_broker.rs:561 — MethodTooLong — virtualize_env runs 342 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 242 over it, 3.42× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChatWidget.dispatch_command_from_source codex-rs/tui/src/chatwidget/slash_dispatch.rs:162 — MethodTooLong — dispatch_command_from_source runs 339 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 239 over it, 3.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ThreadManagerState.spawn_thread codex-rs/core/src/thread_manager.rs:2118 — MethodTooLong — spawn_thread runs 328 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 228 over it, 3.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: NetworkApprovalService.handle_inline_policy_request codex-rs/core/src/tools/network_approval.rs:629 — MethodTooLong — handle_inline_policy_request runs 325 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 225 over it, 3.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: UnifiedExecRuntime.run codex-rs/core/src/tools/runtimes/unified_exec.rs:261 — MethodTooLong — run runs 324 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 224 over it, 3.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: App.change_working_directory_with_managed codex-rs/tui/src/app/working_directory.rs:144 — MethodTooLong — change_working_directory_with_managed runs 321 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 221 over it, 3.21× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Session.build_world_state_for_step codex-rs/core/src/session/world_state.rs:59 — MethodTooLong — build_world_state_for_step runs 314 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 214 over it, 3.14× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChatWidget.submit_user_message_with_prepared_images codex-rs/tui/src/chatwidget/input_submission.rs:130 — MethodTooLong — submit_user_message_with_prepared_images runs 314 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 214 over it, 3.14× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MessageProcessor.new codex-rs/app-server/src/message_processor.rs:284 — MethodTooLong — new runs 310 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 210 over it, 3.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LocalAgentControl.ensure_v2_agent_loaded codex-rs/core/src/agent/control/spawn.rs:325 — MethodTooLong — ensure_v2_agent_loaded runs 310 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 210 over it, 3.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: TraceReducer.apply_event codex-rs/rollout-trace/src/reducer/mod.rs:204 — MethodTooLong — apply_event runs 308 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 208 over it, 3.08× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: App.handle_server_notification_event codex-rs/tui/src/app/app_server_events.rs:166 — MethodTooLong — handle_server_notification_event runs 305 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 205 over it, 3.05× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChatWidget.handle_server_notification codex-rs/tui/src/chatwidget/protocol.rs:4 — MethodTooLong — handle_server_notification runs 298 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 198 over it, 2.98× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 249 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×250
  • FileTooLong: request_processors/thread_processor.rs codex-rs/app-server/src/request_processors/thread_processor.rs — FileTooLong — 5168 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 83% of them inside a single declaration: ThreadRequestProcessor (2 blocks, 481-6084), declaring 42 free functions. The bar is 500 significant lines; this is 4668 over it, 10.34× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: session/mod.rs codex-rs/core/src/session/mod.rs — FileTooLong — 4181 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 82% of them inside a single declaration: Session (2 blocks, 566-5594). The bar is 500 significant lines; this is 3681 over it, 8.36× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: config/mod.rs codex-rs/core/src/config/mod.rs — FileTooLong — 3616 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 64 free functions. The bar is 500 significant lines; this is 3116 over it, 7.23× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/reducer.rs codex-rs/analytics/src/reducer.rs — FileTooLong — 3272 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 47 free functions. The bar is 500 significant lines; this is 2772 over it, 6.54× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: bottom_pane/chat_composer.rs codex-rs/tui/src/bottom_pane/chat_composer.rs — FileTooLong — 3208 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 89% of them inside a single declaration: ChatComposer (5 blocks, 615-5016). The bar is 500 significant lines; this is 2708 over it, 6.42× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/protocol.rs codex-rs/protocol/src/protocol.rs — FileTooLong — 3035 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 2535 over it, 6.07× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: app/event_dispatch.rs codex-rs/tui/src/app/event_dispatch.rs — FileTooLong — 2960 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 99% of them inside a single declaration: App (28-3995). The bar is 500 significant lines; this is 2460 over it, 5.92× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/manager.rs codex-rs/core-plugins/src/manager.rs — FileTooLong — 2876 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 78% of them inside a single declaration: PluginsManager (2 blocks, 558-3725). The bar is 500 significant lines; this is 2376 over it, 5.75× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/resume_picker.rs codex-rs/tui/src/resume_picker.rs — FileTooLong — 2779 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 81 free functions. The bar is 500 significant lines; this is 2279 over it, 5.56× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: session/turn.rs codex-rs/core/src/session/turn.rs — FileTooLong — 2628 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 32 free functions. The bar is 500 significant lines; this is 2128 over it, 5.26× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: auth/manager.rs codex-rs/login/src/auth/manager.rs — FileTooLong — 2424 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1924 over it, 4.85× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/client.rs codex-rs/core/src/client.rs — FileTooLong — 2405 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1905 over it, 4.81× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/doctor.rs codex-rs/cli/src/doctor.rs — FileTooLong — 2238 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 87 free functions. The bar is 500 significant lines; this is 1738 over it, 4.48× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/realtime_conversation.rs codex-rs/core/src/realtime_conversation.rs — FileTooLong — 2122 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 44 free functions. The bar is 500 significant lines; this is 1622 over it, 4.24× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/thread_manager.rs codex-rs/core/src/thread_manager.rs — FileTooLong — 2068 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1568 over it, 4.14× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/app_server_session.rs codex-rs/tui/src/app_server_session.rs — FileTooLong — 2033 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 34 free functions. The bar is 500 significant lines; this is 1533 over it, 4.07× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/main.rs codex-rs/cli/src/main.rs — FileTooLong — 1997 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 46 free functions. The bar is 500 significant lines; this is 1497 over it, 3.99× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/mcp_tool_call.rs codex-rs/core/src/mcp_tool_call.rs — FileTooLong — 1966 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 53 free functions. The bar is 500 significant lines; this is 1466 over it, 3.93× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/remote.rs codex-rs/core-plugins/src/remote.rs — FileTooLong — 1915 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 59 free functions. The bar is 500 significant lines; this is 1415 over it, 3.83× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: request_processors/plugins.rs codex-rs/app-server/src/request_processors/plugins.rs — FileTooLong — 1905 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 69% of them inside a single declaration: PluginRequestProcessor (2 blocks, 61-2134). The bar is 500 significant lines; this is 1405 over it, 3.81× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/keymap.rs codex-rs/tui/src/keymap.rs — FileTooLong — 1885 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 68% of them inside a single declaration: RuntimeKeymap (2 blocks, 87-2465). The bar is 500 significant lines; this is 1385 over it, 3.77× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: REDACTED codex-rs/tui/src/lib.rs — FileTooLong — 1867 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 40 free functions. The bar is 500 significant lines; this is 1367 over it, 3.73× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: mcp_conformance/run_codex_compliance.py scripts/mcp_conformance/run_codex_compliance.py — FileTooLong — 1858 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1358 over it, 3.72× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED codex-rs/exec/src/lib.rs — FileTooLong — 1853 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 43 free functions. The bar is 500 significant lines; this is 1353 over it, 3.71× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/markdown_render.rs codex-rs/tui/src/markdown_render.rs — FileTooLong — 1786 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 85% of them inside a single declaration: Writer (2 blocks, 467-2591). The bar is 500 significant lines; this is 1286 over it, 3.57× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • + 225 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×203
  • FunctionTooLong: codex_cloud_tasks::run_main codex-rs/cloud-tasks/src/lib.rs:753 — FunctionTooLong — codex_cloud_tasks::run_main runs 918 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 818 over it, 9.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_app_server::bespoke_event_handling::apply_bespoke_event_handling codex-rs/app-server/src/bespoke_event_handling.rs:147 — FunctionTooLong — codex_app_server::bespoke_event_handling::apply_bespoke_event_handling runs 907 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 807 over it, 9.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_tui::run_ratatui_app codex-rs/tui/src/lib.rs:1179 — FunctionTooLong — codex_tui::run_ratatui_app runs 766 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 666 over it, 7.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_cli::cli_main codex-rs/cli/src/main.rs:1053 — FunctionTooLong — codex_cli::cli_main runs 761 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 661 over it, 7.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_tui::startup_orchestration::run_main_inner codex-rs/tui/src/startup_orchestration.rs:10 — FunctionTooLong — codex_tui::startup_orchestration::run_main_inner runs 743 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 643 over it, 7.43× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_app_server::run_main_with_transport_options codex-rs/app-server/src/lib.rs:508 — FunctionTooLong — codex_app_server::run_main_with_transport_options runs 674 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 574 over it, 6.74× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_tui::dynamic_tools::execute_inner codex-rs/tui/src/dynamic_tools.rs:324 — FunctionTooLong — codex_tui::dynamic_tools::execute_inner runs 617 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 517 over it, 6.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_core::session::turn::try_run_sampling_request codex-rs/core/src/session/turn.rs:2657 — FunctionTooLong — codex_core::session::turn::try_run_sampling_request runs 616 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 516 over it, 6.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_core::session::turn::run_turn codex-rs/core/src/session/turn.rs:174 — FunctionTooLong — codex_core::session::turn::run_turn runs 544 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 444 over it, 5.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_exec::run_exec_session codex-rs/exec/src/lib.rs:855 — FunctionTooLong — codex_exec::run_exec_session runs 419 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 319 over it, 4.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_exec::run_main codex-rs/exec/src/lib.rs:266 — FunctionTooLong — codex_exec::run_main runs 402 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 302 over it, 4.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_core::guardian::review_session::run_review_on_session codex-rs/core/src/guardian/review_session.rs:331 — FunctionTooLong — codex_core::guardian::review_session::run_review_on_session runs 393 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 293 over it, 3.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_app_server::in_process::start_uninitialized codex-rs/app-server/src/in_process.rs:433 — FunctionTooLong — codex_app_server::in_process::start_uninitialized runs 361 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 261 over it, 3.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_app_server_protocol::protocol::event_mapping::item_event_to_server_notification codex-rs/app-server-protocol/src/protocol/event_mapping.rs:30 — FunctionTooLong — codex_app_server_protocol::protocol::event_mapping::item_event_to_server_notification runs 356 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 256 over it, 3.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_network_proxy::http_proxy::http_plain_proxy codex-rs/network-proxy/src/http_proxy.rs:563 — FunctionTooLong — codex_network_proxy::http_proxy::http_plain_proxy runs 355 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 255 over it, 3.55× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_code_mode_runtime::cell_actor::run_cell codex-rs/code-mode-runtime/src/cell_actor/mod.rs:109 — FunctionTooLong — codex_code_mode_runtime::cell_actor::run_cell runs 336 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 236 over it, 3.36× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_shell_command::parse_command::summarize_main_tokens codex-rs/shell-command/src/parse_command.rs:2290 — FunctionTooLong — codex_shell_command::parse_command::summarize_main_tokens runs 334 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 234 over it, 3.34× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_core::shell_snapshot::capture_snapshot codex-rs/core/src/shell_snapshot.rs:576 — FunctionTooLong — codex_core::shell_snapshot::capture_snapshot runs 303 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 203 over it, 3.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_shell_command::shell_snapshot_literals::literal_words_with_quoting codex-rs/shell-command/src/shell_snapshot_literals.rs:51 — FunctionTooLong — codex_shell_command::shell_snapshot_literals::literal_words_with_quoting runs 293 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 193 over it, 2.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_analytics::reducer::tool_item_event codex-rs/analytics/src/reducer.rs:3062 — FunctionTooLong — codex_analytics::reducer::tool_item_event runs 289 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 189 over it, 2.89× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_config::loader::load_config_layers_state codex-rs/config/src/loader/mod.rs:146 — FunctionTooLong — codex_config::loader::load_config_layers_state runs 271 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 171 over it, 2.71× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_app_server_daemon::prepare_install::prepare_from_package codex-rs/app-server-daemon/src/prepare_install.rs:87 — FunctionTooLong — codex_app_server_daemon::prepare_install::prepare_from_package runs 270 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 170 over it, 2.70× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_cli::debug_sandbox::run_command_under_sandbox codex-rs/cli/src/debug_sandbox.rs:203 — FunctionTooLong — codex_cli::debug_sandbox::run_command_under_sandbox runs 253 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 153 over it, 2.53× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_guardian_context::transcript::collect_transcript_for_target codex-rs/guardian-context/src/transcript.rs:137 — FunctionTooLong — codex_guardian_context::transcript::collect_transcript_for_target runs 251 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 151 over it, 2.51× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: codex_hooks::engine::discovery::append_matcher_groups codex-rs/hooks/src/engine/discovery.rs:623 — FunctionTooLong — codex_hooks::engine::discovery::append_matcher_groups runs 251 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 151 over it, 2.51× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 178 more in this group — see findings.md.
D2 · Cognitive Complexity · codex_tui · ×98
  • codex_tui::analytics::normalize::history (cognitive 190) codex-rs/tui/src/analytics/normalize.rs:30 — codex_tui::analytics::normalize::history has cognitive complexity 190 (threshold 15). Drivers by points: if/else 41 (107 pts), loops 15 (49 pts), match/switch 6 (19 pts), boolean chains 15 (nesting depth added 113). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::run_ratatui_app (cognitive 157) codex-rs/tui/src/lib.rs:1179 — codex_tui::run_ratatui_app has cognitive complexity 157 (threshold 15). Drivers by points: if/else 61 (94 pts), match/switch 24 (37 pts), boolean chains 26 (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::startup_orchestration::run_main_inner (cognitive 148) codex-rs/tui/src/startup_orchestration.rs:10 — codex_tui::startup_orchestration::run_main_inner has cognitive complexity 148 (threshold 15). Drivers by points: if/else 84 (104 pts), boolean chains 27, match/switch 12 (17 pts) (nesting depth added 25). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_tui::dynamic_tools::execute_inner (cognitive 135) codex-rs/tui/src/dynamic_tools.rs:324 — codex_tui::dynamic_tools::execute_inner has cognitive complexity 135 (threshold 15). Drivers by points: if/else 34 (74 pts), match/switch 11 (41 pts), boolean chains 10, loops 4 (10 pts) (nesting depth added 76). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_tui::onboarding::onboarding_screen::run_onboarding_screen_inner (cognitive 100) codex-rs/tui/src/onboarding/onboarding_screen.rs:619 — codex_tui::onboarding::onboarding_screen::run_onboarding_screen_inner has cognitive complexity 100 (threshold 15). Drivers by points: if/else 16 (65 pts), match/switch 6 (25 pts), loops 2 (6 pts), boolean chains 4 (nesting depth added 72). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::diff_render::render_change_with_preview (cognitive 98) codex-rs/tui/src/diff_render.rs:539 — codex_tui::diff_render::render_change_with_preview has cognitive complexity 98 (threshold 15). Drivers by points: if/else 19 (60 pts), match/switch 5 (20 pts), loops 6 (18 pts) (nesting depth added 68). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_tui::resume_picker::sources::spawn (cognitive 96) codex-rs/tui/src/resume_picker/sources.rs:18 — codex_tui::resume_picker::sources::spawn has cognitive complexity 96 (threshold 15). Drivers by points: if/else 17 (61 pts), match/switch 7 (24 pts), loops 4 (7 pts), boolean chains 4 (nesting depth added 64). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::markdown_copy::render_selection (cognitive 86) codex-rs/tui/src/markdown_copy.rs:341 — codex_tui::markdown_copy::render_selection has cognitive complexity 86 (threshold 15). Drivers by points: if/else 26 (52 pts), boolean chains 21, loops 5 (13 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::markdown::unwrap_markdown_fences_with_sources (cognitive 77) codex-rs/tui/src/markdown.rs:279 — codex_tui::markdown::unwrap_markdown_fences_with_sources has cognitive complexity 77 (threshold 15). Drivers by points: if/else 24 (48 pts), loops 7 (19 pts), match/switch 3 (7 pts), boolean chains 3 (nesting depth added 40). Of this number, 54 points are the body's own statements and 23 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::named_session_lookup::lookup (cognitive 74) codex-rs/tui/src/named_session_lookup.rs:48 — codex_tui::named_session_lookup::lookup has cognitive complexity 74 (threshold 15). Drivers by points: if/else 10 (44 pts), match/switch 2 (11 pts), loops 4 (10 pts), boolean chains 9 (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::text_formatting::center_truncate_path (cognitive 74) codex-rs/tui/src/text_formatting.rs:99 — codex_tui::text_formatting::center_truncate_path has cognitive complexity 74 (threshold 15). Drivers by points: if/else 30 (52 pts), loops 11 (15 pts), boolean chains 7 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::history_cell::spoken_artifacts::annotate_spoken_artifacts (cognitive 72) codex-rs/tui/src/history_cell/spoken_artifacts.rs:14 — codex_tui::history_cell::spoken_artifacts::annotate_spoken_artifacts has cognitive complexity 72 (threshold 15). Drivers by points: if/else 17 (51 pts), loops 8 (17 pts), boolean chains 4 (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::bottom_pane::footer::single_line_footer_layout (cognitive 62) codex-rs/tui/src/bottom_pane/footer.rs:390 — codex_tui::bottom_pane::footer::single_line_footer_layout has cognitive complexity 62 (threshold 15). Drivers by points: if/else 24 (48 pts), boolean chains 10, loops 2 (4 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::assistant_directives::parse_assistant_directive_with_budget (cognitive 56) codex-rs/tui/src/assistant_directives.rs:44 — codex_tui::assistant_directives::parse_assistant_directive_with_budget has cognitive complexity 56 (threshold 15). Drivers by points: if/else 16 (33 pts), loops 4 (10 pts), match/switch 3 (10 pts), boolean chains 3 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::app::user_turn_submission::try_submit_user_turn (cognitive 50) codex-rs/tui/src/app/user_turn_submission.rs:7 — codex_tui::app::user_turn_submission::try_submit_user_turn has cognitive complexity 50 (threshold 15). Drivers by points: if/else 13 (36 pts), match/switch 3 (8 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::thread_transcript::thread_items_to_transcript_cells (cognitive 50) codex-rs/tui/src/thread_transcript.rs:124 — codex_tui::thread_transcript::thread_items_to_transcript_cells has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (34 pts), match/switch 3 (10 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::bottom_pane::textarea::wrapping::wrapped_lines (cognitive 49) codex-rs/tui/src/bottom_pane/textarea/wrapping.rs:55 — codex_tui::bottom_pane::textarea::wrapping::wrapped_lines has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 7 (14 pts), boolean chains 8 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::empty_state_animation::geometry::field (cognitive 48) codex-rs/tui/src/empty_state_animation/geometry.rs:37 — codex_tui::empty_state_animation::geometry::field has cognitive complexity 48 (threshold 15). Drivers by points: loops 13 (23 pts), if/else 9 (19 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 21). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • codex_tui::wrapping::mixed_url_wrap_ranges (cognitive 48) codex-rs/tui/src/wrapping.rs:1117 — codex_tui::wrapping::mixed_url_wrap_ranges has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (41 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::history_cell::mcp::new_mcp_tools_output_from_statuses (cognitive 44) codex-rs/tui/src/history_cell/mcp.rs:643 — codex_tui::history_cell::mcp::new_mcp_tools_output_from_statuses has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (30 pts), loops 3 (9 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::analytics::tokens::filtered_history (cognitive 43) codex-rs/tui/src/analytics/tokens.rs:17 — codex_tui::analytics::tokens::filtered_history has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 3 (6 pts), boolean chains 5 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::bottom_pane::chat_composer::completion_target::current_prefixed_token_range_with_dollar_predicate (cognitive 42) codex-rs/tui/src/bottom_pane/chat_composer/completion_target.rs:87 — codex_tui::bottom_pane::chat_composer::completion_target::current_prefixed_token_range_with_dollar_predicate has cognitive complexity 42 (threshold 15). Drivers by points: if/else 21 (29 pts), boolean chains 13 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::history_cell::approvals::new_approval_decision_cell (cognitive 40) codex-rs/tui/src/history_cell/approvals.rs:46 — codex_tui::history_cell::approvals::new_approval_decision_cell has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 10 (20 pts) (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_tui::resume_picker::run_session_picker_event_loop (cognitive 39) codex-rs/tui/src/resume_picker.rs:617 — codex_tui::resume_picker::run_session_picker_event_loop has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (32 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tui::terminal_hyperlinks::mark_buffer_hyperlinks (cognitive 39) codex-rs/tui/src/terminal_hyperlinks.rs:761 — codex_tui::terminal_hyperlinks::mark_buffer_hyperlinks has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (26 pts), loops 4 (10 pts), boolean chains 3 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 73 more in this group — see findings.md.
D3 · God Classes · ClassTooLong · ×75
  • ClassTooLong: ThreadRequestProcessor codex-rs/app-server/src/request_processors/thread_processor.rs:481 — ClassTooLong — 4271 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 131 methods, 2 blocks, lines 481-6084. The bar is 400 significant lines; this is 3871 over it, 10.68× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ChatComposer codex-rs/tui/src/bottom_pane/chat_composer.rs:615 — ClassTooLong — 2844 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 279 methods, 5 blocks, lines 615-5016. The bar is 400 significant lines; this is 2444 over it, 7.11× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: PluginsManager codex-rs/core-plugins/src/manager.rs:558 — ClassTooLong — 2248 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 93 methods, 2 blocks, lines 558-3725. The bar is 400 significant lines; this is 1848 over it, 5.62× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Config codex-rs/core/src/config/mod.rs:627 — ClassTooLong — 1918 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 47 methods, 4 blocks, lines 627-5031. The bar is 400 significant lines; this is 1518 over it, 4.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AnalyticsReducer codex-rs/analytics/src/reducer.rs:215 — ClassTooLong — 1789 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 57 methods, 2 blocks, lines 215-2890. The bar is 400 significant lines; this is 1389 over it, 4.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Writer codex-rs/tui/src/markdown_render.rs:467 — ClassTooLong — 1514 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 79 methods, 2 blocks, lines 467-2591. The bar is 400 significant lines; this is 1114 over it, 3.79× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: BottomPane codex-rs/tui/src/bottom_pane/mod.rs:295 — ClassTooLong — 1470 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 224 methods, 3 blocks, lines 295-2673. The bar is 400 significant lines; this is 1070 over it, 3.68× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: TextArea codex-rs/tui/src/bottom_pane/textarea.rs:143 — ClassTooLong — 1415 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 180 methods, 6 blocks, lines 143-2344. The bar is 400 significant lines; this is 1015 over it, 3.54× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MessageProcessor codex-rs/app-server/src/message_processor.rs:147 — ClassTooLong — 1345 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 25 methods, 2 blocks, lines 147-1958. The bar is 400 significant lines; this is 945 over it, 3.36× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: PluginRequestProcessor codex-rs/app-server/src/request_processors/plugins.rs:61 — ClassTooLong — 1323 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 43 methods, 2 blocks, lines 61-2134. The bar is 400 significant lines; this is 923 over it, 3.31× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: RuntimeKeymap codex-rs/tui/src/keymap.rs:87 — ClassTooLong — 1291 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 6 methods, 2 blocks, lines 87-2465. The bar is 400 significant lines; this is 891 over it, 3.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: TurnRequestProcessor codex-rs/app-server/src/request_processors/turn_processor.rs:83 — ClassTooLong — 1238 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 44 methods, 2 blocks, lines 83-1723. The bar is 400 significant lines; this is 838 over it, 3.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: RmcpClient codex-rs/rmcp-client/src/rmcp_client.rs:415 — ClassTooLong — 1158 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 50 methods, 2 blocks, lines 415-1973. The bar is 400 significant lines; this is 758 over it, 2.90× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ListSelectionView codex-rs/tui/src/bottom_pane/list_selection_view.rs:342 — ClassTooLong — 1127 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 53 methods, 6 blocks, lines 342-1916. The bar is 400 significant lines; this is 727 over it, 2.82× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Session codex-rs/core/src/session/session.rs:60 — ClassTooLong — 1120 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 296 methods, 2 blocks, lines 60-2052. The bar is 400 significant lines; this is 720 over it, 2.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AppServerSession codex-rs/tui/src/app_server_session.rs:326 — ClassTooLong — 1070 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 94 methods, 2 blocks, lines 326-1848. The bar is 400 significant lines; this is 670 over it, 2.68× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ThreadHistoryBuilder codex-rs/app-server-protocol/src/protocol/thread_history.rs:289 — ClassTooLong — 1055 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 79 methods, 3 blocks, lines 289-1763. The bar is 400 significant lines; this is 655 over it, 2.64× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MemoryStore codex-rs/state/src/runtime/memories.rs:33 — ClassTooLong — 1004 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 24 methods, 2 blocks, lines 33-1405. The bar is 400 significant lines; this is 604 over it, 2.51× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AccountRequestProcessor codex-rs/app-server/src/request_processors/account_processor.rs:99 — ClassTooLong — 992 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 63 methods, 2 blocks, lines 99-1488. The bar is 400 significant lines; this is 592 over it, 2.48× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SessionTelemetry codex-rs/otel/src/events/session_telemetry.rs:121 — ClassTooLong — 973 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 55 methods, 2 blocks, lines 121-1441. The bar is 400 significant lines; this is 573 over it, 2.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: RequestUserInputOverlay codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:140 — ClassTooLong — 969 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 78 methods, 3 blocks, lines 140-1540. The bar is 400 significant lines; this is 569 over it, 2.42× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: FileSystemSandboxPolicy codex-rs/protocol/src/permissions.rs:241 — ClassTooLong — 943 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 62 methods, 5 blocks, lines 241-2079. The bar is 400 significant lines; this is 543 over it, 2.36× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AuthManager codex-rs/login/src/auth/manager.rs:2128 — ClassTooLong — 914 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 72 methods, 3 blocks, lines 2128-3452. The bar is 400 significant lines; this is 514 over it, 2.29× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: McpConnectionSet codex-rs/codex-mcp/src/connection_manager.rs:332 — ClassTooLong — 842 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 43 methods, 2 blocks, lines 332-1433. The bar is 400 significant lines; this is 442 over it, 2.11× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: PickerState codex-rs/tui/src/resume_picker.rs:945 — ClassTooLong — 838 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 53 methods, 2 blocks, lines 945-2208. The bar is 400 significant lines; this is 438 over it, 2.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • + 50 more in this group — see findings.md.
D3 · God Classes · TooManyMethods · ×65
  • TooManyMethods: ChatWidget codex-rs/tui/src/chatwidget.rs:522 — TooManyMethods — 982 methods, declared across 85 files: src/chatwidget.rs (98), chatwidget/settings.rs (55), chatwidget/status_surfaces.rs (54), chatwidget/interaction.rs (47), +81 more file(s). The bar is 30 methods; this is 952 over it, 32.73× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: App codex-rs/tui/src/app.rs:537 — TooManyMethods — 492 methods, declared across 76 files: app/thread_routing.rs (60), app/config_persistence.rs (36), app/background_requests.rs (31), app/resize_reflow.rs (28), +72 more file(s). The bar is 30 methods; this is 462 over it, 16.40× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Session codex-rs/core/src/session/session.rs:60 — TooManyMethods — 296 methods, declared across 29 files: session/mod.rs (157), session/mcp.rs (20), session/turn_context.rs (16), tasks/mod.rs (14), +25 more file(s). The bar is 30 methods; this is 266 over it, 9.87× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ChatComposer codex-rs/tui/src/bottom_pane/chat_composer.rs:615 — TooManyMethods — 279 methods, declared across 16 files: bottom_pane/chat_composer.rs (175), chat_composer/history_search.rs (16), chat_composer/footer_state.rs (15), chat_composer/sparkle.rs (11), +12 more file(s). The bar is 30 methods; this is 249 over it, 9.30× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: BottomPane codex-rs/tui/src/bottom_pane/mod.rs:295 — TooManyMethods — 224 methods, declared across 9 files: bottom_pane/mod.rs (181), bottom_pane/startup.rs (13), chat_composer/sparkle.rs (8), bottom_pane/questions.rs (7), +5 more file(s). The bar is 30 methods; this is 194 over it, 7.47× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: TextArea codex-rs/tui/src/bottom_pane/textarea.rs:143 — TooManyMethods — 180 methods, declared across 7 files: bottom_pane/textarea.rs (114), textarea/vim_commands.rs (23), textarea/vim.rs (16), textarea/vim_search.rs (10), +3 more file(s). The bar is 30 methods; this is 150 over it, 6.00× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: TranscriptView codex-rs/tui/src/transcript_view.rs:91 — TooManyMethods — 162 methods, declared across 19 files: src/transcript_view.rs (25), transcript_view/search.rs (24), transcript_view/selection.rs (23), transcript_view/select_mode.rs (13), +15 more file(s). The bar is 30 methods; this is 132 over it, 5.40× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ThreadRequestProcessor codex-rs/app-server/src/request_processors/thread_processor.rs:481 — TooManyMethods — 131 methods, declared across 10 files: request_processors/thread_processor.rs (110), request_processors/thread_attachments.rs (5), request_processors/thread_delete.rs (5), request_processors/thread_sections.rs (5), +6 more file(s). The bar is 30 methods; this is 101 over it, 4.37× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: StateRuntime codex-rs/state/src/runtime.rs:101 — TooManyMethods — 106 methods, declared across 16 files: runtime/threads.rs (41), runtime/logs.rs (9), src/runtime.rs (8), runtime/projects.rs (8), +12 more file(s). The bar is 30 methods; this is 76 over it, 3.53× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: TraceReducer codex-rs/rollout-trace/src/reducer/mod.rs:142 — TooManyMethods — 95 methods, declared across 9 files: reducer/code_cell.rs (24), tool/agents.rs (22), reducer/tool.rs (14), reducer/conversation.rs (12), +5 more file(s). The bar is 30 methods; this is 65 over it, 3.17× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: CodexThread codex-rs/core/src/codex_thread.rs:208 — TooManyMethods — 94 methods, declared across 2 files: src/codex_thread.rs (93), session/extension_interruption.rs (1). The bar is 30 methods; this is 64 over it, 3.13× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AppServerSession codex-rs/tui/src/app_server_session.rs:326 — TooManyMethods — 94 methods, declared across 10 files: src/app_server_session.rs (65), app_server_session/history.rs (10), app_server_session/rollout_history.rs (5), app_server_session/external_agent_config.rs (4), +6 more file(s). The bar is 30 methods; this is 64 over it, 3.13× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PluginsManager codex-rs/core-plugins/src/manager.rs:558 — TooManyMethods — 93 methods, declared across 3 files: src/manager.rs (90), src/remote_mutations.rs (2), src/discoverable.rs (1). The bar is 30 methods; this is 63 over it, 3.10× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ThreadHistoryBuilder codex-rs/app-server-protocol/src/protocol/thread_history.rs:289 — TooManyMethods — 79 methods. The bar is 30 methods; this is 49 over it, 2.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Writer codex-rs/tui/src/markdown_render.rs:467 — TooManyMethods — 79 methods, declared across 2 files: src/markdown_render.rs (78), markdown_render/task_lists.rs (1). The bar is 30 methods; this is 49 over it, 2.63× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: RequestUserInputOverlay codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:140 — TooManyMethods — 78 methods, declared across 3 files: request_user_input/mod.rs (64), request_user_input/layout.rs (7), request_user_input/render.rs (7). The bar is 30 methods; this is 48 over it, 2.60× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AuthManager codex-rs/login/src/auth/manager.rs:2128 — TooManyMethods — 72 methods, declared across 2 files: auth/manager.rs (70), manager/workspace_routing.rs (2). The bar is 30 methods; this is 42 over it, 2.40× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Client codex-rs/backend-client/src/client.rs:161 — TooManyMethods — 66 methods, declared across 9 files: src/client.rs (45), client/rate_limit_resets.rs (11), client/thread_usage.rs (3), client/turn_usage.rs (2), +5 more file(s). The bar is 30 methods; this is 36 over it, 2.20× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AccountRequestProcessor codex-rs/app-server/src/request_processors/account_processor.rs:99 — TooManyMethods — 63 methods, declared across 6 files: request_processors/account_processor.rs (47), account_processor/gateway_oauth.rs (6), account_processor/workspace_routing.rs (4), account_processor/rate_limit_resets.rs (3), +2 more file(s). The bar is 30 methods; this is 33 over it, 2.10× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: NetworkProxyState codex-rs/network-proxy/src/runtime.rs:285 — TooManyMethods — 62 methods. The bar is 30 methods; this is 32 over it, 2.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: FileSystemSandboxPolicy codex-rs/protocol/src/permissions.rs:241 — TooManyMethods — 62 methods, declared across 3 files: src/permissions.rs (54), permissions/target.rs (7), permissions/local_aliases.rs (1). The bar is 30 methods; this is 32 over it, 2.07× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: CodexClient sdk/python/src/openai_codex/client.py:214 — TooManyMethods — 61 methods. The bar is 30 methods; this is 31 over it, 2.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ExecServerClient codex-rs/exec-server/src/client.rs:356 — TooManyMethods — 61 methods, declared across 5 files: src/client.rs (46), src/client_transport.rs (10), client/accepted.rs (2), client/rpc_http_client.rs (2), +1 more file(s). The bar is 30 methods; this is 31 over it, 2.03× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ThreadManager codex-rs/core/src/thread_manager.rs:254 — TooManyMethods — 59 methods, declared across 3 files: src/thread_manager.rs (56), thread_manager/shutdown.rs (2), thread_manager/managed.rs (1). The bar is 30 methods; this is 29 over it, 1.97× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AnalyticsReducer codex-rs/analytics/src/reducer.rs:215 — TooManyMethods — 57 methods. The bar is 30 methods; this is 27 over it, 1.90× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • + 40 more in this group — see findings.md.
D2 · Cognitive Complexity · App · ×57
  • App::handle_event (cognitive 676) codex-rs/tui/src/app/event_dispatch.rs:29 — App::handle_event has cognitive complexity 676 (threshold 15). Drivers by points: if/else 226 (492 pts), match/switch 42 (97 pts), boolean chains 63, loops 8 (24 pts) (nesting depth added 337). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • App::run (cognitive 390) codex-rs/tui/src/app/startup.rs:232 — App::run has cognitive complexity 390 (threshold 15). Drivers by points: if/else 114 (256 pts), match/switch 31 (81 pts), boolean chains 51, loops 1 (2 pts) (nesting depth added 193). Of this number, 389 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • App::attach_agents_overview_thread (cognitive 151) codex-rs/tui/src/app/agents_overview.rs:441 — App::attach_agents_overview_thread has cognitive complexity 151 (threshold 15). Drivers by points: if/else 49 (98 pts), match/switch 8 (23 pts), boolean chains 21, loops 4 (9 pts) (nesting depth added 69). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::handle_tui_event (cognitive 137) codex-rs/tui/src/app.rs:861 — App::handle_tui_event has cognitive complexity 137 (threshold 15). Drivers by points: if/else 52 (99 pts), boolean chains 34, match/switch 3 (4 pts) (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::handle_owned_transcript_event (cognitive 111) codex-rs/tui/src/app/owned_transcript.rs:395 — App::handle_owned_transcript_event has cognitive complexity 111 (threshold 15). Drivers by points: if/else 45 (73 pts), boolean chains 32, match/switch 3 (6 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::handle_server_notification_event (cognitive 110) codex-rs/tui/src/app/app_server_events.rs:166 — App::handle_server_notification_event has cognitive complexity 110 (threshold 15). Drivers by points: if/else 40 (75 pts), boolean chains 20, match/switch 5 (10 pts), loops 2 (5 pts) (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::handle_key_event (cognitive 91) codex-rs/tui/src/app/input.rs:400 — App::handle_key_event has cognitive complexity 91 (threshold 15). Drivers by points: if/else 35 (60 pts), boolean chains 25, loops 1 (3 pts), match/switch 2 (3 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::change_working_directory_with_managed (cognitive 83) codex-rs/tui/src/app/working_directory.rs:144 — App::change_working_directory_with_managed has cognitive complexity 83 (threshold 15). Drivers by points: if/else 39 (47 pts), boolean chains 23, match/switch 7 (11 pts), loops 2 (nesting depth added 12). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • App::finish_reconnect (cognitive 59) codex-rs/tui/src/app/reconnect.rs:302 — App::finish_reconnect has cognitive complexity 59 (threshold 15). Drivers by points: if/else 34 (47 pts), boolean chains 9, loops 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::start_agents_overview_refresh (cognitive 55) codex-rs/tui/src/app/agents_overview_threads.rs:252 — App::start_agents_overview_refresh has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (33 pts), boolean chains 9, match/switch 3 (7 pts), loops 4 (6 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::run_agents_overview_action (cognitive 54) codex-rs/tui/src/app/agents_overview_actions.rs:240 — App::run_agents_overview_action has cognitive complexity 54 (threshold 15). Drivers by points: if/else 18 (34 pts), loops 4 (9 pts), match/switch 3 (6 pts), boolean chains 5 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::retain_inactive_realtime_transcript (cognitive 51) codex-rs/tui/src/app/realtime_delivery.rs:144 — App::retain_inactive_realtime_transcript has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (32 pts), loops 4 (13 pts), boolean chains 5, match/switch 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::handle_server_request_event (cognitive 48) codex-rs/tui/src/app/app_server_events.rs:600 — App::handle_server_request_event has cognitive complexity 48 (threshold 15). Drivers by points: if/else 24 (35 pts), boolean chains 13 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::update_feature_flags (cognitive 47) codex-rs/tui/src/app/config_persistence.rs:683 — App::update_feature_flags has cognitive complexity 47 (threshold 15). Drivers by points: if/else 21 (38 pts), boolean chains 6, loops 2, match/switch 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::enqueue_thread_notification (cognitive 47) codex-rs/tui/src/app/thread_routing.rs:984 — App::enqueue_thread_notification has cognitive complexity 47 (threshold 15). Drivers by points: if/else 26 (33 pts), boolean chains 8, match/switch 4 (6 pts) (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • App::open_agent_picker (cognitive 46) codex-rs/tui/src/app/session_lifecycle.rs:36 — App::open_agent_picker has cognitive complexity 46 (threshold 15). Drivers by points: if/else 20 (32 pts), boolean chains 5, loops 4 (5 pts), match/switch 1 (4 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::apply_agents_overview_thread_refresh (cognitive 42) codex-rs/tui/src/app/agents_overview.rs:170 — App::apply_agents_overview_thread_refresh has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (31 pts), boolean chains 5, loops 3 (5 pts), match/switch 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::reset_thread_event_state (cognitive 42) codex-rs/tui/src/app/session_lifecycle.rs:794 — App::reset_thread_event_state has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 6 (16 pts), boolean chains 4 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::render_owned_transcript (cognitive 38) codex-rs/tui/src/app/owned_transcript.rs:116 — App::render_owned_transcript has cognitive complexity 38 (threshold 15). Drivers by points: if/else 27, boolean chains 11. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • App::select_agent_thread (cognitive 37) codex-rs/tui/src/app/session_lifecycle.rs:542 — App::select_agent_thread has cognitive complexity 37 (threshold 15). Drivers by points: if/else 21 (25 pts), boolean chains 8, loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • App::start_fresh_session (cognitive 37) codex-rs/tui/src/app/session_lifecycle.rs:998 — App::start_fresh_session has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (29 pts), match/switch 3 (5 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::handle_startup_thread_started (cognitive 33) codex-rs/tui/src/app/session_lifecycle.rs:867 — App::handle_startup_thread_started has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (26 pts), match/switch 2 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::overlay_forward_event (cognitive 33) codex-rs/tui/src/app_backtrack.rs:393 — App::overlay_forward_event has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 8 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::select_session_model (cognitive 32) codex-rs/tui/src/app/model_defaults.rs:19 — App::select_session_model has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 7, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • App::try_submit_active_thread_op_via_app_server (cognitive 31) codex-rs/tui/src/app/thread_routing.rs:658 — App::try_submit_active_thread_op_via_app_server has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 2 (4 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 32 more in this group — see findings.md.
D1 · Cyclomatic Complexity · codex_tui · ×56
  • codex_tui::startup_orchestration::run_main_inner (cyclomatic 125) codex-rs/tui/src/startup_orchestration.rs:10 — codex_tui::startup_orchestration::run_main_inner has cyclomatic complexity 125 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_tui::run_ratatui_app (cyclomatic 113) codex-rs/tui/src/lib.rs:1179 — codex_tui::run_ratatui_app has cyclomatic complexity 113 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_tui::analytics::normalize::history (cyclomatic 82) codex-rs/tui/src/analytics/normalize.rs:30 — codex_tui::analytics::normalize::history has cyclomatic complexity 82 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_tui::dynamic_tools::execute_inner (cyclomatic 81) codex-rs/tui/src/dynamic_tools.rs:324 — codex_tui::dynamic_tools::execute_inner has cyclomatic complexity 81 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_tui::markdown_copy::render_selection (cyclomatic 48) codex-rs/tui/src/markdown_copy.rs:341 — codex_tui::markdown_copy::render_selection has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_tui::text_formatting::center_truncate_path (cyclomatic 46) codex-rs/tui/src/text_formatting.rs:99 — codex_tui::text_formatting::center_truncate_path has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_tui::bottom_pane::footer::single_line_footer_layout (cyclomatic 35) codex-rs/tui/src/bottom_pane/footer.rs:390 — codex_tui::bottom_pane::footer::single_line_footer_layout has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_tui::resume_picker::sources::spawn (cyclomatic 35) codex-rs/tui/src/resume_picker/sources.rs:18 — codex_tui::resume_picker::sources::spawn has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_tui::markdown::unwrap_markdown_fences_with_sources (cyclomatic 33) codex-rs/tui/src/markdown.rs:279 — codex_tui::markdown::unwrap_markdown_fences_with_sources has cyclomatic complexity 33 (threshold 15). Of this number, 18 points are the body's own statements and 15 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_tui::onboarding::onboarding_screen::run_onboarding_screen_inner (cyclomatic 33) codex-rs/tui/src/onboarding/onboarding_screen.rs:619 — codex_tui::onboarding::onboarding_screen::run_onboarding_screen_inner has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_tui::bottom_pane::chat_composer::completion_target::current_prefixed_token_range_with_dollar_predicate (cyclomatic 31) codex-rs/tui/src/bottom_pane/chat_composer/completion_target.rs:87 — codex_tui::bottom_pane::chat_composer::completion_target::current_prefixed_token_range_with_dollar_predicate has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_tui::assistant_directives::parse_assistant_directive_with_budget (cyclomatic 30) codex-rs/tui/src/assistant_directives.rs:44 — codex_tui::assistant_directives::parse_assistant_directive_with_budget has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_tui::empty_state_animation::geometry::field (cyclomatic 29) codex-rs/tui/src/empty_state_animation/geometry.rs:37 — codex_tui::empty_state_animation::geometry::field has cyclomatic complexity 29 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • codex_tui::debug_config::render_debug_config_lines (cyclomatic 28) codex-rs/tui/src/debug_config.rs:122 — codex_tui::debug_config::render_debug_config_lines has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_tui::history_cell::spoken_artifacts::annotate_spoken_artifacts (cyclomatic 28) codex-rs/tui/src/history_cell/spoken_artifacts.rs:14 — codex_tui::history_cell::spoken_artifacts::annotate_spoken_artifacts has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_tui::bottom_pane::textarea::wrapping::wrapped_lines (cyclomatic 27) codex-rs/tui/src/bottom_pane/textarea/wrapping.rs:55 — codex_tui::bottom_pane::textarea::wrapping::wrapped_lines has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_tui::history_cell::mcp::new_mcp_tools_output_from_statuses (cyclomatic 27) codex-rs/tui/src/history_cell/mcp.rs:643 — codex_tui::history_cell::mcp::new_mcp_tools_output_from_statuses has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_tui::diff_render::render_change_with_preview (cyclomatic 26) codex-rs/tui/src/diff_render.rs:539 — codex_tui::diff_render::render_change_with_preview has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_tui::dynamic_tools::turn_summary (cyclomatic 26) codex-rs/tui/src/dynamic_tools.rs:1359 — codex_tui::dynamic_tools::turn_summary has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_tui::named_session_lookup::lookup (cyclomatic 26) codex-rs/tui/src/named_session_lookup.rs:48 — codex_tui::named_session_lookup::lookup has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_tui::markdown_copy::table::render (cyclomatic 25) codex-rs/tui/src/markdown_copy/table.rs:105 — codex_tui::markdown_copy::table::render has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • codex_tui::keymap_setup::key_parts_to_config_key_spec (cyclomatic 24) codex-rs/tui/src/keymap_setup.rs:687 — codex_tui::keymap_setup::key_parts_to_config_key_spec has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_tui::terminal_hyperlinks::trailing_url_end (cyclomatic 24) codex-rs/tui/src/terminal_hyperlinks.rs:560 — codex_tui::terminal_hyperlinks::trailing_url_end has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_tui::app::user_turn_submission::try_submit_user_turn (cyclomatic 23) codex-rs/tui/src/app/user_turn_submission.rs:7 — codex_tui::app::user_turn_submission::try_submit_user_turn has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_tui::status::thread_usage::grouped_usage (cyclomatic 22) codex-rs/tui/src/status/thread_usage.rs:188 — codex_tui::status::thread_usage::grouped_usage has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • + 31 more in this group — see findings.md.
D35 · Change Coupling · Change coupling · ×56
  • Change coupling: realtime.rs ↔ realtime_conversation.rs codex-rs/app-server-protocol/src/protocol/v2/realtime.rs:1 — `codex-rs/app-server-protocol/src/protocol/v2/realtime.rs` and `codex-rs/core/src/realtime_conversation.rs` change together 100% of the time (16 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 16 shared commits counted here, the most recent 3 are `6786dccb` Forward client voice session IDs in realtime requests (#53784); `90e65301` Add opt-in reasoning status for realtime V3 delegations (#47377); `536f86e5` Support attaching to existing realtime calls (#39876) — run `git show` on any of them.
  • Change coupling: plugins.rs ↔ tests.rs codex-rs/app-server/src/request_processors/plugins.rs:1 — `codex-rs/app-server/src/request_processors/plugins.rs` and `codex-rs/core-plugins/src/remote/share/tests.rs` change together 88% of the time (22 of the 25 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 22 shared commits counted here, the most recent 3 are `3fd5160c` Honor the configured product SKU in remote plugin requests (#47116); `28f3f1f9` Expose plugin installation timestamps in app-server summaries (#35859); `12b961d4` Expose plugin eligibility metadata in app-server summaries (#35837) — run `git show` on any of them.
  • Change coupling: profile_toml.rs ↔ mod.rs codex-rs/config/src/profile_toml.rs:1 — `codex-rs/config/src/profile_toml.rs` and `codex-rs/core/src/config/mod.rs` change together 88% of the time (22 of the 25 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 22 shared commits counted here, the most recent 3 are `8c818cbe` Make environment context date and timezone configurable (#52164); `c7bcb90f` package: include zsh fork in Codex package (#23756); `7dbe1c94` [codex] Remove experimental instructions file config (#22724) — run `git show` on any of them.
  • Change coupling: extension.rs ↔ world_state.rs codex-rs/ext/skills/src/extension.rs:1 — `codex-rs/ext/skills/src/extension.rs` and `codex-rs/ext/skills/src/world_state.rs` change together 87% of the time (13 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `e72da2b5` Stabilize skill catalogs across executor availability changes (#48353); `a1890b69` Project orchestrator skills through world state (#37149); `5e8b2248` Use the host skill provider catalog in world state (#36309) — run `git show` on any of them.
  • Change coupling: sandboxed_file_system.rs ↔ file_system_handler.rs codex-rs/exec-server/src/sandboxed_file_system.rs:1 — `codex-rs/exec-server/src/sandboxed_file_system.rs` and `codex-rs/exec-server/src/server/file_system_handler.rs` change together 86% of the time (12 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 12 shared commits counted here, the most recent 3 are `c39bfa4c` Enable writable file streaming in exec-server (#50177); `d25c114d` Bound in-flight file opens in exec-server (#50162); `a4ee536f` Route filesystem reads and writes by their own sandbox permissions (#… — run `git show` on any of them.
  • Change coupling: http_proxy.rs ↔ socks5.rs codex-rs/network-proxy/src/http_proxy.rs:1 — `codex-rs/network-proxy/src/http_proxy.rs` and `codex-rs/network-proxy/src/socks5.rs` change together 84% of the time (16 of the 19 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 16 shared commits counted here, the most recent 3 are `634ebc18` Support credential brokering in plaintext HTTP tunnels (#44089); `56d3e819` Refactor credential-broker tunnel protocol detection (#44077); `5a65fd87` Close active network proxy connections on teardown (#43884) — run `git show` on any of them.
  • Change coupling: markdown_stream.rs ↔ controller.rs codex-rs/tui/src/markdown_stream.rs:1 — `codex-rs/tui/src/markdown_stream.rs` and `codex-rs/tui/src/streaming/controller.rs` change together 80% of the time (8 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `86ee40c3` Keep TUI Markdown colors readable against their backgrounds (#54315); `5a11c456` Render TUI Markdown lists with Unicode bullets and checkboxes (#47322); `b966240b` Preview streaming prose before a newline arrives in the TUI (#45135) — run `git show` on any of them.
  • Change coupling: thread_config.rs ↔ auth_env_telemetry.rs codex-rs/config/src/thread_config.rs:1 — `codex-rs/config/src/thread_config.rs` and `codex-rs/login/src/auth_env_telemetry.rs` change together 80% of the time (8 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `be7cd6fd` Add a credential file override for GCP provider authentication (#57188); `970111f6` Allow configuring GCP project and location in provider settings (#56560); `c6049ebd` Add capability overrides for custom model providers (#50459) — run `git show` on any of them.
  • Change coupling: markdown_render.rs ↔ markdown_stream.rs codex-rs/tui/src/markdown_render.rs:1 — `codex-rs/tui/src/markdown_render.rs` and `codex-rs/tui/src/markdown_stream.rs` change together 80% of the time (8 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `86ee40c3` Keep TUI Markdown colors readable against their backgrounds (#54315); `e89b7c44` Apply syntax theme colors to Markdown prose in the TUI (#54217); `abc8f0c9` Use the terminal palette for ordered Markdown list markers (#48800) — run `git show` on any of them.
  • Change coupling: app_server_event_targets.rs ↔ protocol.rs codex-rs/tui/src/app/app_server_event_targets.rs:1 — `codex-rs/tui/src/app/app_server_event_targets.rs` and `codex-rs/tui/src/chatwidget/protocol.rs` change together 78% of the time (14 of the 18 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 14 shared commits counted here, the most recent 3 are `82883da2` Notify subscribers when thread read state changes (#52384); `90abcfac` Add experimental thread prediction protocol types (#49480); `4773a132` Add `/mcp login <name>` to the TUI (#49290) — run `git show` on any of them.
  • Change coupling: bindings.rs ↔ actions.rs codex-rs/tui/src/keymap/bindings.rs:1 — `codex-rs/tui/src/keymap/bindings.rs` and `codex-rs/tui/src/keymap_setup/actions.rs` change together 76% of the time (13 of the 17 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `ce03f22a` Add a configurable F8 shortcut for voice conversations (#46071); `bf5ebd98` Add a hide shortcut to the agents overview (#44424); `45305dd2` Make the voice mute shortcut configurable in the TUI (#43690) — run `git show` on any of them.
  • Change coupling: execute_handler.rs ↔ wait_handler.rs codex-rs/core/src/tools/code_mode/execute_handler.rs:1 — `codex-rs/core/src/tools/code_mode/execute_handler.rs` and `codex-rs/core/src/tools/code_mode/wait_handler.rs` change together 75% of the time (9 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `a79a18cd` Expose tool dispatch and timing observations to extensions (#47662); `0fd1cd8d` Add opt-in overhead timing to code-mode responses (#46288); `205f3671` Use captured step settings for tool planning and execution (#44242) — run `git show` on any of them.
  • Change coupling: agents_overview_threads.rs ↔ agents_overview_view.rs codex-rs/tui/src/app/agents_overview_threads.rs:1 — `codex-rs/tui/src/app/agents_overview_threads.rs` and `codex-rs/tui/src/app/agents_overview_view.rs` change together 73% of the time (8 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `7298a6e0` Add shared task pinning to the agent command center (#51500); `47379efd` Keep Command Center selection adjacent after task removal (#50505); `8f651777` Add history pagination to the agent command center (#49106) — run `git show` on any of them.
  • Change coupling: status_line_setup.rs ↔ title_setup.rs codex-rs/tui/src/bottom_pane/status_line_setup.rs:1 — `codex-rs/tui/src/bottom_pane/status_line_setup.rs` and `codex-rs/tui/src/bottom_pane/title_setup.rs` change together 73% of the time (8 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `8ea2428c` Add Daybreak state to the status line and terminal title (#49861); `1e71e35d` Add thread usage to TUI status surfaces (#38282); `f1d029cf` Add reasoning-only status surface item (#25504) — run `git show` on any of them.
  • Change coupling: protocol_event.rs ↔ policy.rs codex-rs/rollout-trace/src/protocol_event.rs:1 — `codex-rs/rollout-trace/src/protocol_event.rs` and `codex-rs/rollout/src/policy.rs` change together 71% of the time (15 of the 21 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 15 shared commits counted here, the most recent 3 are `07316174` Forward Guardian reviewer events to parent raw-event subscribers (#56…; `a6baf886` Signal abandonment of unanswered MCP elicitations (#51611); `3afbd8dd` Report selected environment connection transitions (#33251) — run `git show` on any of them.
  • Change coupling: mcp.rs ↔ plugin.rs codex-rs/core/src/mcp.rs:1 — `codex-rs/core/src/mcp.rs` and `codex-rs/ext/mcp/src/plugin.rs` change together 67% of the time (8 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `c7e80f87` Preserve executor MCP credential boundaries across reconnects (#48143); `e8098eb4` Separate selected plugin identities from MCP contributions (#47939); `5ce04789` Honor managed plugin disablement for executor capabilities (#40640) (at that commit the file was still `codex-rs/ext/mcp/src/executor_plugin.rs`) — run `git show` on any of them.
  • Change coupling: exec_command.rs ↔ write_stdin.rs codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs:1 — `codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs` and `codex-rs/core/src/tools/handlers/unified_exec/write_stdin.rs` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `0c5720ea` Keep environment tools stable across readiness changes (#54098); `335c7f8e` Gate stable environment tool exposure behind a feature flag (#50962); `550eb505` Keep environment-backed tools exposed across readiness changes (#50741) — run `git show` on any of them.
  • Change coupling: installed.rs ↔ connectors.rs codex-rs/app-server/src/request_processors/apps_processor/installed.rs:1 — `codex-rs/app-server/src/request_processors/apps_processor/installed.rs` and `codex-rs/core/src/connectors.rs` change together 62% of the time (8 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `c45ea25f` Allow subagents to request MCP elicitation input (#46877); `40584fad` Keep MCP user interaction on the root thread (#46066); `ae357e72` Attach verified access context to eligible plugin MCP calls (#41005) — run `git show` on any of them.
  • Change coupling: mcp_refresh.rs ↔ message_processor.rs codex-rs/app-server/src/mcp_refresh.rs:1 — `codex-rs/app-server/src/mcp_refresh.rs` and `codex-rs/app-server/src/message_processor.rs` change together 61% of the time (19 of the 31 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 19 shared commits counted here, the most recent 3 are `e776b27e` Add frozen cloud skill snapshots to the app server (#55631); `8f8e7a6e` Add experimental `thread/sample` requests to the app server (#55339); `82d95859` Gate the file-copy extension behind `multi_env_copy_file` (#54741) — run `git show` on any of them.
  • Change coupling: config_processor.rs ↔ stack.rs codex-rs/app-server/src/request_processors/config_processor.rs:1 — `codex-rs/app-server/src/request_processors/config_processor.rs` and `codex-rs/config/src/requirements_layers/stack.rs` change together 60% of the time (9 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `b27a6321` Expose managed application network requirements (#42417); `950dd184` Expand browser and computer use requirements (#39995); `1674b0a1` Expose managed policy for browser settings imports (#39720) — run `git show` on any of them.
  • Change coupling: lifecycle.rs ↔ contributors.rs codex-rs/core/src/tools/lifecycle.rs:1 — `codex-rs/core/src/tools/lifecycle.rs` and `codex-rs/ext/extension-api/src/contributors.rs` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `b244e9ba` Add a command-start callback for tool lifecycle extensions (#46539); `5bf0ba3d` Let extensions process MCP tool results (#41202); `21ff2e80` Expose MCP provenance to tool lifecycle extensions (#40976) — run `git show` on any of them.
  • Change coupling: send_input.rs ↔ message_tool.rs codex-rs/core/src/tools/handlers/multi_agents/send_input.rs:1 — `codex-rs/core/src/tools/handlers/multi_agents/send_input.rs` and `codex-rs/core/src/tools/handlers/multi_agents_v2/message_tool.rs` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `b13164d8` Centralize child agent configuration in the agent module (#45669); `e004dc6a` Preserve turn triggers across delegated agent work (#44659); `d21794d6` Reload Multi-Agent V2 children through their parent (#40477) — run `git show` on any of them.
  • Change coupling: apply_patch.rs ↔ request_permissions.rs codex-rs/core/src/tools/handlers/apply_patch.rs:1 — `codex-rs/core/src/tools/handlers/apply_patch.rs` and `codex-rs/core/src/tools/handlers/request_permissions.rs` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `0c5720ea` Keep environment tools stable across readiness changes (#54098); `335c7f8e` Gate stable environment tool exposure behind a feature flag (#50962); `550eb505` Keep environment-backed tools exposed across readiness changes (#50741) — run `git show` on any of them.
  • Change coupling: event_processor_with_human_output.rs ↔ event_processor_with_jsonl_output.rs codex-rs/exec/src/event_processor_with_human_output.rs:1 — `codex-rs/exec/src/event_processor_with_human_output.rs` and `codex-rs/exec/src/event_processor_with_jsonl_output.rs` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `a219b6fd` core: migrate standalone web search to extension-owned turn items (#3…; `7fbbc9f0` [codex] Surface runtime warnings in codex exec (#27415); `3f266bcd` feat: make interrupt state not final for multi-agents (#13850) — run `git show` on any of them.
  • Change coupling: app_event.rs ↔ slash_command.rs codex-rs/tui/src/app_event.rs:1 — `codex-rs/tui/src/app_event.rs` and `codex-rs/tui/src/slash_command.rs` change together 58% of the time (49 of the 84 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 49 shared commits counted here, the most recent 3 are `b095b2ef` Support inline permission profile selection with `/permissions` (#54383); `dcd9e954` Add `/presets` for reusable prompts and slash commands (#54380); `0884c804` Support inline model, reasoning, and speed selection in `/model` (#54… — run `git show` on any of them.
  • + 31 more in this group — see findings.md.
D2 · Cognitive Complexity · codex_core · ×53
  • codex_core::session::turn::try_run_sampling_request (cognitive 213) codex-rs/core/src/session/turn.rs:2657 — codex_core::session::turn::try_run_sampling_request has cognitive complexity 213 (threshold 15). Drivers by points: if/else 65 (174 pts), match/switch 9 (22 pts), boolean chains 16, loops 1 (nesting depth added 122). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core::session::turn::run_turn (cognitive 135) codex-rs/core/src/session/turn.rs:174 — codex_core::session::turn::run_turn has cognitive complexity 135 (threshold 15). Drivers by points: if/else 40 (105 pts), boolean chains 16, match/switch 6 (12 pts), loops 2 (nesting depth added 71). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • codex_core::guardian::review_session::run_review_on_session (cognitive 59) codex-rs/core/src/guardian/review_session.rs:331 — codex_core::guardian::review_session::run_review_on_session has cognitive complexity 59 (threshold 15). Drivers by points: if/else 25 (32 pts), match/switch 11 (20 pts), boolean chains 7 (nesting depth added 16). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_core::compact_remote_v2::truncate_retained_messages (cognitive 55) codex-rs/core/src/compact_remote_v2.rs:606 — codex_core::compact_remote_v2::truncate_retained_messages has cognitive complexity 55 (threshold 15). Drivers by points: if/else 21 (50 pts), boolean chains 4, loops 1 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • codex_core::session::mcp::review_guardian_mcp_elicitation (cognitive 52) codex-rs/core/src/session/mcp.rs:944 — codex_core::session::mcp::review_guardian_mcp_elicitation has cognitive complexity 52 (threshold 15). Drivers by points: if/else 20 (36 pts), boolean chains 9, match/switch 4 (7 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core::shell_snapshot::capture_snapshot (cognitive 52) codex-rs/core/src/shell_snapshot.rs:576 — codex_core::shell_snapshot::capture_snapshot has cognitive complexity 52 (threshold 15). Drivers by points: boolean chains 24, if/else 15 (19 pts), loops 7 (9 pts) (nesting depth added 6). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • codex_core::config::edit::document_helpers::serialize_mcp_server_table (cognitive 48) codex-rs/core/src/config/edit/document_helpers.rs:50 — codex_core::config::edit::document_helpers::serialize_mcp_server_table has cognitive complexity 48 (threshold 15). Drivers by points: if/else 30 (33 pts), boolean chains 8, match/switch 4 (5 pts), loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • codex_core::client::map_response_events (cognitive 46) codex-rs/core/src/client.rs:2641 — codex_core::client::map_response_events has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (40 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core::tools::runtimes::maybe_wrap_shell_lc_with_snapshot (cognitive 43) codex-rs/core/src/tools/runtimes/mod.rs:286 — codex_core::tools::runtimes::maybe_wrap_shell_lc_with_snapshot has cognitive complexity 43 (threshold 15). Drivers by points: if/else 31 (34 pts), boolean chains 8, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_core::exec::consume_output (cognitive 42) codex-rs/core/src/exec.rs:982 — codex_core::exec::consume_output has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (25 pts), match/switch 8 (16 pts), boolean chains 1 (nesting depth added 22). Of this number, 39 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core::realtime_context::build_current_thread_section (cognitive 42) codex-rs/core/src/realtime_context.rs:213 — codex_core::realtime_context::build_current_thread_section has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (34 pts), boolean chains 4, loops 2, match/switch 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core::session::handlers::submission_loop (cognitive 40) codex-rs/core/src/session/handlers.rs:443 — codex_core::session::handlers::submission_loop has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 6 (15 pts), boolean chains 2, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core::compact_remote_v2::collect_compaction_output (cognitive 37) codex-rs/core/src/compact_remote_v2.rs:375 — codex_core::compact_remote_v2::collect_compaction_output has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 5 (13 pts), boolean chains 1, loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core::tools::runtimes::prepare_brokered_shell_snapshot_env (cognitive 35) codex-rs/core/src/tools/runtimes/mod.rs:200 — codex_core::tools::runtimes::prepare_brokered_shell_snapshot_env has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 2 (6 pts), boolean chains 4 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core::compact::build_compacted_history_with_limit (cognitive 34) codex-rs/core/src/compact.rs:710 — codex_core::compact::build_compacted_history_with_limit has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (30 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core::realtime_conversation::sideband::spawn_webrtc_sideband_input_task (cognitive 34) codex-rs/core/src/realtime_conversation/sideband.rs:27 — codex_core::realtime_conversation::sideband::spawn_webrtc_sideband_input_task has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 6 (12 pts), boolean chains 5, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core::compact_remote_v2_images::truncate_message_to_token_budget (cognitive 32) codex-rs/core/src/compact_remote_v2_images.rs:31 — codex_core::compact_remote_v2_images::truncate_message_to_token_budget has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 2 (4 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core::guardian::input_budget::finalize (cognitive 31) codex-rs/core/src/guardian/input_budget.rs:120 — codex_core::guardian::input_budget::finalize has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 5 (7 pts), match/switch 3 (5 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_core::mcp_tool_exposure::append_mcp_tools (cognitive 29) codex-rs/core/src/mcp_tool_exposure.rs:136 — codex_core::mcp_tool_exposure::append_mcp_tools has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (23 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core::session::turn::handle_plan_segments (cognitive 29) codex-rs/core/src/session/turn.rs:2324 — codex_core::session::turn::handle_plan_segments has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (25 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core::realtime_conversation::handle_realtime_server_event (cognitive 28) codex-rs/core/src/realtime_conversation.rs:2604 — codex_core::realtime_conversation::handle_realtime_server_event has cognitive complexity 28 (threshold 15). Drivers by points: match/switch 9 (15 pts), if/else 5 (12 pts), boolean chains 1 (nesting depth added 13). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_core::compact_remote_v2_installation::build_and_install_compaction (cognitive 26) codex-rs/core/src/compact_remote_v2_installation.rs:73 — codex_core::compact_remote_v2_installation::build_and_install_compaction has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (17 pts), match/switch 2 (5 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_core::context_manager::normalize::strip_images_when_unsupported (cognitive 26) codex-rs/core/src/context_manager/normalize.rs:346 — codex_core::context_manager::normalize::strip_images_when_unsupported has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (8 pts), match/switch 2 (7 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core::context_manager::normalize::strip_audio_when_unsupported (cognitive 26) codex-rs/core/src/context_manager/normalize.rs:394 — codex_core::context_manager::normalize::strip_audio_when_unsupported has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 3 (8 pts), match/switch 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core::mcp_tool_call::handle_mcp_tool_call (cognitive 26) codex-rs/core/src/mcp_tool_call.rs:134 — codex_core::mcp_tool_call::handle_mcp_tool_call has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (17 pts), match/switch 4 (8 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • + 28 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×52
  • Duplicated block (7 lines × 2) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1457 — codex-rs/app-server-protocol/src/protocol/thread_history.rs:1457-1463 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:1485-1491 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/apply-patch/src/seek_sequence.rs:38 — codex-rs/apply-patch/src/seek_sequence.rs:38-44 | codex-rs/apply-patch/src/seek_sequence.rs:51-57 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/cloud-tasks-client/src/http.rs:912 — codex-rs/cloud-tasks-client/src/http.rs:912-918 | codex-rs/cloud-tasks/src/util.rs:19-25 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) codex-rs/cloud-tasks/src/env_detect.rs:342 — codex-rs/cloud-tasks/src/env_detect.rs:342-348 | codex-rs/cloud-tasks/src/env_detect.rs:380-386 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/code-mode-runtime/src/runtime/value.rs:117 — codex-rs/code-mode-runtime/src/runtime/value.rs:117-123 | codex-rs/code-mode-runtime/src/runtime/value.rs:246-252 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/core/src/session/mod.rs:3163 — codex-rs/core/src/session/mod.rs:3163-3169 | codex-rs/core/src/session/mod.rs:3384-3390 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/core/src/skills.rs:136 — codex-rs/core/src/skills.rs:136-142 | codex-rs/core/src/skills.rs:232-240 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/execpolicy/src/parser.rs:362 — codex-rs/execpolicy/src/parser.rs:362-368 | codex-rs/execpolicy/src/parser.rs:419-425 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/external-agent-migration/src/detect/sessions/connectors_cla.rs:210 — codex-rs/external-agent-migration/src/detect/sessions/connectors_cla.rs:210-216 | codex-rs/external-agent-migration/src/detect/sessions/cur.rs:60-66 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) codex-rs/external-agent-migration/src/service.rs:596 — codex-rs/external-agent-migration/src/service.rs:596-602 | codex-rs/external-agent-migration/src/service.rs:640-646 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/feedback/src/lib.rs:143 — codex-rs/feedback/src/lib.rs:143-149 | codex-rs/feedback/src/lib.rs:167-173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/hooks/src/engine/discovery.rs:489 — codex-rs/hooks/src/engine/discovery.rs:489-495 | codex-rs/login/src/server.rs:1003-1009 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) codex-rs/http-client/src/transport.rs:176 — codex-rs/http-client/src/transport.rs:176-182 | codex-rs/http-client/src/transport.rs:216-222 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/network-proxy/src/credential_broker.rs:1515 — codex-rs/network-proxy/src/credential_broker.rs:1515-1521 | codex-rs/network-proxy/src/credential_broker/environment.rs:202-208 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) codex-rs/network-proxy/src/http_proxy.rs:279 — codex-rs/network-proxy/src/http_proxy.rs:279-285 | codex-rs/network-proxy/src/http_proxy.rs:361-367 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/network-proxy/src/socks5.rs:250 — codex-rs/network-proxy/src/socks5.rs:250-256 | codex-rs/network-proxy/src/socks5.rs:353-359 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/network-proxy/src/socks5.rs:711 — codex-rs/network-proxy/src/socks5.rs:711-717 | codex-rs/network-proxy/src/socks5.rs:800-806 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/state/src/runtime/threads.rs:725 — codex-rs/state/src/runtime/threads.rs:725-731 | codex-rs/state/src/runtime/threads.rs:1064-1070 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/thread-store/src/local/archive_thread.rs:26 — codex-rs/thread-store/src/local/archive_thread.rs:26-32 | REDACTED:133-139 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) codex-rs/tui/src/app_server_session.rs:2295 — codex-rs/tui/src/app_server_session.rs:2295-2301 | codex-rs/tui/src/app_server_session.rs:2345-2351 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/tui/src/bottom_pane/app_link_view.rs:486 — codex-rs/tui/src/bottom_pane/app_link_view.rs:486-492 | codex-rs/tui/src/bottom_pane/app_link_view.rs:498-504 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/tui/src/bottom_pane/mentions_v2/render.rs:287 — codex-rs/tui/src/bottom_pane/mentions_v2/render.rs:287-293 | codex-rs/tui/src/bottom_pane/mentions_v2/render.rs:334-340 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/tui/src/bottom_pane/textarea.rs:1454 — codex-rs/tui/src/bottom_pane/textarea.rs:1454-1460 | codex-rs/tui/src/bottom_pane/textarea.rs:1525-1531 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) codex-rs/tui/src/chatwidget/plugin_catalog.rs:980 — codex-rs/tui/src/chatwidget/plugin_catalog.rs:980-986 | codex-rs/tui/src/chatwidget/plugins.rs:867-873 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) codex-rs/tui/src/external_agent_config_migration/mod.rs:112 — codex-rs/tui/src/external_agent_config_migration/mod.rs:112-118 | codex-rs/tui/src/external_agent_config_migration/source.rs:71-77 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • + 27 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×50
  • Duplicated block (8 lines × 2) codex-rs/app-server-transport/src/transport/remote_control/mod.rs:438 — codex-rs/app-server-transport/src/transport/remote_control/mod.rs:438-445 | codex-rs/app-server-transport/src/transport/remote_control/mod.rs:686-693 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) codex-rs/app-server/src/request_processors/plugins.rs:1031 — codex-rs/app-server/src/request_processors/plugins.rs:1031-1038 | codex-rs/app-server/src/request_processors/plugins.rs:1601-1608 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) codex-rs/app-server/src/request_processors/thread_goal_processor.rs:342 — codex-rs/app-server/src/request_processors/thread_goal_processor.rs:342-349 | codex-rs/app-server/src/request_processors/thread_goal_processor.rs:403-410 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) codex-rs/backend-client/src/client.rs:325 — codex-rs/backend-client/src/client.rs:325-332 | codex-rs/backend-client/src/client.rs:346-353 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) codex-rs/codex-api/src/endpoint/session.rs:98 — codex-rs/codex-api/src/endpoint/session.rs:98-105 | codex-rs/codex-api/src/endpoint/session.rs:139-146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) codex-rs/config/src/config_requirements.rs:358 — codex-rs/config/src/config_requirements.rs:358-365 | codex-rs/config/src/permissions_toml.rs:254-261 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) codex-rs/config/src/config_requirements.rs:368 — codex-rs/config/src/config_requirements.rs:368-375 | codex-rs/config/src/permissions_toml.rs:264-271 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) codex-rs/core-plugins/src/manager.rs:2366 — codex-rs/core-plugins/src/manager.rs:2366-2373 | codex-rs/core-plugins/src/manager.rs:2431-2438 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) codex-rs/core/src/config/mod.rs:2873 — codex-rs/core/src/config/mod.rs:2873-2880 | codex-rs/core/src/config/mod.rs:2907-2914 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) codex-rs/core/src/session/turn.rs:2241 — codex-rs/core/src/session/turn.rs:2241-2248 | codex-rs/rollout/src/policy.rs:173-180 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) codex-rs/core/src/session/turn_context.rs:436 — codex-rs/core/src/session/turn_context.rs:436-443 | codex-rs/core/src/session/turn_context.rs:848-855 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) codex-rs/core/src/tasks/user_shell.rs:250 — codex-rs/core/src/tasks/user_shell.rs:250-257 | codex-rs/core/src/tasks/user_shell.rs:323-330 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) codex-rs/core/src/tools/handlers/extension_tools.rs:187 — codex-rs/core/src/tools/handlers/extension_tools.rs:187-194 | codex-rs/core/src/tools/handlers/extension_tools.rs:202-209 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) codex-rs/exec/src/lib.rs:1572 — codex-rs/exec/src/lib.rs:1572-1579 | codex-rs/exec/src/lib.rs:1596-1603 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) codex-rs/ext/goal/src/accounting.rs:378 — codex-rs/ext/goal/src/accounting.rs:378-385 | codex-rs/ext/goal/src/accounting.rs:394-401 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) codex-rs/ext/memories/src/local/list.rs:20 — codex-rs/ext/memories/src/local/list.rs:20-27 | codex-rs/ext/memories/src/local/search.rs:38-45 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) codex-rs/ext/memories/src/schema.rs:15 — codex-rs/ext/memories/src/schema.rs:15-22 | codex-rs/ext/skills/src/tools/schema.rs:15-22 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) codex-rs/login/src/auth/manager.rs:2335 — codex-rs/login/src/auth/manager.rs:2335-2342 | codex-rs/login/src/auth/manager.rs:2365-2372 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) codex-rs/protocol/src/permissions.rs:1457 — codex-rs/protocol/src/permissions.rs:1457-1464 | codex-rs/protocol/src/permissions.rs:1564-1571 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) codex-rs/rollout-trace/src/code_cell.rs:178 — codex-rs/rollout-trace/src/code_cell.rs:178-185 | codex-rs/rollout-trace/src/tool_dispatch.rs:381-388 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) codex-rs/rollout-trace/src/compaction.rs:199 — codex-rs/rollout-trace/src/compaction.rs:199-206 | codex-rs/rollout-trace/src/inference.rs:190-197 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) codex-rs/shell-command/src/command_safety/is_dangerous_command.rs:113 — codex-rs/shell-command/src/command_safety/is_dangerous_command.rs:113-120 | codex-rs/shell-command/src/command_safety/windows_dangerous_commands.rs:404-411 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) codex-rs/shell-command/src/parse_command.rs:2582 — codex-rs/shell-command/src/parse_command.rs:2582-2589 | codex-rs/shell-command/src/parse_command.rs:2635-2642 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) codex-rs/shell-command/src/shell_snapshot_restore.rs:18 — codex-rs/shell-command/src/shell_snapshot_restore.rs:18-25 | codex-rs/shell-command/src/shell_snapshot_restore.rs:40-47 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) codex-rs/tui/src/bottom_pane/chat_composer/slash_input.rs:569 — codex-rs/tui/src/bottom_pane/chat_composer/slash_input.rs:569-576 | codex-rs/tui/src/chatwidget/slash_dispatch.rs:1385-1392 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • + 25 more in this group — see findings.md.
D1 · Cyclomatic Complexity · App · ×49
  • App::handle_event (cyclomatic 622) codex-rs/tui/src/app/event_dispatch.rs:29 — App::handle_event has cyclomatic complexity 622 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::run (cyclomatic 207) codex-rs/tui/src/app/startup.rs:232 — App::run has cyclomatic complexity 207 (threshold 15). Of this number, 206 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::handle_tui_event (cyclomatic 91) codex-rs/tui/src/app.rs:861 — App::handle_tui_event has cyclomatic complexity 91 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::handle_owned_transcript_event (cyclomatic 86) codex-rs/tui/src/app/owned_transcript.rs:395 — App::handle_owned_transcript_event has cyclomatic complexity 86 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::attach_agents_overview_thread (cyclomatic 81) codex-rs/tui/src/app/agents_overview.rs:441 — App::attach_agents_overview_thread has cyclomatic complexity 81 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::handle_server_notification_event (cyclomatic 76) codex-rs/tui/src/app/app_server_events.rs:166 — App::handle_server_notification_event has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::change_working_directory_with_managed (cyclomatic 69) codex-rs/tui/src/app/working_directory.rs:144 — App::change_working_directory_with_managed has cyclomatic complexity 69 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • App::handle_key_event (cyclomatic 64) codex-rs/tui/src/app/input.rs:400 — App::handle_key_event has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::finish_reconnect (cyclomatic 43) codex-rs/tui/src/app/reconnect.rs:302 — App::finish_reconnect has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::enqueue_thread_notification (cyclomatic 38) codex-rs/tui/src/app/thread_routing.rs:984 — App::enqueue_thread_notification has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • App::handle_server_request_event (cyclomatic 36) codex-rs/tui/src/app/app_server_events.rs:600 — App::handle_server_request_event has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::start_agents_overview_refresh (cyclomatic 33) codex-rs/tui/src/app/agents_overview_threads.rs:252 — App::start_agents_overview_refresh has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::render_owned_transcript (cyclomatic 32) codex-rs/tui/src/app/owned_transcript.rs:116 — App::render_owned_transcript has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • App::update_feature_flags (cyclomatic 31) codex-rs/tui/src/app/config_persistence.rs:683 — App::update_feature_flags has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::select_agent_thread (cyclomatic 31) codex-rs/tui/src/app/session_lifecycle.rs:542 — App::select_agent_thread has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • App::run_agents_overview_action (cyclomatic 30) codex-rs/tui/src/app/agents_overview_actions.rs:240 — App::run_agents_overview_action has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::route_key_chord_event (cyclomatic 30) codex-rs/tui/src/app/input.rs:69 — App::route_key_chord_event has cyclomatic complexity 30 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • App::open_agent_picker (cyclomatic 29) codex-rs/tui/src/app/session_lifecycle.rs:36 — App::open_agent_picker has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::try_submit_active_thread_op_via_app_server (cyclomatic 28) codex-rs/tui/src/app/thread_routing.rs:658 — App::try_submit_active_thread_op_via_app_server has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::select_mode_owns_chord (cyclomatic 27) codex-rs/tui/src/app/input/select_mode.rs:17 — App::select_mode_owns_chord has cyclomatic complexity 27 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • App::retain_inactive_realtime_transcript (cyclomatic 26) codex-rs/tui/src/app/realtime_delivery.rs:144 — App::retain_inactive_realtime_transcript has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::track_agents_overview_notification (cyclomatic 25) codex-rs/tui/src/app/agents_overview_threads.rs:82 — App::track_agents_overview_notification has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::select_session_model (cyclomatic 23) codex-rs/tui/src/app/model_defaults.rs:19 — App::select_session_model has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::continue_misalignment (cyclomatic 22) codex-rs/tui/src/app/misalignment_policy.rs:50 — App::continue_misalignment has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • App::replay_thread_snapshot (cyclomatic 22) codex-rs/tui/src/app/thread_routing.rs:1670 — App::replay_thread_snapshot has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • + 24 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×49
  • Duplicated block (10 lines × 2) codex-rs/app-server-daemon/src/lib.rs:493 — codex-rs/app-server-daemon/src/lib.rs:493-502 | codex-rs/app-server-daemon/src/lib.rs:863-872 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) codex-rs/app-server-protocol/src/export.rs:2069 — codex-rs/app-server-protocol/src/export.rs:2069-2078 | codex-rs/app-server-protocol/src/precomputed_exports.rs:195-204 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (10 lines × 2) codex-rs/cli/src/doctor.rs:648 — codex-rs/cli/src/doctor.rs:648-657 | codex-rs/cli/src/main.rs:2105-2114 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (10 lines × 2) codex-rs/cli/src/doctor/output.rs:823 — codex-rs/cli/src/doctor/output.rs:823-832 | codex-rs/cli/src/doctor/output.rs:1079-1088 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) codex-rs/cli/src/mcp_cmd.rs:858 — codex-rs/cli/src/mcp_cmd.rs:858-867 | codex-rs/cli/src/mcp_cmd.rs:915-924 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) codex-rs/cli/src/plugin_cmd.rs:381 — codex-rs/cli/src/plugin_cmd.rs:381-390 | codex-rs/core-plugins/src/manager.rs:3739-3748 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) codex-rs/code-mode-runtime/src/runtime/callbacks.rs:117 — codex-rs/code-mode-runtime/src/runtime/callbacks.rs:117-126 | codex-rs/code-mode-runtime/src/runtime/callbacks.rs:152-161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) codex-rs/codex-mcp/src/binding_clients.rs:81 — codex-rs/codex-mcp/src/binding_clients.rs:81-90 | codex-rs/codex-mcp/src/binding_clients.rs:109-118 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) codex-rs/codex-mcp/src/connection_manager.rs:733 — codex-rs/codex-mcp/src/connection_manager.rs:733-742 | codex-rs/codex-mcp/src/connection_manager.rs:850-859 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) codex-rs/context-fragments/src/fragment.rs:168 — codex-rs/context-fragments/src/fragment.rs:168-177 | codex-rs/memories/write/src/rollout_input.rs:362-371 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) codex-rs/core/src/client.rs:3161 — codex-rs/core/src/client.rs:3161-3170 | codex-rs/core/src/client.rs:3216-3225 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) codex-rs/core/src/context/environment_context.rs:200 — codex-rs/core/src/context/environment_context.rs:200-209 | codex-rs/hooks/src/engine/discovery.rs:490-499 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) codex-rs/core/src/context/world_state/apps_instructions.rs:40 — codex-rs/core/src/context/world_state/apps_instructions.rs:40-49 | codex-rs/core/src/context/world_state/plugins_instructions.rs:40-49 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (10 lines × 2) codex-rs/core/src/context_manager/normalize.rs:352 — codex-rs/core/src/context_manager/normalize.rs:352-361 | codex-rs/core/src/context_manager/normalize.rs:399-408 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) codex-rs/core/src/tools/handlers/multi_agents/wait.rs:157 — codex-rs/core/src/tools/handlers/multi_agents/wait.rs:157-166 | codex-rs/core/src/tools/handlers/multi_agents/wait.rs:228-237 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) codex-rs/core/src/tools/handlers/request_user_input_async.rs:140 — codex-rs/core/src/tools/handlers/request_user_input_async.rs:140-149 | codex-rs/core/src/tools/handlers/send_message_to_user_async.rs:93-102 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (10 lines × 2) codex-rs/network-proxy/src/http_proxy.rs:607 — codex-rs/network-proxy/src/http_proxy.rs:607-616 | codex-rs/network-proxy/src/http_proxy.rs:751-760 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) codex-rs/network-proxy/src/mitm.rs:494 — codex-rs/network-proxy/src/mitm.rs:494-503 | codex-rs/network-proxy/src/mitm.rs:543-552 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) codex-rs/network-proxy/src/socks5.rs:221 — codex-rs/network-proxy/src/socks5.rs:221-230 | codex-rs/network-proxy/src/socks5.rs:682-691 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) codex-rs/otel/src/provider.rs:462 — codex-rs/otel/src/provider.rs:462-471 | codex-rs/otel/src/provider.rs:544-553 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) codex-rs/protocol/src/approvals.rs:366 — codex-rs/protocol/src/approvals.rs:366-375 | codex-rs/tui/src/approval_events.rs:57-66 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) codex-rs/rollout/src/reverse_jsonl_scanner.rs:100 — codex-rs/rollout/src/reverse_jsonl_scanner.rs:100-109 | codex-rs/rollout/src/reverse_jsonl_scanner.rs:119-128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) codex-rs/secrets/src/lib.rs:169 — codex-rs/secrets/src/lib.rs:169-178 | codex-rs/secrets/src/lib.rs:185-194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) codex-rs/state/src/runtime/logs.rs:76 — codex-rs/state/src/runtime/logs.rs:76-85 | codex-rs/state/src/runtime/logs.rs:158-167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) REDACTED:240 — REDACTED:240-249 | REDACTED:255-264 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 24 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×47
  • Duplicated block (9 lines × 2) codex-rs/app-server/src/request_processors/account_processor.rs:725 — codex-rs/app-server/src/request_processors/account_processor.rs:725-734 | codex-rs/app-server/src/request_processors/account_processor.rs:797-805 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) codex-rs/app-server/src/request_processors/catalog_processor.rs:438 — codex-rs/app-server/src/request_processors/catalog_processor.rs:438-446 | codex-rs/app-server/src/request_processors/mcp_processor.rs:541-549 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) codex-rs/app-server/src/request_processors/plugins.rs:1510 — codex-rs/app-server/src/request_processors/plugins.rs:1510-1518 | codex-rs/app-server/src/request_processors/plugins.rs:1602-1610 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) codex-rs/app-server/src/request_processors/thread_goal_processor.rs:539 — codex-rs/app-server/src/request_processors/thread_goal_processor.rs:539-547 | codex-rs/ext/goal/src/tool.rs:506-514 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) codex-rs/cloud-tasks-client/src/http.rs:804 — codex-rs/cloud-tasks-client/src/http.rs:804-812 | codex-rs/cloud-tasks-mock-client/src/mock.rs:256-264 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) codex-rs/cloud-tasks/src/lib.rs:654 — codex-rs/cloud-tasks/src/lib.rs:654-662 | codex-rs/cloud-tasks/src/lib.rs:715-723 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:1298 — codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:1298-1306 | codex-rs/codex-api/src/endpoint/responses_websocket.rs:516-524 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) codex-rs/codex-mcp/src/codex_apps.rs:38 — codex-rs/codex-mcp/src/codex_apps.rs:38-46 | codex-rs/codex-mcp/src/codex_apps.rs:48-56 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) codex-rs/config/src/requirements_layers/layer.rs:193 — codex-rs/config/src/requirements_layers/layer.rs:193-201 | codex-rs/config/src/requirements_layers/layer.rs:210-218 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) codex-rs/core-plugins/src/loader.rs:1145 — codex-rs/core-plugins/src/loader.rs:1145-1153 | codex-rs/core-plugins/src/loader.rs:1199-1207 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) codex-rs/core-plugins/src/remote.rs:1860 — codex-rs/core-plugins/src/remote.rs:1860-1868 | codex-rs/core-plugins/src/remote.rs:1955-1963 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) codex-rs/core/src/agent/control/spawn.rs:383 — codex-rs/core/src/agent/control/spawn.rs:383-391 | codex-rs/core/src/agent/control/spawn.rs:1485-1493 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) codex-rs/core/src/context_manager/normalize.rs:60 — codex-rs/core/src/context_manager/normalize.rs:60-68 | codex-rs/core/src/context_manager/normalize.rs:132-140 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) codex-rs/core/src/hook_runtime/executor.rs:31 — codex-rs/core/src/hook_runtime/executor.rs:31-40 | codex-rs/core/src/mcp_tool_exposure.rs:270-278 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) codex-rs/core/src/realtime_conversation.rs:947 — codex-rs/core/src/realtime_conversation.rs:947-955 | codex-rs/core/src/realtime_conversation.rs:1109-1117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) codex-rs/core/src/tools/runtimes/mod.rs:629 — codex-rs/core/src/tools/runtimes/mod.rs:629-637 | codex-rs/shell-command/src/shell_snapshot_restore.rs:72-80 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) codex-rs/exec-server-protocol/src/protocol.rs:257 — codex-rs/exec-server-protocol/src/protocol.rs:257-265 | codex-rs/exec-server-protocol/src/protocol.rs:288-296 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) codex-rs/exec-server/src/client/network_policy_audit.rs:60 — codex-rs/exec-server/src/client/network_policy_audit.rs:60-68 | codex-rs/network-proxy/src/network_policy.rs:295-303 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) codex-rs/exec/src/lib.rs:417 — codex-rs/exec/src/lib.rs:417-425 | codex-rs/exec/src/lib.rs:447-455 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) codex-rs/ext/memories/src/tools/mod.rs:81 — codex-rs/ext/memories/src/tools/mod.rs:81-89 | codex-rs/ext/skills/src/tools/mod.rs:367-375 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) codex-rs/http-client/src/custom_ca.rs:693 — codex-rs/http-client/src/custom_ca.rs:693-701 | codex-rs/network-proxy/src/certs.rs:520-528 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) codex-rs/network-proxy/src/state.rs:256 — codex-rs/network-proxy/src/state.rs:256-264 | codex-rs/network-proxy/src/state.rs:285-293 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) codex-rs/responses-api-proxy/src/auth.rs:404 — codex-rs/responses-api-proxy/src/auth.rs:404-412 | codex-rs/responses-api-proxy/src/github_oidc.rs:111-119 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) codex-rs/rmcp-client/src/rmcp_client.rs:1824 — codex-rs/rmcp-client/src/rmcp_client.rs:1824-1832 | codex-rs/rmcp-client/src/streamable_http_retry.rs:84-92 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) codex-rs/rollout/src/state_db.rs:318 — codex-rs/rollout/src/state_db.rs:318-326 | codex-rs/rollout/src/state_db.rs:379-387 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 22 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×45
  • Duplicated block (11 lines × 2) codex-rs/app-server-daemon/src/backend/pid.rs:669 — codex-rs/app-server-daemon/src/backend/pid.rs:669-679 | codex-rs/app-server-daemon/src/lib.rs:1242-1252 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) codex-rs/app-server-protocol/src/export.rs:2055 — codex-rs/app-server-protocol/src/export.rs:2055-2065 | codex-rs/app-server-protocol/src/precomputed_exports.rs:181-191 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (11 lines × 2) codex-rs/app-server-protocol/src/protocol/event_mapping.rs:109 — codex-rs/app-server-protocol/src/protocol/event_mapping.rs:109-119 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:1081-1091 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (11 lines × 2) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1232 — codex-rs/app-server-protocol/src/protocol/thread_history.rs:1232-1242 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:1278-1288 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1259 — codex-rs/app-server-protocol/src/protocol/thread_history.rs:1259-1269 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:1308-1318 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) codex-rs/app-server-protocol/src/protocol/v2/thread_data.rs:466 — codex-rs/app-server-protocol/src/protocol/v2/thread_data.rs:466-476 | codex-rs/protocol/src/protocol.rs:2256-2266 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) codex-rs/app-server/src/external_agent_migration/processor.rs:746 — codex-rs/app-server/src/external_agent_migration/processor.rs:746-756 | codex-rs/external-agent-migration/src/detect/sessions/mod.rs:28-38 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) codex-rs/app-server/src/request_processors/catalog_processor.rs:316 — codex-rs/app-server/src/request_processors/catalog_processor.rs:316-326 | codex-rs/app-server/src/request_processors/catalog_processor.rs:496-506 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) codex-rs/app-server/src/request_processors/thread_goal_processor.rs:138 — codex-rs/app-server/src/request_processors/thread_goal_processor.rs:138-148 | codex-rs/app-server/src/request_processors/thread_goal_processor.rs:280-290 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) codex-rs/app-server/src/request_processors/thread_processor.rs:1165 — codex-rs/app-server/src/request_processors/thread_processor.rs:1165-1175 | codex-rs/app-server/src/request_processors/turn_processor.rs:1697-1707 — before extracting anything, compare `codex-rs/app-server/src/request_processors/thread_processor.rs` and `codex-rs/app-server/src/request_processors/turn_processor.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) codex-rs/cli/src/doctor.rs:2881 — codex-rs/cli/src/doctor.rs:2881-2891 | codex-rs/cli/src/doctor.rs:2907-2917 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) codex-rs/code-mode-host/src/peer.rs:435 — codex-rs/code-mode-host/src/peer.rs:435-445 | codex-rs/code-mode-host/src/peer.rs:467-477 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) codex-rs/code-mode-runtime/src/cell_actor/mod.rs:308 — codex-rs/code-mode-runtime/src/cell_actor/mod.rs:308-318 | codex-rs/code-mode-runtime/src/cell_actor/mod.rs:464-474 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) codex-rs/core-plugins/src/manager.rs:849 — codex-rs/core-plugins/src/manager.rs:849-859 | codex-rs/core-plugins/src/manager.rs:880-890 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) codex-rs/core/src/session/mod.rs:3079 — codex-rs/core/src/session/mod.rs:3079-3089 | codex-rs/core/src/session/mod.rs:3165-3175 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) codex-rs/core/src/tools/handlers/multi_agents/close_agent.rs:87 — codex-rs/core/src/tools/handlers/multi_agents/close_agent.rs:87-97 | codex-rs/core/src/tools/handlers/multi_agents/resume_agent.rs:118-128 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (11 lines × 2) codex-rs/core/src/tools/orchestrator.rs:170 — codex-rs/core/src/tools/orchestrator.rs:170-180 | codex-rs/core/src/tools/orchestrator.rs:204-214 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) codex-rs/ext/memories/src/tools/mod.rs:63 — codex-rs/ext/memories/src/tools/mod.rs:63-73 | codex-rs/ext/skills/src/tools/mod.rs:349-359 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) codex-rs/ext/skills/src/loader/metadata.rs:114 — codex-rs/ext/skills/src/loader/metadata.rs:114-124 | codex-rs/skills/src/parser.rs:188-198 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) codex-rs/hooks/src/events/post_tool_use.rs:89 — codex-rs/hooks/src/events/post_tool_use.rs:89-99 | codex-rs/hooks/src/events/pre_tool_use.rs:91-101 — before extracting anything, compare `codex-rs/hooks/src/events/post_tool_use.rs` and `codex-rs/hooks/src/events/pre_tool_use.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) codex-rs/model-provider/src/shared_state.rs:81 — codex-rs/model-provider/src/shared_state.rs:81-91 | codex-rs/model-provider/src/shared_state.rs:105-115 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) codex-rs/otel/src/metrics/client.rs:169 — codex-rs/otel/src/metrics/client.rs:169-179 | codex-rs/otel/src/metrics/client.rs:198-208 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) codex-rs/rollout/src/list.rs:1134 — codex-rs/rollout/src/list.rs:1134-1144 | codex-rs/rollout/src/list.rs:1228-1238 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) codex-rs/shell-command/src/parse_command.rs:1471 — codex-rs/shell-command/src/parse_command.rs:1471-1481 | codex-rs/shell-command/src/parse_command.rs:2018-2028 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) codex-rs/state/src/runtime/thread_attachments.rs:89 — codex-rs/state/src/runtime/thread_attachments.rs:89-99 | codex-rs/state/src/runtime/thread_attachments.rs:157-167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 20 more in this group — see findings.md.
D2 · Cognitive Complexity · ChatWidget · ×44
  • ChatWidget::submit_user_message_with_prepared_images (cognitive 103) codex-rs/tui/src/chatwidget/input_submission.rs:130 — ChatWidget::submit_user_message_with_prepared_images has cognitive complexity 103 (threshold 15). Drivers by points: if/else 43 (69 pts), boolean chains 16, loops 6 (11 pts), match/switch 4 (7 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::dispatch_prepared_command_with_args (cognitive 81) codex-rs/tui/src/chatwidget/slash_dispatch.rs:785 — ChatWidget::dispatch_prepared_command_with_args has cognitive complexity 81 (threshold 15). Drivers by points: if/else 27 (54 pts), match/switch 8 (18 pts), boolean chains 6, loops 1 (3 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::handle_server_notification (cognitive 74) codex-rs/tui/src/chatwidget/protocol.rs:4 — ChatWidget::handle_server_notification has cognitive complexity 74 (threshold 15). Drivers by points: if/else 34 (59 pts), boolean chains 10, match/switch 3 (5 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::dispatch_command_from_source (cognitive 70) codex-rs/tui/src/chatwidget/slash_dispatch.rs:162 — ChatWidget::dispatch_command_from_source has cognitive complexity 70 (threshold 15). Drivers by points: if/else 34 (64 pts), match/switch 3 (6 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::handle_key_event_with_activation_key (cognitive 67) codex-rs/tui/src/chatwidget/interaction.rs:94 — ChatWidget::handle_key_event_with_activation_key has cognitive complexity 67 (threshold 15). Drivers by points: if/else 29 (42 pts), boolean chains 23, match/switch 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::on_realtime_transcript_done (cognitive 66) codex-rs/tui/src/chatwidget/realtime.rs:1415 — ChatWidget::on_realtime_transcript_done has cognitive complexity 66 (threshold 15). Drivers by points: if/else 26 (45 pts), boolean chains 10, loops 4 (9 pts), match/switch 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::handle_question_key (cognitive 57) codex-rs/tui/src/chatwidget/questions.rs:40 — ChatWidget::handle_question_key has cognitive complexity 57 (threshold 15). Drivers by points: if/else 23 (45 pts), boolean chains 9, match/switch 1 (3 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::finish_thread_usage_refresh (cognitive 46) codex-rs/tui/src/chatwidget/thread_usage.rs:181 — ChatWidget::finish_thread_usage_refresh has cognitive complexity 46 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 13, match/switch 2 (5 pts), loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::on_rate_limit_snapshot_from (cognitive 43) codex-rs/tui/src/chatwidget/rate_limits.rs:252 — ChatWidget::on_rate_limit_snapshot_from has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 15, loops 1 (3 pts), match/switch 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::handle_turn_completed_notification (cognitive 39) codex-rs/tui/src/chatwidget/protocol.rs:423 — ChatWidget::handle_turn_completed_notification has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (30 pts), boolean chains 6, match/switch 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::replay_thread_turns (cognitive 38) codex-rs/tui/src/chatwidget/replay.rs:108 — ChatWidget::replay_thread_turns has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 7, loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::handle_permission_shortcut (cognitive 36) codex-rs/tui/src/chatwidget/permission_shortcuts.rs:6 — ChatWidget::handle_permission_shortcut has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 8, loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::on_session_configured_with_display_and_fork_parent_title (cognitive 34) codex-rs/tui/src/chatwidget/session_flow.rs:68 — ChatWidget::on_session_configured_with_display_and_fork_parent_title has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 12, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ChatWidget::plugin_selection_items (cognitive 33) codex-rs/tui/src/chatwidget/plugin_catalog.rs:1148 — ChatWidget::plugin_selection_items has cognitive complexity 33 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 5, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::on_guardian_assessment (cognitive 33) codex-rs/tui/src/chatwidget/tool_requests.rs:36 — ChatWidget::on_guardian_assessment has cognitive complexity 33 (threshold 15). Drivers by points: if/else 19 (25 pts), match/switch 4 (6 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ChatWidget::handle_thread_item (cognitive 32) codex-rs/tui/src/chatwidget/replay.rs:273 — ChatWidget::handle_thread_item has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 6, loops 1 (3 pts), match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::handle_command_execution_completed_now (cognitive 31) codex-rs/tui/src/chatwidget/command_lifecycle.rs:322 — ChatWidget::handle_command_execution_completed_now has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 5, match/switch 4 (5 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::note_realtime_user_item_started (cognitive 30) codex-rs/tui/src/chatwidget/realtime.rs:627 — ChatWidget::note_realtime_user_item_started has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 9, match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::update_mcp_startup_status (cognitive 29) codex-rs/tui/src/chatwidget/mcp_startup.rs:41 — ChatWidget::update_mcp_startup_status has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 6, loops 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::open_reasoning_popup (cognitive 29) codex-rs/tui/src/chatwidget/model_popups.rs:478 — ChatWidget::open_reasoning_popup has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 6, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ChatWidget::on_realtime_transcript_delta (cognitive 27) codex-rs/tui/src/chatwidget/realtime.rs:1272 — ChatWidget::on_realtime_transcript_delta has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 9, loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • ChatWidget::on_marketplace_upgrade_loaded (cognitive 25) codex-rs/tui/src/chatwidget/plugins.rs:599 — ChatWidget::on_marketplace_upgrade_loaded has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 1, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::on_connectors_loaded (cognitive 24) codex-rs/tui/src/chatwidget/connectors.rs:406 — ChatWidget::on_connectors_loaded has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 1 (3 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::maybe_send_next_queued_input (cognitive 24) codex-rs/tui/src/chatwidget/input_flow.rs:244 — ChatWidget::maybe_send_next_queued_input has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatWidget::submit_initial_user_message_if_pending (cognitive 24) codex-rs/tui/src/chatwidget/input_restore.rs:151 — ChatWidget::submit_initial_user_message_if_pending has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 19 more in this group — see findings.md.
D3 · God Classes · TooManyFields · ×38
  • TooManyFields: ChatWidget codex-rs/tui/src/chatwidget.rs:522 — TooManyFields — 187 stored fields beside 982 methods. The bar is 30 stored fields; this is 157 over it, 6.23× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Config codex-rs/core/src/config/mod.rs:627 — TooManyFields — 159 stored fields beside 47 methods. The bar is 30 stored fields; this is 129 over it, 5.30× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ConfigToml codex-rs/config/src/config_toml.rs:168 — TooManyFields — 106 stored fields beside 3 methods. The bar is 30 stored fields; this is 76 over it, 3.53× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: App codex-rs/tui/src/app.rs:537 — TooManyFields — 102 stored fields beside 492 methods. The bar is 30 stored fields; this is 72 over it, 3.40× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: CodexTurnEventParams codex-rs/analytics/src/events.rs:1112 — TooManyFields — 67 stored fields. The bar is 30 stored fields; this is 37 over it, 2.23× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ChatComposer codex-rs/tui/src/bottom_pane/chat_composer.rs:615 — TooManyFields — 49 stored fields beside 279 methods. The bar is 30 stored fields; this is 19 over it, 1.63× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: PickerState codex-rs/tui/src/resume_picker.rs:945 — TooManyFields — 48 stored fields beside 53 methods. The bar is 30 stored fields; this is 18 over it, 1.60× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: SessionSpawnArgs codex-rs/core/src/session/mod.rs:487 — TooManyFields — 48 stored fields. The bar is 30 stored fields; this is 18 over it, 1.60× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ModelInfo codex-rs/protocol/src/openai_models.rs:413 — TooManyFields — 47 stored fields beside 8 methods. The bar is 30 stored fields; this is 17 over it, 1.57× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ListSelectionView codex-rs/tui/src/bottom_pane/list_selection_view.rs:342 — TooManyFields — 45 stored fields beside 53 methods. The bar is 30 stored fields; this is 15 over it, 1.50× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ConfigRequirementsToml codex-rs/config/src/config_requirements.rs:1046 — TooManyFields — 45 stored fields beside 5 methods. The bar is 30 stored fields; this is 15 over it, 1.50× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: SessionServices codex-rs/core/src/state/service.rs:51 — TooManyFields — 45 stored fields beside 1 method. The bar is 30 stored fields; this is 15 over it, 1.50× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ConfigRequirementsWithSources codex-rs/config/src/config_requirements.rs:1163 — TooManyFields — 44 stored fields beside 2 methods. The bar is 30 stored fields; this is 14 over it, 1.47× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: RealtimeConversationUiState codex-rs/tui/src/chatwidget/realtime.rs:139 — TooManyFields — 43 stored fields beside 1 method. The bar is 30 stored fields; this is 13 over it, 1.43× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: TurnContext codex-rs/core/src/session/turn_context.rs:323 — TooManyFields — 39 stored fields beside 32 methods. The bar is 30 stored fields; this is 9 over it, 1.30× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ThreadRow codex-rs/state/src/model/thread_metadata.rs:508 — TooManyFields — 38 stored fields beside 1 method. The bar is 30 stored fields; this is 8 over it, 1.27× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: GuardianReviewEventParams codex-rs/analytics/src/events.rs:404 — TooManyFields — 37 stored fields. The bar is 30 stored fields; this is 7 over it, 1.23× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ConfigRequirements codex-rs/config/src/config_requirements.rs:163 — TooManyFields — 36 stored fields beside 4 methods. The bar is 30 stored fields; this is 6 over it, 1.20× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: McpConfig codex-rs/codex-mcp/src/mcp/mod.rs:124 — TooManyFields — 36 stored fields beside 3 methods. The bar is 30 stored fields; this is 6 over it, 1.20× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ThreadMetadata codex-rs/state/src/model/thread_metadata.rs:127 — TooManyFields — 36 stored fields beside 3 methods. The bar is 30 stored fields; this is 6 over it, 1.20× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: TuiVimNormalKeymap codex-rs/config/src/tui_keymap.rs:261 — TooManyFields — 36 stored fields. The bar is 30 stored fields; this is 6 over it, 1.20× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: VimNormalKeymap codex-rs/tui/src/keymap.rs:227 — TooManyFields — 36 stored fields. The bar is 30 stored fields; this is 6 over it, 1.20× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: TranscriptView codex-rs/tui/src/transcript_view.rs:91 — TooManyFields — 35 stored fields beside 162 methods. The bar is 30 stored fields; this is 5 over it, 1.17× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Writer codex-rs/tui/src/markdown_render.rs:467 — TooManyFields — 35 stored fields beside 79 methods. The bar is 30 stored fields; this is 5 over it, 1.17× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: CodexResponsesMetadata codex-rs/core/src/responses_metadata.rs:236 — TooManyFields — 34 stored fields beside 7 methods. The bar is 30 stored fields; this is 4 over it, 1.13× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • + 13 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×38
  • Duplicated block (5 lines × 2) codex-rs/config/src/marketplace_edit.rs:73 — codex-rs/config/src/marketplace_edit.rs:73-77 | codex-rs/config/src/plugin_edit.rs:84-88 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) codex-rs/core/src/context_manager/normalize.rs:366 — codex-rs/core/src/context_manager/normalize.rs:366-370 | codex-rs/core/src/context_manager/normalize.rs:413-417 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) codex-rs/core/src/session/session.rs:285 — codex-rs/core/src/session/session.rs:285-289 | codex-rs/core/src/session/session.rs:327-331 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) codex-rs/http-client/src/lib.rs:99 — codex-rs/http-client/src/lib.rs:99-103 | codex-rs/rmcp-client/src/ema_auth_policy.rs:307-311 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) codex-rs/network-proxy/src/credential_broker/environment.rs:290 — codex-rs/network-proxy/src/credential_broker/environment.rs:290-294 | codex-rs/network-proxy/src/credential_broker/environment.rs:322-326 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) codex-rs/shell-command/src/parse_command.rs:1528 — codex-rs/shell-command/src/parse_command.rs:1528-1535 | codex-rs/shell-command/src/parse_command.rs:1539-1543 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) codex-rs/thread-store/src/local/archive_thread.rs:116 — codex-rs/thread-store/src/local/archive_thread.rs:116-120 | codex-rs/thread-store/src/local/unarchive_thread.rs:97-101 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) codex-rs/tui/src/lib.rs:1570 — codex-rs/tui/src/lib.rs:1570-1574 | codex-rs/tui/src/lib.rs:1668-1672 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) codex-rs/tui/src/markdown_render.rs:2224 — codex-rs/tui/src/markdown_render.rs:2224-2228 | codex-rs/tui/src/markdown_render.rs:2237-2241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) codex-rs/tui/src/markdown_render.rs:2360 — codex-rs/tui/src/markdown_render.rs:2360-2365 | codex-rs/tui/src/markdown_render.rs:2415-2419 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) codex-rs/tui/src/tui.rs:1394 — codex-rs/tui/src/tui.rs:1394-1398 | codex-rs/tui/src/tui.rs:1417-1421 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) codex-rs/app-server/src/image_url.rs:4 — codex-rs/app-server/src/image_url.rs:4-8 | codex-rs/core/src/image_preparation.rs:343-347 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) codex-rs/codex-mcp/src/runtime.rs:1117 — codex-rs/codex-mcp/src/runtime.rs:1117-1121 | codex-rs/connectors/src/connector_runtime/mod.rs:486-490 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) codex-rs/config/src/mcp_types.rs:705 — codex-rs/config/src/mcp_types.rs:705-709 | codex-rs/exec-server/src/environment_toml.rs:363-367 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) codex-rs/model-provider/src/amazon_bedrock/mod.rs:184 — codex-rs/model-provider/src/amazon_bedrock/mod.rs:184-188 | codex-rs/model-provider/src/gcp/mod.rs:59-63 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) codex-rs/protocol/src/session_id.rs:92 — codex-rs/protocol/src/session_id.rs:92-96 | codex-rs/protocol/src/thread_id.rs:95-99 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) codex-rs/tui/src/chatwidget/input_queue.rs:64 — codex-rs/tui/src/chatwidget/input_queue.rs:64-68 | codex-rs/tui/src/chatwidget/user_messages.rs:859-863 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) codex-rs/tui/src/bottom_pane/memories_settings_view.rs:254 — codex-rs/tui/src/bottom_pane/memories_settings_view.rs:254-258 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:962-966 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) codex-rs/ollama/src/pull.rs:65 — codex-rs/ollama/src/pull.rs:65-70 | codex-rs/ollama/src/pull.rs:116-120 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) codex-rs/tui/src/bottom_pane/experimental_features_view.rs:452 — codex-rs/tui/src/bottom_pane/experimental_features_view.rs:452-456 | codex-rs/tui/src/bottom_pane/memories_settings_view.rs:457-461 — before extracting anything, compare `codex-rs/tui/src/bottom_pane/experimental_features_view.rs` and `codex-rs/tui/src/bottom_pane/memories_settings_view.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) codex-rs/external-agent-migration/src/service.rs:617 — codex-rs/external-agent-migration/src/service.rs:617-621 | codex-rs/external-agent-migration/src/service.rs:673-677 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) codex-rs/core/src/config/edit/document_helpers.rs:151 — codex-rs/core/src/config/edit/document_helpers.rs:151-155 | codex-rs/core/src/config/edit/document_helpers.rs:156-160 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) codex-rs/cloud-tasks/src/ui.rs:900 — codex-rs/cloud-tasks/src/ui.rs:900-904 | codex-rs/cloud-tasks/src/ui.rs:1009-1013 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) codex-rs/core-plugins/src/marketplace_upgrade/git.rs:34 — codex-rs/core-plugins/src/marketplace_upgrade/git.rs:34-38 | codex-rs/core-plugins/src/startup_sync.rs:625-629 — before extracting anything, compare `codex-rs/core-plugins/src/marketplace_upgrade/git.rs` and `codex-rs/core-plugins/src/startup_sync.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) codex-rs/hooks/src/events/session_start.rs:161 — codex-rs/hooks/src/events/session_start.rs:161-165 | codex-rs/hooks/src/events/stop.rs:142-146 — before extracting anything, compare `codex-rs/hooks/src/events/session_start.rs` and `codex-rs/hooks/src/events/stop.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • + 13 more in this group — see findings.md.
D5 · Coupling · Off the main sequence · ×38
  • Off the main sequence: codex-backend-openapi-models — codex-backend-openapi-models: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: codex-diagnostics — codex-diagnostics: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • Off the main sequence: codex-file-watcher — codex-file-watcher: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: codex-mermaid — codex-mermaid: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: codex-otel-trace-websocket — codex-otel-trace-websocket: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: codex-tcp-tunnel — codex-tcp-tunnel: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: codex-uds — codex-uds: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 8 project(s), so it's rigid to change.
  • Off the main sequence: codex-utils-cache — codex-utils-cache: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • Off the main sequence: codex-utils-critical-path — codex-utils-critical-path: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: codex-utils-head-tail-buffer — codex-utils-head-tail-buffer: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: codex-utils-redacted-string — codex-utils-redacted-string: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 8 project(s), so it's rigid to change.
  • Off the main sequence: codex-utils-sleep-inhibitor — codex-utils-sleep-inhibitor: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: codex-utils-string — codex-utils-string: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 11 project(s), so it's rigid to change.
  • Off the main sequence: codex-utils-template — codex-utils-template: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 5 project(s), so it's rigid to change.
  • Off the main sequence: codex-utils-path-uri — codex-utils-path-uri: abstractness 0.00, instability 0.03, distance 0.97 — zone of pain — concrete and depended on by 34 project(s), so it's rigid to change.
  • Off the main sequence: codex-utils-stream-parser — codex-utils-stream-parser: abstractness 0.08, instability 0.00, distance 0.92 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: codex-history — codex-history: abstractness 0.00, instability 0.08, distance 0.92 — zone of pain — concrete and depended on by 11 project(s), so it's rigid to change.
  • Off the main sequence: codex-user-verification — codex-user-verification: abstractness 0.08, instability 0.00, distance 0.92 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: codex-utils-pty — codex-utils-pty: abstractness 0.11, instability 0.00, distance 0.89 — zone of pain — concrete and depended on by 10 project(s), so it's rigid to change.
  • Off the main sequence: codex-http-client — codex-http-client: abstractness 0.08, instability 0.02, distance 0.89 — zone of pain — concrete and depended on by 43 project(s), so it's rigid to change.
  • Off the main sequence: codex-extension-items — codex-extension-items: abstractness 0.00, instability 0.11, distance 0.89 — zone of pain — concrete and depended on by 8 project(s), so it's rigid to change.
  • Off the main sequence: codex-protocol — codex-protocol: abstractness 0.00, instability 0.11, distance 0.88 — zone of pain — concrete and depended on by 77 project(s), so it's rigid to change.
  • Off the main sequence: codex-utils-path — codex-utils-path: abstractness 0.00, instability 0.13, distance 0.88 — zone of pain — concrete and depended on by 7 project(s), so it's rigid to change.
  • Off the main sequence: codex-attachment-store — codex-attachment-store: abstractness 0.14, instability 0.00, distance 0.86 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • Off the main sequence: codex-install-context — codex-install-context: abstractness 0.00, instability 0.15, distance 0.85 — zone of pain — concrete and depended on by 11 project(s), so it's rigid to change.
  • + 13 more in this group — see findings.md.
D1 · Cyclomatic Complexity · ChatWidget · ×37
  • ChatWidget::dispatch_command_from_source (cyclomatic 93) codex-rs/tui/src/chatwidget/slash_dispatch.rs:162 — ChatWidget::dispatch_command_from_source has cyclomatic complexity 93 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ChatWidget::handle_server_notification (cyclomatic 88) codex-rs/tui/src/chatwidget/protocol.rs:4 — ChatWidget::handle_server_notification has cyclomatic complexity 88 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatWidget::dispatch_prepared_command_with_args (cyclomatic 70) codex-rs/tui/src/chatwidget/slash_dispatch.rs:785 — ChatWidget::dispatch_prepared_command_with_args has cyclomatic complexity 70 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatWidget::submit_user_message_with_prepared_images (cyclomatic 68) codex-rs/tui/src/chatwidget/input_submission.rs:130 — ChatWidget::submit_user_message_with_prepared_images has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatWidget::handle_key_event_with_activation_key (cyclomatic 55) codex-rs/tui/src/chatwidget/interaction.rs:94 — ChatWidget::handle_key_event_with_activation_key has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatWidget::on_realtime_transcript_done (cyclomatic 41) codex-rs/tui/src/chatwidget/realtime.rs:1415 — ChatWidget::on_realtime_transcript_done has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatWidget::handle_thread_item (cyclomatic 39) codex-rs/tui/src/chatwidget/replay.rs:273 — ChatWidget::handle_thread_item has cyclomatic complexity 39 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • ChatWidget::status_line_value_for_item (cyclomatic 37) codex-rs/tui/src/chatwidget/status_surfaces.rs:729 — ChatWidget::status_line_value_for_item has cyclomatic complexity 37 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ChatWidget::on_guardian_assessment (cyclomatic 37) codex-rs/tui/src/chatwidget/tool_requests.rs:36 — ChatWidget::on_guardian_assessment has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • ChatWidget::handle_question_key (cyclomatic 32) codex-rs/tui/src/chatwidget/questions.rs:40 — ChatWidget::handle_question_key has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatWidget::on_session_configured_with_display_and_fork_parent_title (cyclomatic 31) codex-rs/tui/src/chatwidget/session_flow.rs:68 — ChatWidget::on_session_configured_with_display_and_fork_parent_title has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • ChatWidget::finish_thread_usage_refresh (cyclomatic 31) codex-rs/tui/src/chatwidget/thread_usage.rs:181 — ChatWidget::finish_thread_usage_refresh has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatWidget::on_rate_limit_snapshot_from (cyclomatic 30) codex-rs/tui/src/chatwidget/rate_limits.rs:252 — ChatWidget::on_rate_limit_snapshot_from has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatWidget::handle_permission_shortcut (cyclomatic 26) codex-rs/tui/src/chatwidget/permission_shortcuts.rs:6 — ChatWidget::handle_permission_shortcut has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatWidget::replay_thread_turns (cyclomatic 25) codex-rs/tui/src/chatwidget/replay.rs:108 — ChatWidget::replay_thread_turns has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatWidget::handle_turn_completed_notification (cyclomatic 24) codex-rs/tui/src/chatwidget/protocol.rs:423 — ChatWidget::handle_turn_completed_notification has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatWidget::handle_command_execution_completed_now (cyclomatic 23) codex-rs/tui/src/chatwidget/command_lifecycle.rs:322 — ChatWidget::handle_command_execution_completed_now has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatWidget::on_realtime_transcript_delta (cyclomatic 23) codex-rs/tui/src/chatwidget/realtime.rs:1272 — ChatWidget::on_realtime_transcript_delta has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • ChatWidget::handle_composer_input_result (cyclomatic 22) codex-rs/tui/src/chatwidget/input_flow.rs:21 — ChatWidget::handle_composer_input_result has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatWidget::update_mcp_startup_status (cyclomatic 21) codex-rs/tui/src/chatwidget/mcp_startup.rs:41 — ChatWidget::update_mcp_startup_status has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatWidget::note_realtime_user_item_started (cyclomatic 21) codex-rs/tui/src/chatwidget/realtime.rs:627 — ChatWidget::note_realtime_user_item_started has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatWidget::speak_completed_realtime_delegation (cyclomatic 21) codex-rs/tui/src/chatwidget/realtime.rs:932 — ChatWidget::speak_completed_realtime_delegation has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • ChatWidget::plugin_selection_items (cyclomatic 20) codex-rs/tui/src/chatwidget/plugin_catalog.rs:1148 — ChatWidget::plugin_selection_items has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatWidget::handle_quick_dial_menu (cyclomatic 20) codex-rs/tui/src/chatwidget/quick_dials.rs:513 — ChatWidget::handle_quick_dial_menu has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatWidget::on_realtime_conversation_closed (cyclomatic 20) codex-rs/tui/src/chatwidget/realtime.rs:1718 — ChatWidget::on_realtime_conversation_closed has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • + 12 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×36
  • Duplicated block (12 lines × 2) codex-rs/app-server/src/request_processors/thread_processor.rs:1265 — codex-rs/app-server/src/request_processors/thread_processor.rs:1265-1276 | codex-rs/app-server/src/request_processors/thread_processor.rs:2023-2034 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) codex-rs/app-server/src/request_processors/turn_processor.rs:652 — codex-rs/app-server/src/request_processors/turn_processor.rs:652-663 | codex-rs/app-server/src/request_processors/turn_processor.rs:973-984 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) codex-rs/code-mode-runtime/src/runtime/callbacks.rs:84 — codex-rs/code-mode-runtime/src/runtime/callbacks.rs:84-95 | codex-rs/code-mode-runtime/src/runtime/callbacks.rs:287-298 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) codex-rs/codex-api/src/endpoint/realtime_websocket/protocol_v2.rs:146 — codex-rs/codex-api/src/endpoint/realtime_websocket/protocol_v2.rs:146-157 | codex-rs/codex-api/src/endpoint/realtime_websocket/protocol_v2.rs:172-183 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) codex-rs/config/src/diagnostics.rs:157 — codex-rs/config/src/diagnostics.rs:157-168 | codex-rs/config/src/strict_config.rs:94-105 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) codex-rs/config/src/marketplace_edit.rs:126 — codex-rs/config/src/marketplace_edit.rs:126-137 | codex-rs/config/src/marketplace_edit.rs:142-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) codex-rs/core-plugins/src/command_migration.rs:303 — codex-rs/core-plugins/src/command_migration.rs:303-314 | codex-rs/external-agent-migration/src/subagents.rs:151-162 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12 lines × 2) codex-rs/core-plugins/src/remote.rs:2284 — codex-rs/core-plugins/src/remote.rs:2284-2295 | codex-rs/core-plugins/src/remote/share.rs:393-404 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12 lines × 2) codex-rs/core-plugins/src/remote/share/checkout.rs:460 — codex-rs/core-plugins/src/remote/share/checkout.rs:460-471 | codex-rs/core-plugins/src/remote/share/local_paths.rs:109-120 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) codex-rs/core/src/hook_runtime.rs:553 — codex-rs/core/src/hook_runtime.rs:553-564 | codex-rs/core/src/hook_runtime.rs:595-606 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) codex-rs/ext/goal/src/api.rs:224 — codex-rs/ext/goal/src/api.rs:224-235 | codex-rs/ext/goal/src/api.rs:268-279 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) codex-rs/external-agent-migration/src/sessions/records_cla.rs:52 — codex-rs/external-agent-migration/src/sessions/records_cla.rs:52-63 | codex-rs/external-agent-migration/src/sessions/records_cla.rs:137-148 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) codex-rs/hooks/src/events/compact.rs:280 — codex-rs/hooks/src/events/compact.rs:280-291 | codex-rs/hooks/src/events/stop.rs:275-286 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) codex-rs/rollout-trace/src/reducer/conversation.rs:234 — codex-rs/rollout-trace/src/reducer/conversation.rs:234-245 | codex-rs/rollout-trace/src/reducer/conversation.rs:254-265 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) codex-rs/rollout/src/state_db.rs:405 — codex-rs/rollout/src/state_db.rs:405-416 | codex-rs/rollout/src/state_db.rs:433-444 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) codex-rs/skills/src/interface.rs:151 — codex-rs/skills/src/interface.rs:151-162 | codex-rs/utils/absolute-path/src/absolutize.rs:27-38 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12 lines × 2) codex-rs/skills/src/interface.rs:167 — codex-rs/skills/src/interface.rs:167-178 | codex-rs/skills/src/metadata.rs:141-152 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) codex-rs/state/src/runtime/projects.rs:124 — codex-rs/state/src/runtime/projects.rs:124-135 | codex-rs/state/src/runtime/projects.rs:155-166 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) codex-rs/thread-store/src/local/archive_thread.rs:103 — codex-rs/thread-store/src/local/archive_thread.rs:103-114 | codex-rs/thread-store/src/local/unarchive_thread.rs:84-95 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:812 — codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:812-823 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:518-529 — before extracting anything, compare `codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs` and `codex-rs/tui/src/bottom_pane/request_user_input/mod.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:835 — codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:835-846 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:549-560 — before extracting anything, compare `codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs` and `codex-rs/tui/src/bottom_pane/request_user_input/mod.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) codex-rs/tui/src/bottom_pane/pending_input_preview.rs:108 — codex-rs/tui/src/bottom_pane/pending_input_preview.rs:108-119 | codex-rs/tui/src/bottom_pane/pending_input_preview.rs:132-143 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) codex-rs/tui/src/chatwidget/realtime.rs:1428 — codex-rs/tui/src/chatwidget/realtime.rs:1428-1439 | codex-rs/tui/src/chatwidget/realtime.rs:1594-1605 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) codex-rs/tui/src/history_cell/mcp.rs:272 — codex-rs/tui/src/history_cell/mcp.rs:272-283 | codex-rs/tui/src/history_cell/mcp.rs:287-298 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) codex-rs/tui/src/startup_orchestration.rs:825 — codex-rs/tui/src/startup_orchestration.rs:825-836 | codex-rs/tui/src/startup_orchestration.rs:846-857 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 11 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×34
  • Duplicated block (14 lines × 2) codex-rs/app-server-protocol/src/protocol/v2/apps.rs:147 — codex-rs/app-server-protocol/src/protocol/v2/apps.rs:147-160 | codex-rs/connectors/src/app_info.rs:84-97 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) codex-rs/app-server-transport/src/transport/remote_control/mod.rs:493 — codex-rs/app-server-transport/src/transport/remote_control/mod.rs:493-506 | codex-rs/app-server-transport/src/transport/remote_control/mod.rs:736-749 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) codex-rs/app-server/src/command_exec.rs:389 — codex-rs/app-server/src/command_exec.rs:389-402 | codex-rs/app-server/src/request_processors/process_exec_processor.rs:428-441 — before extracting anything, compare `codex-rs/app-server/src/command_exec.rs` and `codex-rs/app-server/src/request_processors/process_exec_processor.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) codex-rs/cli/src/plugin_cmd.rs:392 — codex-rs/cli/src/plugin_cmd.rs:392-405 | codex-rs/core-plugins/src/manager.rs:3751-3764 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) codex-rs/config/src/loader/mod.rs:1849 — codex-rs/config/src/loader/mod.rs:1849-1862 | codex-rs/ext/skills/src/host_roots.rs:254-267 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) codex-rs/core-plugins/src/manager.rs:2138 — codex-rs/core-plugins/src/manager.rs:2138-2151 | codex-rs/core-plugins/src/manager.rs:2213-2226 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) codex-rs/core/src/client.rs:3176 — codex-rs/core/src/client.rs:3176-3189 | codex-rs/core/src/client.rs:3231-3244 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) codex-rs/core/src/image_preparation.rs:275 — codex-rs/core/src/image_preparation.rs:275-288 | codex-rs/core/src/image_preparation.rs:318-331 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) codex-rs/core/src/session/mcp.rs:268 — codex-rs/core/src/session/mcp.rs:268-281 | codex-rs/core/src/session/mcp.rs:910-923 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) codex-rs/exec/src/event_processor_with_human_output.rs:505 — codex-rs/exec/src/event_processor_with_human_output.rs:505-518 | codex-rs/exec/src/event_processor_with_jsonl_output.rs:390-403 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (14 lines × 2) codex-rs/exec/src/event_processor_with_jsonl_output.rs:430 — codex-rs/exec/src/event_processor_with_jsonl_output.rs:430-443 | codex-rs/exec/src/event_processor_with_jsonl_output.rs:462-475 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) codex-rs/exec/src/lib.rs:1868 — codex-rs/exec/src/lib.rs:1868-1881 | codex-rs/exec/src/lib.rs:1956-1969 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:148 — codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:148-161 | codex-rs/ext/skills/src/dynamic_skill_selector/fielded_bm25.rs:173-186 — before extracting anything, compare `codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs` and `codex-rs/ext/skills/src/dynamic_skill_selector/fielded_bm25.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) codex-rs/external-agent-migration/src/detect/sessions/cla.rs:26 — codex-rs/external-agent-migration/src/detect/sessions/cla.rs:26-39 | codex-rs/external-agent-migration/src/detect/sessions/cur.rs:31-44 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (14 lines × 2) codex-rs/hooks/src/events/session_start.rs:229 — codex-rs/hooks/src/events/session_start.rs:229-242 | codex-rs/hooks/src/events/user_prompt_submit.rs:143-156 — before extracting anything, compare `codex-rs/hooks/src/events/session_start.rs` and `codex-rs/hooks/src/events/user_prompt_submit.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) REDACTED:1468 — REDACTED:1468-1481 | REDACTED:1506-1519 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) codex-rs/login/src/oauth_session.rs:403 — codex-rs/login/src/oauth_session.rs:403-416 | codex-rs/model-provider/src/shared_state_test_support.rs:96-109 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) codex-rs/rmcp-client/src/oauth.rs:1130 — codex-rs/rmcp-client/src/oauth.rs:1130-1143 | codex-rs/rmcp-client/src/oauth/enterprise_generation.rs:48-61 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) codex-rs/shell-command/src/parse_command.rs:2516 — codex-rs/shell-command/src/parse_command.rs:2516-2529 | codex-rs/shell-command/src/parse_command.rs:2545-2558 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) codex-rs/thread-store/src/local/create_thread.rs:16 — codex-rs/thread-store/src/local/create_thread.rs:16-29 | codex-rs/thread-store/src/local/live_writer.rs:133-146 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (14 lines × 2) codex-rs/thread-store/src/local/update_thread_metadata.rs:781 — codex-rs/thread-store/src/local/update_thread_metadata.rs:781-794 | codex-rs/thread-store/src/thread_metadata_sync.rs:425-438 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) codex-rs/tui/src/app/config_persistence.rs:909 — codex-rs/tui/src/app/config_persistence.rs:909-922 | codex-rs/tui/src/app/config_persistence.rs:1311-1324 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) codex-rs/tui/src/bottom_pane/list_selection_view.rs:1559 — codex-rs/tui/src/bottom_pane/list_selection_view.rs:1559-1572 | codex-rs/tui/src/bottom_pane/list_selection_view.rs:1684-1697 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:94 — codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:94-107 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:113-126 — before extracting anything, compare `codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs` and `codex-rs/tui/src/bottom_pane/request_user_input/mod.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) codex-rs/tui/src/history_cell/session.rs:329 — codex-rs/tui/src/history_cell/session.rs:329-342 | codex-rs/tui/src/status/helpers.rs:148-161 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • + 9 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×29
  • Duplicated block (6 lines × 2) codex-rs/app-server-client/src/lib.rs:716 — codex-rs/app-server-client/src/lib.rs:716-721 | codex-rs/app-server-client/src/lib.rs:813-818 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) codex-rs/app-server-client/src/lib.rs:728 — codex-rs/app-server-client/src/lib.rs:728-733 | codex-rs/app-server-client/src/lib.rs:825-830 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) codex-rs/cli/src/mcp_cmd.rs:1079 — codex-rs/cli/src/mcp_cmd.rs:1079-1084 | codex-rs/cli/src/mcp_cmd.rs:1092-1097 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) codex-rs/cloud-tasks/src/lib.rs:1323 — codex-rs/cloud-tasks/src/lib.rs:1323-1328 | codex-rs/cloud-tasks/src/lib.rs:1795-1800 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) codex-rs/cloud-tasks/src/ui.rs:986 — codex-rs/cloud-tasks/src/ui.rs:986-991 | codex-rs/cloud-tasks/src/ui.rs:1041-1046 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) codex-rs/code-mode/src/grpc_session/mod.rs:369 — codex-rs/code-mode/src/grpc_session/mod.rs:369-374 | codex-rs/code-mode/src/remote_session.rs:393-398 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) codex-rs/core-plugins/src/loader.rs:1564 — codex-rs/core-plugins/src/loader.rs:1564-1569 | codex-rs/core-plugins/src/loader.rs:1586-1591 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) codex-rs/exec-server/src/local_file_system.rs:1211 — codex-rs/exec-server/src/local_file_system.rs:1211-1216 | codex-rs/external-agent-migration/src/utils.rs:52-57 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) codex-rs/exec/src/lib.rs:1561 — codex-rs/exec/src/lib.rs:1561-1566 | codex-rs/exec/src/lib.rs:1585-1590 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) codex-rs/git-utils/src/info.rs:441 — codex-rs/git-utils/src/info.rs:441-448 | codex-rs/tui/src/branch_summary.rs:205-210 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) codex-rs/rmcp-client/src/ema_http_client.rs:300 — codex-rs/rmcp-client/src/ema_http_client.rs:300-305 | codex-rs/rmcp-client/src/ema_http_client.rs:329-334 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) codex-rs/state/src/runtime/threads.rs:291 — codex-rs/state/src/runtime/threads.rs:291-296 | codex-rs/state/src/runtime/threads.rs:345-350 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) codex-rs/tui/src/bottom_pane/chat_composer/slash_input.rs:284 — codex-rs/tui/src/bottom_pane/chat_composer/slash_input.rs:284-289 | codex-rs/tui/src/bottom_pane/chat_composer/slash_input.rs:339-345 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) codex-rs/app-server-protocol/src/rpc.rs:24 — codex-rs/app-server-protocol/src/rpc.rs:24-29 | codex-rs/exec-server-protocol/src/rpc.rs:41-46 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) codex-rs/app-server/src/request_processors/account_processor/bedrock_setup.rs:142 — codex-rs/app-server/src/request_processors/account_processor/bedrock_setup.rs:142-147 | codex-rs/exec-server/src/environment.rs:682-687 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) codex-rs/codex-mcp/src/agent_plugin_config.rs:506 — codex-rs/codex-mcp/src/agent_plugin_config.rs:506-511 | codex-rs/model-provider-info/src/gateway_oauth.rs:127-132 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) codex-rs/core-plugins/src/marketplace.rs:959 — codex-rs/core-plugins/src/marketplace.rs:959-964 | codex-rs/core-plugins/src/marketplace_add/source.rs:198-203 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) codex-rs/core-plugins/src/remote.rs:2062 — codex-rs/core-plugins/src/remote.rs:2062-2067 | codex-rs/core/src/config/mod.rs:5220-5225 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) codex-rs/core/src/mcp_tool_call.rs:787 — codex-rs/core/src/mcp_tool_call.rs:787-792 | codex-rs/core/src/tools/handlers/list_available_plugins_to_install.rs:108-113 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) codex-rs/core/src/turn_timing.rs:289 — codex-rs/core/src/turn_timing.rs:289-294 | codex-rs/rollout-trace/src/writer.rs:150-155 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) codex-rs/exec-server/src/local_file_system.rs:1291 — codex-rs/exec-server/src/local_file_system.rs:1291-1296 | codex-rs/exec-server/src/no_follow/mod.rs:47-52 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) codex-rs/ext/skills/src/dynamic_skill_selector/routing_card_lexical.rs:238 — codex-rs/ext/skills/src/dynamic_skill_selector/routing_card_lexical.rs:238-243 | codex-rs/ext/skills/src/dynamic_skill_selector/weighted_lexical.rs:179-184 — before extracting anything, compare `codex-rs/ext/skills/src/dynamic_skill_selector/routing_card_lexical.rs` and `codex-rs/ext/skills/src/dynamic_skill_selector/weighted_lexical.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) codex-rs/protocol/src/error.rs:689 — codex-rs/protocol/src/error.rs:689-694 | codex-rs/utils/output-truncation/src/lib.rs:36-41 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) codex-rs/tui/src/bottom_pane/command_popup.rs:303 — codex-rs/tui/src/bottom_pane/command_popup.rs:303-308 | codex-rs/tui/src/bottom_pane/slash_commands.rs:27-32 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) codex-rs/tui/src/history_cell/mcp.rs:825 — codex-rs/tui/src/history_cell/mcp.rs:825-830 | codex-rs/tui/src/history_cell/notices.rs:376-382 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • + 4 more in this group — see findings.md.
D1 · Cyclomatic Complexity · codex_core · ×28
  • codex_core::session::turn::try_run_sampling_request (cyclomatic 107) codex-rs/core/src/session/turn.rs:2657 — codex_core::session::turn::try_run_sampling_request has cyclomatic complexity 107 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_core::session::turn::run_turn (cyclomatic 67) codex-rs/core/src/session/turn.rs:174 — codex_core::session::turn::run_turn has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_core::session::handlers::submission_loop (cyclomatic 50) codex-rs/core/src/session/handlers.rs:443 — codex_core::session::handlers::submission_loop has cyclomatic complexity 50 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_core::config::edit::document_helpers::serialize_mcp_server_table (cyclomatic 47) codex-rs/core/src/config/edit/document_helpers.rs:50 — codex_core::config::edit::document_helpers::serialize_mcp_server_table has cyclomatic complexity 47 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_core::shell_snapshot::capture_snapshot (cyclomatic 43) codex-rs/core/src/shell_snapshot.rs:576 — codex_core::shell_snapshot::capture_snapshot has cyclomatic complexity 43 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • codex_core::guardian::review_session::run_review_on_session (cyclomatic 42) codex-rs/core/src/guardian/review_session.rs:331 — codex_core::guardian::review_session::run_review_on_session has cyclomatic complexity 42 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_core::session::mcp::review_guardian_mcp_elicitation (cyclomatic 32) codex-rs/core/src/session/mcp.rs:944 — codex_core::session::mcp::review_guardian_mcp_elicitation has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_core::tools::runtimes::maybe_wrap_shell_lc_with_snapshot (cyclomatic 29) codex-rs/core/src/tools/runtimes/mod.rs:286 — codex_core::tools::runtimes::maybe_wrap_shell_lc_with_snapshot has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_core::realtime_conversation::handle_handoff_output (cyclomatic 28) codex-rs/core/src/realtime_conversation.rs:2388 — codex_core::realtime_conversation::handle_handoff_output has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_core::guardian::input_budget::finalize (cyclomatic 25) codex-rs/core/src/guardian/input_budget.rs:120 — codex_core::guardian::input_budget::finalize has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_core::realtime_context::build_current_thread_section (cyclomatic 24) codex-rs/core/src/realtime_context.rs:213 — codex_core::realtime_context::build_current_thread_section has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_core::realtime_conversation::handle_realtime_server_event (cyclomatic 24) codex-rs/core/src/realtime_conversation.rs:2604 — codex_core::realtime_conversation::handle_realtime_server_event has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_core::compact_remote_v2::truncate_retained_messages (cyclomatic 23) codex-rs/core/src/compact_remote_v2.rs:606 — codex_core::compact_remote_v2::truncate_retained_messages has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_core::client::map_response_events (cyclomatic 21) codex-rs/core/src/client.rs:2641 — codex_core::client::map_response_events has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_core::exec::consume_output (cyclomatic 21) codex-rs/core/src/exec.rs:982 — codex_core::exec::consume_output has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_core::realtime_conversation::build_realtime_session_config (cyclomatic 21) codex-rs/core/src/realtime_conversation.rs:1524 — codex_core::realtime_conversation::build_realtime_session_config has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_core::realtime_conversation::sideband::spawn_webrtc_sideband_input_task (cyclomatic 20) codex-rs/core/src/realtime_conversation/sideband.rs:27 — codex_core::realtime_conversation::sideband::spawn_webrtc_sideband_input_task has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_core::realtime_conversation::prepare_realtime_start (cyclomatic 19) codex-rs/core/src/realtime_conversation.rs:1352 — codex_core::realtime_conversation::prepare_realtime_start has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_core::session::step_activation::check_legacy_model_safety (cyclomatic 19) codex-rs/core/src/session/step_activation.rs:88 — codex_core::session::step_activation::check_legacy_model_safety has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_core::compact_remote_v2::collect_compaction_output (cyclomatic 18) codex-rs/core/src/compact_remote_v2.rs:375 — codex_core::compact_remote_v2::collect_compaction_output has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_core::compact_remote_v2_installation::build_and_install_compaction (cyclomatic 18) codex-rs/core/src/compact_remote_v2_installation.rs:73 — codex_core::compact_remote_v2_installation::build_and_install_compaction has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_core::mcp_tool_call::handle_mcp_tool_call (cyclomatic 18) codex-rs/core/src/mcp_tool_call.rs:134 — codex_core::mcp_tool_call::handle_mcp_tool_call has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_core::realtime_conversation::handle_start_inner (cyclomatic 18) codex-rs/core/src/realtime_conversation.rs:1705 — codex_core::realtime_conversation::handle_start_inner has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_core::compact_remote_v2_images::truncate_message_to_token_budget (cyclomatic 17) codex-rs/core/src/compact_remote_v2_images.rs:31 — codex_core::compact_remote_v2_images::truncate_message_to_token_budget has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_core::mcp_tool_call::build_mcp_tool_approval_elicitation_meta (cyclomatic 17) codex-rs/core/src/mcp_tool_call.rs:2076 — codex_core::mcp_tool_call::build_mcp_tool_approval_elicitation_meta has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • + 3 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×28
  • Duplicated block (13 lines × 2) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1245 — codex-rs/app-server-protocol/src/protocol/thread_history.rs:1245-1257 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:1294-1306 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) codex-rs/app-server-transport/src/transport/remote_control/mod.rs:460 — codex-rs/app-server-transport/src/transport/remote_control/mod.rs:460-472 | codex-rs/app-server-transport/src/transport/remote_control/mod.rs:704-716 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) codex-rs/app-server-transport/src/transport/remote_control/mod.rs:539 — codex-rs/app-server-transport/src/transport/remote_control/mod.rs:539-551 | codex-rs/app-server-transport/src/transport/remote_control/mod.rs:768-780 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) codex-rs/app-server/src/models.rs:43 — codex-rs/app-server/src/models.rs:43-55 | codex-rs/tui/src/app_server_session.rs:1944-1956 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (13 lines × 2) codex-rs/app-server/src/outgoing_message.rs:556 — codex-rs/app-server/src/outgoing_message.rs:556-568 | codex-rs/app-server/src/outgoing_message.rs:636-648 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) codex-rs/cloud-tasks/src/env_detect.rs:53 — codex-rs/cloud-tasks/src/env_detect.rs:53-65 | codex-rs/cloud-tasks/src/env_detect.rs:326-338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) codex-rs/core-plugins/src/marketplace_upgrade/git.rs:227 — codex-rs/core-plugins/src/marketplace_upgrade/git.rs:227-239 | codex-rs/core-plugins/src/startup_sync.rs:738-750 — before extracting anything, compare `codex-rs/core-plugins/src/marketplace_upgrade/git.rs` and `codex-rs/core-plugins/src/startup_sync.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) codex-rs/ext/guardian-reviewer/src/pool.rs:235 — codex-rs/ext/guardian-reviewer/src/pool.rs:235-247 | codex-rs/ext/guardian-reviewer/src/pool.rs:350-362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) codex-rs/ext/skills/src/sources.rs:196 — codex-rs/ext/skills/src/sources.rs:196-208 | codex-rs/ext/skills/src/sources.rs:221-233 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) codex-rs/external-agent-migration/src/sessions/append.rs:87 — codex-rs/external-agent-migration/src/sessions/append.rs:87-99 | codex-rs/external-agent-migration/src/sessions/append.rs:123-135 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) codex-rs/external-agent-migration/src/sessions/records_cla.rs:81 — codex-rs/external-agent-migration/src/sessions/records_cla.rs:81-93 | codex-rs/external-agent-migration/src/sessions/records_cur.rs:69-81 — before extracting anything, compare `codex-rs/external-agent-migration/src/sessions/records_cla.rs` and `codex-rs/external-agent-migration/src/sessions/records_cur.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 104 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) codex-rs/external-agent-migration/src/sessions/records_cur.rs:38 — codex-rs/external-agent-migration/src/sessions/records_cur.rs:38-50 | codex-rs/external-agent-migration/src/sessions/records_cur.rs:111-123 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) codex-rs/message-board/src/in_memory/queries.rs:274 — codex-rs/message-board/src/in_memory/queries.rs:274-286 | codex-rs/message-board/src/local/paging.rs:22-34 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (13 lines × 2) codex-rs/protocol/src/permissions.rs:846 — codex-rs/protocol/src/permissions.rs:846-858 | codex-rs/protocol/src/permissions.rs:2450-2462 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) codex-rs/rmcp-client/src/rmcp_client.rs:717 — codex-rs/rmcp-client/src/rmcp_client.rs:717-729 | codex-rs/rmcp-client/src/rmcp_client.rs:1955-1967 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) codex-rs/rollout-trace/src/protocol_event.rs:439 — codex-rs/rollout-trace/src/protocol_event.rs:439-451 | codex-rs/rollout-trace/src/protocol_event.rs:520-532 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) codex-rs/thread-store/src/local/list_threads.rs:31 — codex-rs/thread-store/src/local/list_threads.rs:31-43 | codex-rs/thread-store/src/local/search_threads.rs:46-58 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (13 lines × 2) codex-rs/thread-store/src/local/list_threads.rs:45 — codex-rs/thread-store/src/local/list_threads.rs:45-57 | codex-rs/thread-store/src/local/search_threads.rs:64-76 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (13 lines × 2) codex-rs/tui/src/app/thread_goal_actions.rs:29 — codex-rs/tui/src/app/thread_goal_actions.rs:29-41 | codex-rs/tui/src/app/thread_goal_actions.rs:98-110 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) codex-rs/tui/src/bottom_pane/chat_composer.rs:4412 — codex-rs/tui/src/bottom_pane/chat_composer.rs:4412-4424 | codex-rs/tui/src/mention_codec.rs:288-300 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (13 lines × 2) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1270 — codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1270-1282 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:1066-1078 — before extracting anything, compare `codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs` and `codex-rs/tui/src/bottom_pane/request_user_input/mod.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) codex-rs/utils/image/src/lib.rs:381 — codex-rs/utils/image/src/lib.rs:381-393 | codex-rs/utils/image/src/lib.rs:407-419 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) codex-rs/windows-sandbox-rs/src/acl.rs:112 — codex-rs/windows-sandbox-rs/src/acl.rs:112-124 | codex-rs/windows-sandbox-rs/src/acl.rs:920-932 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) codex-rs/windows-sandbox-rs/src/acl.rs:769 — codex-rs/windows-sandbox-rs/src/acl.rs:769-781 | codex-rs/windows-sandbox-rs/src/acl.rs:1027-1039 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) codex-rs/message-board/src/in_memory.rs:262 — codex-rs/message-board/src/in_memory.rs:262-274 | codex-rs/message-board/src/local.rs:141-153 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • + 3 more in this group — see findings.md.
D2 · Cognitive Complexity · codex_cli · ×24
  • codex_cli::cli_main (cognitive 120) codex-rs/cli/src/main.rs:1053 — codex_cli::cli_main has cognitive complexity 120 (threshold 15). Drivers by points: if/else 31 (76 pts), match/switch 11 (23 pts), boolean chains 11, loops 3 (10 pts) (nesting depth added 64). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::doctor::mcp_check_from_servers (cognitive 87) codex-rs/cli/src/doctor.rs:1517 — codex_cli::doctor::mcp_check_from_servers has cognitive complexity 87 (threshold 15). Drivers by points: if/else 23 (60 pts), loops 5 (13 pts), boolean chains 7, match/switch 3 (7 pts) (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::doctor::sandbox::sandbox_check (cognitive 57) codex-rs/cli/src/doctor/sandbox.rs:47 — codex_cli::doctor::sandbox::sandbox_check has cognitive complexity 57 (threshold 15). Drivers by points: if/else 20 (36 pts), match/switch 4 (12 pts), boolean chains 6, loops 1 (3 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::plugin_cmd::render_plugin_list (cognitive 49) codex-rs/cli/src/plugin_cmd.rs:336 — codex_cli::plugin_cmd::render_plugin_list has cognitive complexity 49 (threshold 15). Drivers by points: if/else 16 (36 pts), loops 3 (8 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::doctor::stored_auth_issues (cognitive 40) codex-rs/cli/src/doctor.rs:1400 — codex_cli::doctor::stored_auth_issues has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (30 pts), match/switch 4 (7 pts), boolean chains 3 (nesting depth added 21). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_cli::debug_sandbox::pid_tracker::track_descendants (cognitive 39) codex-rs/cli/src/debug_sandbox/pid_tracker.rs:185 — codex_cli::debug_sandbox::pid_tracker::track_descendants has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (35 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::debug_sandbox::run_command_under_sandbox (cognitive 36) codex-rs/cli/src/debug_sandbox.rs:203 — codex_cli::debug_sandbox::run_command_under_sandbox has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (20 pts), match/switch 8 (10 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::doctor::updates::append_desktop_update (cognitive 32) codex-rs/cli/src/doctor/updates.rs:97 — codex_cli::doctor::updates::append_desktop_update has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (19 pts), match/switch 3 (10 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::doctor::thread_inventory::scan_rollout_root (cognitive 30) codex-rs/cli/src/doctor/thread_inventory.rs:455 — codex_cli::doctor::thread_inventory::scan_rollout_root has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 4 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::mcp_cmd::run_list (cognitive 29) codex-rs/cli/src/mcp_cmd.rs:690 — codex_cli::mcp_cmd::run_list has cognitive complexity 29 (threshold 15). Drivers by points: loops 7 (15 pts), if/else 7 (9 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • codex_cli::mcp_cmd::run_get (cognitive 24) codex-rs/cli/src/mcp_cmd.rs:958 — codex_cli::mcp_cmd::run_get has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (14 pts), match/switch 6 (10 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_cli::plugin_cmd::configured_marketplace_snapshot_issues (cognitive 23) codex-rs/cli/src/plugin_cmd.rs:1000 — codex_cli::plugin_cmd::configured_marketplace_snapshot_issues has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 2, match/switch 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::doctor::filesystem_paths::source (cognitive 21) codex-rs/cli/src/doctor/filesystem_paths.rs:207 — codex_cli::doctor::filesystem_paths::source has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, match/switch 2 (3 pts), loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::doctor::thread_inventory::parity_check_from_scan_and_rows (cognitive 20) codex-rs/cli/src/doctor/thread_inventory.rs:220 — codex_cli::doctor::thread_inventory::parity_check_from_scan_and_rows has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13, boolean chains 6, loops 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_cli::doctor::network::check (cognitive 19) codex-rs/cli/src/doctor/network.rs:22 — codex_cli::doctor::network::check has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::run_interactive_tui (cognitive 19) codex-rs/cli/src/main.rs:2495 — codex_cli::run_interactive_tui has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 2, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::doctor::provider_reachability_check (cognitive 18) codex-rs/cli/src/doctor.rs:2701 — codex_cli::doctor::provider_reachability_check has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 2 (4 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::doctor::filesystem_paths::check (cognitive 18) codex-rs/cli/src/doctor/filesystem_paths.rs:41 — codex_cli::doctor::filesystem_paths::check has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::doctor::output::redact_detail (cognitive 18) codex-rs/cli/src/doctor/output.rs:859 — codex_cli::doctor::output::redact_detail has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::doctor::thread_inventory::thread_id_from_rollout (cognitive 18) codex-rs/cli/src/doctor/thread_inventory.rs:526 — codex_cli::doctor::thread_inventory::thread_id_from_rollout has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 3 (5 pts), loops 1 (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_cli::doctor::updates::latest_macos_staged_build (cognitive 18) codex-rs/cli/src/doctor/updates.rs:321 — codex_cli::doctor::updates::latest_macos_staged_build has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::mcp_login::read_terminal_callback (cognitive 18) codex-rs/cli/src/mcp_login.rs:208 — codex_cli::mcp_login::read_terminal_callback has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (11 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::run_tui_with_recovery (cognitive 17) codex-rs/cli/src/main.rs:2573 — codex_cli::run_tui_with_recovery has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cli::migrate_nfs_db::run (cognitive 16) codex-rs/cli/src/migrate_nfs_db.rs:27 — codex_cli::migrate_nfs_db::run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×22
  • Duplicated block (15 lines × 2) codex-rs/app-server-protocol/src/protocol/event_mapping.rs:269 — codex-rs/app-server-protocol/src/protocol/event_mapping.rs:269-283 | codex-rs/app-server-protocol/src/protocol/event_mapping.rs:322-336 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) codex-rs/codex-mcp/src/mcp/mod.rs:467 — codex-rs/codex-mcp/src/mcp/mod.rs:467-481 | codex-rs/codex-mcp/src/mcp/mod.rs:556-570 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) codex-rs/connectors/src/lib.rs:495 — codex-rs/connectors/src/lib.rs:495-509 | codex-rs/utils/plugins/src/mcp_connector.rs:6-20 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (15 lines × 2) codex-rs/core-plugins/src/loader.rs:1782 — codex-rs/core-plugins/src/loader.rs:1782-1796 | codex-rs/core-plugins/src/npm_source.rs:38-52 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (15 lines × 2) codex-rs/core-plugins/src/startup_sync.rs:927 — codex-rs/core-plugins/src/startup_sync.rs:927-941 | codex-rs/core-plugins/src/startup_sync.rs:973-987 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) codex-rs/core/src/client.rs:1754 — codex-rs/core/src/client.rs:1754-1768 | codex-rs/core/src/client.rs:2186-2200 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) codex-rs/core/src/mcp_tool_call.rs:1027 — codex-rs/core/src/mcp_tool_call.rs:1027-1041 | codex-rs/core/src/mcp_tool_call.rs:1073-1087 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) codex-rs/core/src/session/mod.rs:4646 — codex-rs/core/src/session/mod.rs:4646-4660 | codex-rs/core/src/session/mod.rs:4743-4757 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resource_templates.rs:56 — codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resource_templates.rs:56-70 | codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resources.rs:56-70 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (15 lines × 2) codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:45 — codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:45-59 | codex-rs/ext/skills/src/dynamic_skill_selector/fielded_bm25.rs:41-55 — before extracting anything, compare `codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs` and `codex-rs/ext/skills/src/dynamic_skill_selector/fielded_bm25.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:165 — codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:165-179 | codex-rs/ext/skills/src/dynamic_skill_selector/fielded_bm25.rs:190-204 — before extracting anything, compare `codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs` and `codex-rs/ext/skills/src/dynamic_skill_selector/fielded_bm25.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) codex-rs/external-agent-migration/src/sessions/records_cla.rs:28 — codex-rs/external-agent-migration/src/sessions/records_cla.rs:28-42 | codex-rs/external-agent-migration/src/sessions/records_cur.rs:30-44 — before extracting anything, compare `codex-rs/external-agent-migration/src/sessions/records_cla.rs` and `codex-rs/external-agent-migration/src/sessions/records_cur.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 104 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) codex-rs/external-agent-migration/src/sessions/records_cla.rs:114 — codex-rs/external-agent-migration/src/sessions/records_cla.rs:114-128 | codex-rs/external-agent-migration/src/sessions/records_cur.rs:103-117 — before extracting anything, compare `codex-rs/external-agent-migration/src/sessions/records_cla.rs` and `codex-rs/external-agent-migration/src/sessions/records_cur.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 104 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) codex-rs/hooks/src/events/post_tool_use.rs:101 — codex-rs/hooks/src/events/post_tool_use.rs:101-115 | codex-rs/hooks/src/events/pre_tool_use.rs:103-117 — before extracting anything, compare `codex-rs/hooks/src/events/post_tool_use.rs` and `codex-rs/hooks/src/events/pre_tool_use.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) codex-rs/protocol/src/models.rs:1402 — codex-rs/protocol/src/models.rs:1402-1416 | codex-rs/protocol/src/models.rs:1424-1438 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) codex-rs/tui/src/chatwidget/realtime.rs:913 — codex-rs/tui/src/chatwidget/realtime.rs:913-927 | codex-rs/tui/src/chatwidget/realtime.rs:1017-1031 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) codex-rs/tui/src/lib.rs:1511 — codex-rs/tui/src/lib.rs:1511-1525 | codex-rs/tui/src/lib.rs:1609-1623 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) codex-rs/windows-sandbox-rs/src/acl.rs:169 — codex-rs/windows-sandbox-rs/src/acl.rs:169-183 | codex-rs/windows-sandbox-rs/src/acl.rs:465-479 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) codex-rs/app-server/src/command_exec.rs:641 — codex-rs/app-server/src/command_exec.rs:641-655 | codex-rs/app-server/src/request_processors/process_exec_processor.rs:685-701 — before extracting anything, compare `codex-rs/app-server/src/command_exec.rs` and `codex-rs/app-server/src/request_processors/process_exec_processor.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) codex-rs/app-server/src/bespoke_event_handling.rs:1690 — codex-rs/app-server/src/bespoke_event_handling.rs:1690-1704 | codex-rs/app-server/src/bespoke_event_handling.rs:1706-1720 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) codex-rs/core/src/context_manager/normalize.rs:88 — codex-rs/core/src/context_manager/normalize.rs:88-102 | codex-rs/core/src/context_manager/normalize.rs:116-130 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) codex-rs/hooks/src/events/stop.rs:150 — codex-rs/hooks/src/events/stop.rs:150-164 | codex-rs/hooks/src/events/stop.rs:184-198 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D2 · Cognitive Complexity · codex_app_server · ×21
  • codex_app_server::run_main_with_transport_options (cognitive 194) codex-rs/app-server/src/lib.rs:508 — codex_app_server::run_main_with_transport_options has cognitive complexity 194 (threshold 15). Drivers by points: if/else 61 (130 pts), match/switch 17 (33 pts), boolean chains 18, loops 7 (13 pts) (nesting depth added 91). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server::in_process::start_uninitialized (cognitive 107) codex-rs/app-server/src/in_process.rs:433 — codex_app_server::in_process::start_uninitialized has cognitive complexity 107 (threshold 15). Drivers by points: if/else 22 (60 pts), match/switch 12 (43 pts), loops 3, boolean chains 1 (nesting depth added 69). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server::request_processors::thread_lifecycle::ensure_listener_task_running (cognitive 76) codex-rs/app-server/src/request_processors/thread_lifecycle.rs:232 — codex_app_server::request_processors::thread_lifecycle::ensure_listener_task_running has cognitive complexity 76 (threshold 15). Drivers by points: if/else 20 (56 pts), match/switch 6 (15 pts), boolean chains 4, loops 1 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server::bespoke_event_handling::apply_bespoke_event_handling (cognitive 69) codex-rs/app-server/src/bespoke_event_handling.rs:147 — codex_app_server::bespoke_event_handling::apply_bespoke_event_handling has cognitive complexity 69 (threshold 15). Drivers by points: if/else 18 (38 pts), match/switch 14 (27 pts), boolean chains 4 (nesting depth added 33). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_app_server::mcp_refresh::reload_mcp_config_with_policy (cognitive 66) codex-rs/app-server/src/mcp_refresh.rs:44 — codex_app_server::mcp_refresh::reload_mcp_config_with_policy has cognitive complexity 66 (threshold 15). Drivers by points: if/else 11 (34 pts), match/switch 5 (17 pts), loops 5 (11 pts), boolean chains 4 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server::request_processors::thread_lifecycle::handle_pending_thread_resume_request (cognitive 37) codex-rs/app-server/src/request_processors/thread_lifecycle.rs:722 — codex_app_server::request_processors::thread_lifecycle::handle_pending_thread_resume_request has cognitive complexity 37 (threshold 15). Drivers by points: if/else 24 (31 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_app_server::request_processors::thread_processor::validate_dynamic_tools (cognitive 33) codex-rs/app-server/src/request_processors/thread_processor.rs:333 — codex_app_server::request_processors::thread_processor::validate_dynamic_tools has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 4, loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 10). Of this number, 20 points are the body's own statements and 13 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server::request_processors::config_processor::reload_user_config_inner (cognitive 29) codex-rs/app-server/src/request_processors/config_processor.rs:378 — codex_app_server::request_processors::config_processor::reload_user_config_inner has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 2 (6 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server::request_processors::mcp_event_stream::forward_events (cognitive 29) codex-rs/app-server/src/request_processors/mcp_event_stream.rs:183 — codex_app_server::request_processors::mcp_event_stream::forward_events has cognitive complexity 29 (threshold 15). Drivers by points: match/switch 4 (14 pts), if/else 7 (12 pts), boolean chains 2, loops 1 (nesting depth added 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_app_server::request_processors::thread_processor::collect_resume_override_mismatches (cognitive 27) codex-rs/app-server/src/request_processors/thread_processor.rs:121 — codex_app_server::request_processors::thread_processor::collect_resume_override_mismatches has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • codex_app_server::request_processors::account_processor::workspace_routing::workspace_config_load_reason (cognitive 26) codex-rs/app-server/src/request_processors/account_processor/workspace_routing.rs:109 — codex_app_server::request_processors::account_processor::workspace_routing::workspace_config_load_reason has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (18 pts), match/switch 3 (7 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server::request_processors::feedback_rollout_history::history_base_attachments (cognitive 25) codex-rs/app-server/src/request_processors/feedback_rollout_history.rs:18 — codex_app_server::request_processors::feedback_rollout_history::history_base_attachments has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 3 (6 pts), loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server::codex_home_metrics::directory_sizes (cognitive 24) codex-rs/app-server/src/codex_home_metrics.rs:71 — codex_app_server::codex_home_metrics::directory_sizes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (4 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server::otel_reloader::spawn (cognitive 19) codex-rs/app-server/src/otel_reloader.rs:44 — codex_app_server::otel_reloader::spawn has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 3 (8 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server::request_processors::process_exec_processor::run_process (cognitive 19) codex-rs/app-server/src/request_processors/process_exec_processor.rs:487 — codex_app_server::request_processors::process_exec_processor::run_process has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 3 (9 pts), if/else 3 (8 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_app_server::command_exec::run_command (cognitive 18) codex-rs/app-server/src/command_exec.rs:455 — codex_app_server::command_exec::run_command has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 3 (9 pts), if/else 3 (8 pts), loops 1 (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_app_server::request_processors::thread_processor::paginate_thread_turns (cognitive 18) codex-rs/app-server/src/request_processors/thread_processor.rs:6152 — codex_app_server::request_processors::thread_processor::paginate_thread_turns has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server::command_exec::spawn_process_output (cognitive 16) codex-rs/app-server/src/command_exec.rs:569 — codex_app_server::command_exec::spawn_process_output has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 3 (7 pts), if/else 3 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server::config_manager_service::apply_merge (cognitive 16) codex-rs/app-server/src/config_manager_service.rs:614 — codex_app_server::config_manager_service::apply_merge has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 4 (6 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server::request_processors::process_exec_processor::collect_spawn_process_output (cognitive 16) codex-rs/app-server/src/request_processors/process_exec_processor.rs:610 — codex_app_server::request_processors::process_exec_processor::collect_spawn_process_output has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 3 (7 pts), if/else 3 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server::thread_sample::collect_response (cognitive 16) codex-rs/app-server/src/thread_sample.rs:383 — codex_app_server::thread_sample::collect_response has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 2 (6 pts), if/else 1 (5 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_windows_sandbox · ×20
  • codex_windows_sandbox::setup_provisioning::run_setup_full (cognitive 53) codex-rs/windows-sandbox-rs/src/setup_provisioning.rs:912 — codex_windows_sandbox::setup_provisioning::run_setup_full has cognitive complexity 53 (threshold 15). Drivers by points: if/else 19 (29 pts), match/switch 5 (12 pts), loops 7 (10 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox::bin::command_runner::win::main (cognitive 33) codex-rs/windows-sandbox-rs/src/bin/command_runner/win.rs:547 — codex_windows_sandbox::bin::command_runner::win::main has cognitive complexity 33 (threshold 15). Drivers by points: if/else 23 (28 pts), boolean chains 2, match/switch 2, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_windows_sandbox::setup_provisioning::setup_runtime_bin::ensure_runtime_tree_readable (cognitive 33) codex-rs/windows-sandbox-rs/src/setup_provisioning/setup_runtime_bin.rs:110 — codex_windows_sandbox::setup_provisioning::setup_runtime_bin::ensure_runtime_tree_readable has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 4 (11 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox::spawn_prep::apply_legacy_session_acl_rules (cognitive 31) codex-rs/windows-sandbox-rs/src/spawn_prep.rs:268 — codex_windows_sandbox::spawn_prep::apply_legacy_session_acl_rules has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 7 (12 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox::bin::command_runner::win::spawn_input_loop (cognitive 29) codex-rs/windows-sandbox-rs/src/bin/command_runner/win.rs:442 — codex_windows_sandbox::bin::command_runner::win::spawn_input_loop has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (19 pts), loops 2 (5 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox::windows_impl::run_windows_sandbox_capture_with_filesystem_overrides (cognitive 27) codex-rs/windows-sandbox-rs/src/lib.rs:708 — codex_windows_sandbox::windows_impl::run_windows_sandbox_capture_with_filesystem_overrides has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 4, loops 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox::acl::ensure_allow_mask_aces_with_inheritance_impl (cognitive 25) codex-rs/windows-sandbox-rs/src/acl.rs:541 — codex_windows_sandbox::acl::ensure_allow_mask_aces_with_inheritance_impl has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 4, match/switch 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox::identity::require_sandbox_account_with_setup (cognitive 25) codex-rs/windows-sandbox-rs/src/identity.rs:326 — codex_windows_sandbox::identity::require_sandbox_account_with_setup has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (4 pts), match/switch 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox::acl::dacl_mask_allows_with_scope (cognitive 24) codex-rs/windows-sandbox-rs/src/acl.rs:158 — codex_windows_sandbox::acl::dacl_mask_allows_with_scope has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox::provisioning_client::connect (cognitive 22) codex-rs/windows-sandbox-rs/src/provisioning_client.rs:330 — codex_windows_sandbox::provisioning_client::connect has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (17 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox::elevated::runner_client::connect_pipe_with_timeout (cognitive 19) codex-rs/windows-sandbox-rs/src/elevated/runner_client.rs:233 — codex_windows_sandbox::elevated::runner_client::connect_pipe_with_timeout has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox::elevated_impl::windows_impl::run_windows_sandbox_capture_for_permission_profile (cognitive 19) codex-rs/windows-sandbox-rs/src/elevated_impl.rs:100 — codex_windows_sandbox::elevated_impl::windows_impl::run_windows_sandbox_capture_for_permission_profile has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (11 pts), if/else 6 (7 pts), loops 1 (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_windows_sandbox::uninstall_windows::processes::stop (cognitive 19) codex-rs/windows-sandbox-rs/src/uninstall_windows/processes.rs:45 — codex_windows_sandbox::uninstall_windows::processes::stop has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (5 pts), match/switch 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox::wrapper::create_windows_sandbox_command_args_for_permission_profile (cognitive 19) codex-rs/windows-sandbox-rs/src/wrapper.rs:52 — codex_windows_sandbox::wrapper::create_windows_sandbox_command_args_for_permission_profile has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16 (18 pts), loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_windows_sandbox::unified_exec::backends::windows_common::start_runner_stdout_reader (cognitive 18) codex-rs/windows-sandbox-rs/src/unified_exec/backends/windows_common.rs:80 — codex_windows_sandbox::unified_exec::backends::windows_common::start_runner_stdout_reader has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), match/switch 3 (8 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox::acl::add_deny_ace (cognitive 17) codex-rs/windows-sandbox-rs/src/acl.rs:894 — codex_windows_sandbox::acl::add_deny_ace has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox::uninstall_windows::processes::sandbox_processes (cognitive 17) codex-rs/windows-sandbox-rs/src/uninstall_windows/processes.rs:99 — codex_windows_sandbox::uninstall_windows::processes::sandbox_processes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox::deny_read_resolver::resolve_deny_read_paths (cognitive 16) REDACTED:57 — codex_windows_sandbox::deny_read_resolver::resolve_deny_read_paths has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (5 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox::setup::run_setup_exe_payload (cognitive 16) codex-rs/windows-sandbox-rs/src/setup.rs:965 — codex_windows_sandbox::setup::run_setup_exe_payload has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 1, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox::uninstall_windows::processes::blocking_logon_session (cognitive 16) codex-rs/windows-sandbox-rs/src/uninstall_windows/processes.rs:162 — codex_windows_sandbox::uninstall_windows::processes::blocking_logon_session has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_shell_command · ×18
  • codex_shell_command::shell_snapshot_literals::literal_words_with_quoting (cognitive 254) codex-rs/shell-command/src/shell_snapshot_literals.rs:51 — codex_shell_command::shell_snapshot_literals::literal_words_with_quoting has cognitive complexity 254 (threshold 15). Drivers by points: if/else 46 (151 pts), loops 16 (55 pts), match/switch 6 (26 pts), boolean chains 22 (nesting depth added 164). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_shell_command::parse_command::summarize_main_tokens (cognitive 99) codex-rs/shell-command/src/parse_command.rs:2290 — codex_shell_command::parse_command::summarize_main_tokens has cognitive complexity 99 (threshold 15). Drivers by points: if/else 36 (72 pts), boolean chains 12, match/switch 5 (9 pts), loops 2 (6 pts) (nesting depth added 44). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_shell_command::shell_snapshot_literals::decode_ansi_c_bytes (cognitive 83) codex-rs/shell-command/src/shell_snapshot_literals.rs:546 — codex_shell_command::shell_snapshot_literals::decode_ansi_c_bytes has cognitive complexity 83 (threshold 15). Drivers by points: if/else 21 (62 pts), match/switch 3 (10 pts), loops 3 (9 pts), boolean chains 2 (nesting depth added 54). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_shell_command::shell_snapshot_credentials::prepare_snapshot_credentials (cognitive 70) codex-rs/shell-command/src/shell_snapshot_credentials.rs:39 — codex_shell_command::shell_snapshot_credentials::prepare_snapshot_credentials has cognitive complexity 70 (threshold 15). Drivers by points: if/else 24 (43 pts), boolean chains 23, loops 2, match/switch 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_shell_command::parse_command::parse_shell_script (cognitive 62) codex-rs/shell-command/src/parse_command.rs:1997 — codex_shell_command::parse_command::parse_shell_script has cognitive complexity 62 (threshold 15). Drivers by points: if/else 16 (40 pts), match/switch 3 (11 pts), boolean chains 6, loops 2 (5 pts) (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • codex_shell_command::command_safety::powershell_tree_sitter::source_is_covered_by_commands (cognitive 49) codex-rs/shell-command/src/command_safety/powershell_tree_sitter.rs:207 — codex_shell_command::command_safety::powershell_tree_sitter::source_is_covered_by_commands has cognitive complexity 49 (threshold 15). Drivers by points: if/else 16 (35 pts), boolean chains 13, loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_shell_command::command_safety::windows_dangerous_commands::has_force_delete_cmdlet (cognitive 27) codex-rs/shell-command/src/command_safety/windows_dangerous_commands.rs:291 — codex_shell_command::command_safety::windows_dangerous_commands::has_force_delete_cmdlet has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_shell_command::parse_command::parse_command_impl (cognitive 25) codex-rs/shell-command/src/parse_command.rs:1423 — codex_shell_command::parse_command::parse_command_impl has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 2 (6 pts), boolean chains 2, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_shell_command::bash::try_parse_word_only_commands_sequence (cognitive 22) codex-rs/shell-command/src/bash.rs:29 — codex_shell_command::bash::try_parse_word_only_commands_sequence has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_shell_command::shell_snapshot_literals::literal_word_bytes (cognitive 20) codex-rs/shell-command/src/shell_snapshot_literals.rs:469 — codex_shell_command::shell_snapshot_literals::literal_word_bytes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 2 (4 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_shell_command::parse_command::parse_grep_like (cognitive 19) codex-rs/shell-command/src/parse_command.rs:1787 — codex_shell_command::parse_command::parse_grep_like has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_shell_command::command_safety::windows_dangerous_commands::classify_powershell_words (cognitive 18) codex-rs/shell-command/src/command_safety/windows_dangerous_commands.rs:104 — codex_shell_command::command_safety::windows_dangerous_commands::classify_powershell_words has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (8 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • codex_shell_command::command_safety::windows_dangerous_commands::is_dangerous_cmd (cognitive 18) codex-rs/shell-command/src/command_safety/windows_dangerous_commands.rs:158 — codex_shell_command::command_safety::windows_dangerous_commands::is_dangerous_cmd has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, boolean chains 6, match/switch 2 (3 pts), loops 1 (nesting depth added 1). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_shell_command::parse_command::sed_has_in_place_flag (cognitive 18) codex-rs/shell-command/src/parse_command.rs:2252 — codex_shell_command::parse_command::sed_has_in_place_flag has cognitive complexity 18 (threshold 15). Drivers by points: if/else 2 (8 pts), match/switch 2 (6 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_shell_command::bash::parse_plain_command_from_node (cognitive 17) codex-rs/shell-command/src/bash.rs:159 — codex_shell_command::bash::parse_plain_command_from_node has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), match/switch 2 (6 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_shell_command::command_safety::powershell_tree_sitter::lower_command_text (cognitive 17) codex-rs/shell-command/src/command_safety/powershell_tree_sitter.rs:309 — codex_shell_command::command_safety::powershell_tree_sitter::lower_command_text has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_shell_command::parse_command::positional_operands (cognitive 17) codex-rs/shell-command/src/parse_command.rs:1753 — codex_shell_command::parse_command::positional_operands has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_shell_command::parse_command::skip_flag_values (cognitive 16) codex-rs/shell-command/src/parse_command.rs:1706 — codex_shell_command::parse_command::skip_flag_values has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_thread_store · ×17
  • codex_thread_store::local::update_thread_metadata::apply_metadata_update (cognitive 76) codex-rs/thread-store/src/local/update_thread_metadata.rs:347 — codex_thread_store::local::update_thread_metadata::apply_metadata_update has cognitive complexity 76 (threshold 15). Drivers by points: if/else 43 (61 pts), boolean chains 9, match/switch 3 (6 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_thread_store::local::update_thread_metadata::update_thread_metadata (cognitive 50) codex-rs/thread-store/src/local/update_thread_metadata.rs:38 — codex_thread_store::local::update_thread_metadata::update_thread_metadata has cognitive complexity 50 (threshold 15). Drivers by points: if/else 25 (31 pts), boolean chains 13, match/switch 4 (6 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_thread_store::local::thread_history_materialization::read_projection_batches (cognitive 39) codex-rs/thread-store/src/local/thread_history_materialization.rs:84 — codex_thread_store::local::thread_history_materialization::read_projection_batches has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (22 pts), match/switch 6 (12 pts), boolean chains 4, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_thread_store::local::thread_history::segment_paging::page_item_rows (cognitive 35) codex-rs/thread-store/src/local/thread_history/segment_paging.rs:194 — codex_thread_store::local::thread_history::segment_paging::page_item_rows has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 3 (6 pts), boolean chains 4, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_thread_store::local::thread_history::search::search_thread_occurrences (cognitive 31) codex-rs/thread-store/src/local/thread_history/search.rs:50 — codex_thread_store::local::thread_history::search::search_thread_occurrences has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 4 (8 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_thread_store::local::search_threads::search_threads (cognitive 27) codex-rs/thread-store/src/local/search_threads.rs:36 — codex_thread_store::local::search_threads::search_threads has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (5 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_thread_store::local::read_thread::read_thread (cognitive 25) codex-rs/thread-store/src/local/read_thread.rs:32 — codex_thread_store::local::read_thread::read_thread has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 9, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_thread_store::local::rollout_migration::find_rollout_paths (cognitive 24) codex-rs/thread-store/src/local/rollout_migration.rs:1283 — codex_thread_store::local::rollout_migration::find_rollout_paths has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (16 pts), boolean chains 3, loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_thread_store::local::rollout_migration::legacy_event::user_message_item (cognitive 24) codex-rs/thread-store/src/local/rollout_migration/legacy_event.rs:37 — codex_thread_store::local::rollout_migration::legacy_event::user_message_item has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (7 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_thread_store::local::thread_rollout_resolver::resolve (cognitive 23) codex-rs/thread-store/src/local/thread_rollout_resolver.rs:73 — codex_thread_store::local::thread_rollout_resolver::resolve has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 3 (7 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_thread_store::local::unarchive_thread::unarchive_thread (cognitive 23) codex-rs/thread-store/src/local/unarchive_thread.rs:19 — codex_thread_store::local::unarchive_thread::unarchive_thread has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 2, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_thread_store::local::model_context::load_for_fork (cognitive 22) codex-rs/thread-store/src/local/model_context.rs:95 — codex_thread_store::local::model_context::load_for_fork has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (5 pts), match/switch 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_thread_store::local::thread_history::realtime::list_timeline (cognitive 22) codex-rs/thread-store/src/local/thread_history/realtime.rs:42 — codex_thread_store::local::thread_history::realtime::list_timeline has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3 (4 pts), match/switch 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_thread_store::local::helpers::resolve_thread_names (cognitive 21) codex-rs/thread-store/src/local/helpers.rs:229 — codex_thread_store::local::helpers::resolve_thread_names has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 3 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_thread_store::local::archive_thread::archive_thread_with_paths (cognitive 18) codex-rs/thread-store/src/local/archive_thread.rs:67 — codex_thread_store::local::archive_thread::archive_thread_with_paths has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_thread_store::local::thread_history::segment_paging::page_turn_rows (cognitive 18) codex-rs/thread-store/src/local/thread_history/segment_paging.rs:45 — codex_thread_store::local::thread_history::segment_paging::page_turn_rows has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_thread_store::local::thread_history::apply_projection (cognitive 16) codex-rs/thread-store/src/local/thread_history.rs:104 — codex_thread_store::local::thread_history::apply_projection has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_core_plugins · ×17
  • codex_core_plugins::loader::apply_configured_plugin_mcp_server_policies (cognitive 44) codex-rs/core-plugins/src/loader.rs:1451 — codex_core_plugins::loader::apply_configured_plugin_mcp_server_policies has cognitive complexity 44 (threshold 15). Drivers by points: if/else 8 (27 pts), loops 4 (11 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core_plugins::remote::fetch_remote_marketplaces (cognitive 35) codex-rs/core-plugins/src/remote.rs:820 — codex_core_plugins::remote::fetch_remote_marketplaces has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (26 pts), match/switch 3 (8 pts), loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core_plugins::loader::refresh_non_curated_plugin_cache_with_mode (cognitive 27) codex-rs/core-plugins/src/loader.rs:577 — codex_core_plugins::loader::refresh_non_curated_plugin_cache_with_mode has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 5 (9 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core_plugins::plugin_metrics::validate_manifest (cognitive 27) codex-rs/core-plugins/src/plugin_metrics.rs:81 — codex_core_plugins::plugin_metrics::validate_manifest has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (6 pts), boolean chains 5 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core_plugins::loader::refresh_curated_plugin_cache (cognitive 25) codex-rs/core-plugins/src/loader.rs:396 — codex_core_plugins::loader::refresh_curated_plugin_cache has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (4 pts), match/switch 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core_plugins::agent_plugin_manifest::parse_agent_plugin_manifest_uri (cognitive 23) codex-rs/core-plugins/src/agent_plugin_manifest.rs:64 — codex_core_plugins::agent_plugin_manifest::parse_agent_plugin_manifest_uri has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (19 pts), loops 3 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core_plugins::loader::load_plugin_mcp_servers_from_manifest_with_format (cognitive 23) codex-rs/core-plugins/src/loader.rs:1552 — codex_core_plugins::loader::load_plugin_mcp_servers_from_manifest_with_format has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 3 (7 pts), match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core_plugins::toggles::collect_plugin_enabled_candidates (cognitive 20) codex-rs/core-plugins/src/toggles.rs:4 — codex_core_plugins::toggles::collect_plugin_enabled_candidates has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core_plugins::store::replace_plugin_root_atomically (cognitive 19) codex-rs/core-plugins/src/store.rs:554 — codex_core_plugins::store::replace_plugin_root_atomically has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_core_plugins::loader::merge_configured_plugins_with_remote_installed (cognitive 18) codex-rs/core-plugins/src/loader.rs:249 — codex_core_plugins::loader::merge_configured_plugins_with_remote_installed has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core_plugins::marketplace_upgrade::activation::activate_marketplace_root (cognitive 18) codex-rs/core-plugins/src/marketplace_upgrade/activation.rs:87 — codex_core_plugins::marketplace_upgrade::activation::activate_marketplace_root has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 3 (6 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core_plugins::remote::remote_installed_plugin_sync::sync_remote_installed_plugin_bundles_once_with_snapshot (cognitive 18) codex-rs/core-plugins/src/remote/remote_installed_plugin_sync.rs:132 — codex_core_plugins::remote::remote_installed_plugin_sync::sync_remote_installed_plugin_bundles_once_with_snapshot has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4, match/switch 2 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core_plugins::remote::remote_installed_plugin_sync::remove_stale_remote_plugin_caches (cognitive 18) codex-rs/core-plugins/src/remote/remote_installed_plugin_sync.rs:394 — codex_core_plugins::remote::remote_installed_plugin_sync::remove_stale_remote_plugin_caches has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core_plugins::startup_sync::remove_stale_curated_repo_temp_dirs (cognitive 18) codex-rs/core-plugins/src/startup_sync.rs:400 — codex_core_plugins::startup_sync::remove_stale_curated_repo_temp_dirs has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (9 pts), if/else 4 (8 pts), loops 1 (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_core_plugins::agent_plugin_mcp_overlay::apply_codex_env_overlay (cognitive 17) codex-rs/core-plugins/src/agent_plugin_mcp_overlay.rs:13 — codex_core_plugins::agent_plugin_mcp_overlay::apply_codex_env_overlay has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 pts), match/switch 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core_plugins::catalog::merge_catalogs (cognitive 17) codex-rs/core-plugins/src/catalog.rs:93 — codex_core_plugins::catalog::merge_catalogs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_core_plugins::loader::load_mcp_servers_from_file (cognitive 17) codex-rs/core-plugins/src/loader.rs:1609 — codex_core_plugins::loader::load_mcp_servers_from_file has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (7 pts), match/switch 4 (7 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D6 · Cohesion (LCOM4) · Low cohesion · ×16
  • Low cohesion: LocalThreadStore (LCOM4 40) codex-rs/thread-store/src/local/mod.rs:147 — LocalThreadStore's methods fall into 40 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 40 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: GoalExtension (LCOM4 8) codex-rs/ext/goal/src/extension.rs:60 — GoalExtension's methods fall into 8 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 8 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: WebSocketConnection (LCOM4 6) codex-rs/websocket-client/src/lib.rs:223 — WebSocketConnection's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: ExecCommandHandler (LCOM4 5) codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs:78 — ExecCommandHandler's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: GuardianExtension (LCOM4 5) codex-rs/ext/guardian-v2/src/sync_reviewer/mod.rs:42 — GuardianExtension's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: SessionTelemetry (LCOM4 5) codex-rs/otel/src/events/session_telemetry.rs:121 — SessionTelemetry's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Notifications (LCOM4 4) codex-rs/agent-message-board-client/src/notifications.rs:25 — Notifications's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: HttpClient (LCOM4 4) codex-rs/cloud-tasks-client/src/http.rs:25 — HttpClient's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: ModelClient (LCOM4 4) codex-rs/core/src/client.rs:300 — ModelClient's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: ExecServerClient (LCOM4 4) codex-rs/exec-server/src/client.rs:356 — ExecServerClient's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: GuardianV2Extension (LCOM4 4) codex-rs/ext/guardian-v2/src/async_scorer/extension.rs:37 — GuardianV2Extension's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: MemoriesExtension (LCOM4 4) codex-rs/ext/memories/src/extension.rs:27 — MemoriesExtension's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: RouteAwareClientPool (LCOM4 4) codex-rs/http-client/src/route_aware_client_pool.rs:53 — RouteAwareClientPool's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: MetricsConfig (LCOM4 4) codex-rs/otel/src/metrics/config.rs:45 — MetricsConfig's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: ModelInfo (LCOM4 4) codex-rs/protocol/src/openai_models.rs:413 — ModelInfo's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: TestToolServer (LCOM4 4) codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs:57 — TestToolServer's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
D2 · Cognitive Complexity · ChatComposer · ×15
  • ChatComposer::render_with_options (cognitive 168) codex-rs/tui/src/bottom_pane/chat_composer.rs:4532 — ChatComposer::render_with_options has cognitive complexity 168 (threshold 15). Drivers by points: if/else 76 (133 pts), boolean chains 20, match/switch 6 (15 pts) (nesting depth added 66). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatComposer::handle_key_event_with_slash_popup (cognitive 59) codex-rs/tui/src/bottom_pane/chat_composer/slash_input.rs:238 — ChatComposer::handle_key_event_with_slash_popup has cognitive complexity 59 (threshold 15). Drivers by points: if/else 19 (48 pts), match/switch 3 (8 pts), boolean chains 3 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatComposer::handle_key_event_without_popup (cognitive 48) codex-rs/tui/src/bottom_pane/chat_composer.rs:3478 — ChatComposer::handle_key_event_without_popup has cognitive complexity 48 (threshold 15). Drivers by points: if/else 26 (37 pts), boolean chains 11 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatComposer::mention_items (cognitive 48) codex-rs/tui/src/bottom_pane/chat_composer.rs:4160 — ChatComposer::mention_items has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (39 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatComposer::handle_input_basic_with_time (cognitive 42) codex-rs/tui/src/bottom_pane/chat_composer.rs:3632 — ChatComposer::handle_input_basic_with_time has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (31 pts), boolean chains 7, match/switch 2 (4 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatComposer::handle_submission_with_time (cognitive 35) codex-rs/tui/src/bottom_pane/chat_composer.rs:3165 — ChatComposer::handle_submission_with_time has cognitive complexity 35 (threshold 15). Drivers by points: if/else 21 (31 pts), boolean chains 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatComposer::sync_popups (cognitive 26) codex-rs/tui/src/bottom_pane/chat_composer.rs:3861 — ChatComposer::sync_popups has cognitive complexity 26 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ChatComposer::handle_non_ascii_char (cognitive 22) codex-rs/tui/src/bottom_pane/chat_composer.rs:2049 — ChatComposer::handle_non_ascii_char has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • ChatComposer::apply_external_edit (cognitive 21) codex-rs/tui/src/bottom_pane/chat_composer.rs:1284 — ChatComposer::apply_external_edit has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 6 (7 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatComposer::prepare_submission_text_with_options (cognitive 21) codex-rs/tui/src/bottom_pane/chat_composer.rs:3007 — ChatComposer::prepare_submission_text_with_options has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ChatComposer::handle_key_event_with_mentions_v2_popup (cognitive 19) codex-rs/tui/src/bottom_pane/chat_composer.rs:2288 — ChatComposer::handle_key_event_with_mentions_v2_popup has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatComposer::sync_command_popup (cognitive 19) codex-rs/tui/src/bottom_pane/chat_composer.rs:3971 — ChatComposer::sync_command_popup has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatComposer::handle_restricted_key (cognitive 17) codex-rs/tui/src/bottom_pane/chat_composer/reconnect.rs:55 — ChatComposer::handle_restricted_key has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatComposer::handle_key_event_with_file_popup (cognitive 17) codex-rs/tui/src/bottom_pane/chat_composer.rs:2120 — ChatComposer::handle_key_event_with_file_popup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatComposer::note_sparkle_paste (cognitive 16) codex-rs/tui/src/bottom_pane/chat_composer/sparkle.rs:263 — ChatComposer::note_sparkle_paste has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Session · ×15
  • Session::new (cognitive 135) codex-rs/core/src/session/session.rs:812 — Session::new has cognitive complexity 135 (threshold 15). Drivers by points: if/else 61 (76 pts), match/switch 17 (27 pts), boolean chains 23, loops 8 (9 pts) (nesting depth added 26). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Session::build_world_state_for_step (cognitive 57) codex-rs/core/src/session/world_state.rs:59 — Session::build_world_state_for_step has cognitive complexity 57 (threshold 15). Drivers by points: if/else 26 (33 pts), boolean chains 10, match/switch 5 (8 pts), loops 3 (6 pts) (nesting depth added 13). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Session::spawn_internal (cognitive 46) codex-rs/core/src/session/mod.rs:603 — Session::spawn_internal has cognitive complexity 46 (threshold 15). Drivers by points: if/else 24 (32 pts), match/switch 6 (8 pts), boolean chains 6 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Session::build_initial_context_with_world_state (cognitive 45) codex-rs/core/src/session/mod.rs:4670 — Session::build_initial_context_with_world_state has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 7 (10 pts), match/switch 3 (9 pts), boolean chains 8 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Session::refresh_config (cognitive 35) codex-rs/core/src/session/config_refresh.rs:52 — Session::refresh_config has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (25 pts), loops 2 (5 pts), boolean chains 3, match/switch 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Session::project_selected_environment_mcp_servers (cognitive 33) codex-rs/core/src/session/mcp_runtime.rs:137 — Session::project_selected_environment_mcp_servers has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 5, loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Session::reload_user_config_layer (cognitive 28) codex-rs/core/src/session/mod.rs:2363 — Session::reload_user_config_layer has cognitive complexity 28 (threshold 15). Drivers by points: match/switch 6 (17 pts), if/else 3 (6 pts), loops 3 (5 pts) (nesting depth added 16). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Session::record_initial_history (cognitive 26) codex-rs/core/src/session/mod.rs:1663 — Session::record_initial_history has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 4 (7 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Session::on_task_finished (cognitive 25) codex-rs/core/src/tasks/mod.rs:655 — Session::on_task_finished has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 4, match/switch 3 (4 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Session::record_prepared_conversation_items (cognitive 24) codex-rs/core/src/session/mod.rs:3780 — Session::record_prepared_conversation_items has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 6, loops 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Session::update_environment_configuration (cognitive 21) codex-rs/core/src/session/environment.rs:291 — Session::update_environment_configuration has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5, match/switch 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Session::refresh_managed_network_proxy_for_current_permission_profile (cognitive 20) codex-rs/core/src/session/mod.rs:1374 — Session::refresh_managed_network_proxy_for_current_permission_profile has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 3, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Session::replace_compacted_history (cognitive 19) codex-rs/core/src/session/mod.rs:4399 — Session::replace_compacted_history has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, match/switch 2, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Session::apply_turn_settings (cognitive 19) codex-rs/core/src/session/step_activation.rs:231 — Session::apply_turn_settings has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, boolean chains 7, match/switch 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Session::maybe_start_turn_for_pending_work_with_sub_id (cognitive 18) codex-rs/core/src/tasks/mod.rs:470 — Session::maybe_start_turn_for_pending_work_with_sub_id has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (17 pts), match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · codex_rollout · ×15
  • codex_rollout::metadata::backfill_sessions_with_lease (cognitive 60) codex-rs/rollout/src/metadata.rs:199 — codex_rollout::metadata::backfill_sessions_with_lease has cognitive complexity 60 (threshold 15). Drivers by points: if/else 22 (44 pts), match/switch 5 (8 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rollout::compression::worker::compress_rollouts_in_root (cognitive 42) codex-rs/rollout/src/compression.rs:591 — codex_rollout::compression::worker::compress_rollouts_in_root has cognitive complexity 42 (threshold 15). Drivers by points: if/else 9 (25 pts), match/switch 4 (11 pts), loops 3 (6 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rollout::list::read_head_summary (cognitive 42) codex-rs/rollout/src/list.rs:977 — codex_rollout::list::read_head_summary has cognitive complexity 42 (threshold 15). Drivers by points: if/else 9 (27 pts), match/switch 3 (8 pts), boolean chains 6, loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rollout::list::walk_rollout_files (cognitive 29) codex-rs/rollout/src/list.rs:911 — codex_rollout::list::walk_rollout_files has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (19 pts), loops 4 (10 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rollout::compression::worker::cleanup_stale_temps_in_root (cognitive 24) codex-rs/rollout/src/compression.rs:1065 — codex_rollout::compression::worker::cleanup_stale_temps_in_root has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 3 (9 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rollout::list_files::collect_files_by_updated_at (cognitive 24) codex-rs/rollout/src/list_files.rs:136 — codex_rollout::list_files::collect_files_by_updated_at has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 4 (10 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rollout::search::scan_rollout_matches (cognitive 24) codex-rs/rollout/src/search.rs:120 — codex_rollout::search::scan_rollout_matches has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rollout::list::find_thread_path_by_id_str_in_subdir (cognitive 23) codex-rs/rollout/src/list.rs:1260 — codex_rollout::list::find_thread_path_by_id_str_in_subdir has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 5 (9 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rollout::list::visit_rollout_filenames (cognitive 23) codex-rs/rollout/src/list.rs:1456 — codex_rollout::list::visit_rollout_filenames has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rollout::metadata::collect_rollout_paths (cognitive 23) codex-rs/rollout/src/metadata.rs:441 — codex_rollout::metadata::collect_rollout_paths has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 3 (8 pts), loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rollout::list::read_head_for_summary (cognitive 22) codex-rs/rollout/src/list.rs:1105 — codex_rollout::list::read_head_for_summary has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rollout::search::scan_compressed_rollout_matches (cognitive 21) codex-rs/rollout/src/search.rs:222 — codex_rollout::search::scan_compressed_rollout_matches has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 4 (5 pts), match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rollout::compression::access_metadata::copy (cognitive 20) codex-rs/rollout/src/compression/access_metadata.rs:31 — codex_rollout::compression::access_metadata::copy has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rollout::state_db::list_threads_db (cognitive 19) codex-rs/rollout/src/state_db.rs:352 — codex_rollout::state_db::list_threads_db has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), match/switch 5 (7 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rollout::recorder::fill_missing_thread_item_metadata (cognitive 16) codex-rs/rollout/src/recorder.rs:1418 — codex_rollout::recorder::fill_missing_thread_item_metadata has cognitive complexity 16 (threshold 15). Drivers by points: if/else 16. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×15
  • Duplicated block (16 lines × 2) codex-rs/app-server-protocol/src/protocol/event_mapping.rs:285 — codex-rs/app-server-protocol/src/protocol/event_mapping.rs:285-300 | codex-rs/app-server-protocol/src/protocol/event_mapping.rs:338-353 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) codex-rs/app-server-protocol/src/protocol/event_mapping.rs:302 — codex-rs/app-server-protocol/src/protocol/event_mapping.rs:302-317 | codex-rs/app-server-protocol/src/protocol/event_mapping.rs:355-370 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) codex-rs/cli/src/main.rs:1547 — codex-rs/cli/src/main.rs:1547-1562 | codex-rs/cli/src/main.rs:1647-1662 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:885 — codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:885-900 | codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:924-939 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) codex-rs/core-plugins/src/startup_sync.rs:949 — codex-rs/core-plugins/src/startup_sync.rs:949-964 | codex-rs/core-plugins/src/startup_sync.rs:996-1011 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) codex-rs/exec/src/lib.rs:838 — codex-rs/exec/src/lib.rs:838-853 | codex-rs/tui/src/lib.rs:2406-2421 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (16 lines × 2) codex-rs/ext/skills/src/dynamic_skill_selector/routing_card_lexical.rs:37 — codex-rs/ext/skills/src/dynamic_skill_selector/routing_card_lexical.rs:37-52 | codex-rs/ext/skills/src/dynamic_skill_selector/weighted_lexical.rs:36-51 — before extracting anything, compare `codex-rs/ext/skills/src/dynamic_skill_selector/routing_card_lexical.rs` and `codex-rs/ext/skills/src/dynamic_skill_selector/weighted_lexical.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) codex-rs/otel/src/metrics/client.rs:136 — codex-rs/otel/src/metrics/client.rs:136-151 | codex-rs/otel/src/metrics/client.rs:199-214 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) codex-rs/tui/src/bottom_pane/approval_overlay.rs:717 — codex-rs/tui/src/bottom_pane/approval_overlay.rs:717-732 | codex-rs/tui/src/bottom_pane/approval_overlay.rs:761-776 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) codex-rs/tui/src/history_cell/approvals.rs:287 — codex-rs/tui/src/history_cell/approvals.rs:287-302 | codex-rs/tui/src/history_cell/approvals.rs:319-334 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) codex-rs/hooks/src/events/compact.rs:95 — codex-rs/hooks/src/events/compact.rs:95-110 | codex-rs/hooks/src/events/compact.rs:176-191 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) codex-rs/core/src/codex_thread.rs:435 — codex-rs/core/src/codex_thread.rs:435-450 | codex-rs/core/src/codex_thread.rs:503-518 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) sdk/python/src/openai_codex/api.py:227 — sdk/python/src/openai_codex/api.py:227-242 | sdk/python/src/openai_codex/api.py:488-503 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `sdk/python/src/openai_codex/api.py:487` calls `_ensure_initialized` and `sdk/python/src/openai_codex/api.py:225` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16 lines × 2) codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:104 — codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:104-119 | codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs:320-335 — before extracting anything, compare `codex-rs/rmcp-client/src/bin/rmcp_test_server.rs` and `codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) codex-rs/app-server-test-client/src/lib.rs:874 — codex-rs/app-server-test-client/src/lib.rs:874-889 | codex-rs/app-server-test-client/src/lib.rs:900-915 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D2 · Cognitive Complexity · codex_hooks · ×14
  • codex_hooks::engine::discovery::append_matcher_groups (cognitive 74) codex-rs/hooks/src/engine/discovery.rs:623 — codex_hooks::engine::discovery::append_matcher_groups has cognitive complexity 74 (threshold 15). Drivers by points: if/else 16 (46 pts), match/switch 5 (15 pts), boolean chains 10, loops 2 (3 pts) (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_hooks::events::user_prompt_submit::parse_completed (cognitive 46) codex-rs/hooks/src/events/user_prompt_submit.rs:138 — codex_hooks::events::user_prompt_submit::parse_completed has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (41 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 28). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_hooks::events::post_tool_use::parse_completed (cognitive 41) codex-rs/hooks/src/events/post_tool_use.rs:173 — codex_hooks::events::post_tool_use::parse_completed has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (35 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 23). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_hooks::events::stop::parse_completed (cognitive 41) codex-rs/hooks/src/events/stop.rs:237 — codex_hooks::events::stop::parse_completed has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (30 pts), match/switch 6 (9 pts), boolean chains 2 (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_hooks::events::permission_request::parse_completed (cognitive 39) codex-rs/hooks/src/events/permission_request.rs:192 — codex_hooks::events::permission_request::parse_completed has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (30 pts), match/switch 3 (9 pts) (nesting depth added 26). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_hooks::events::pre_tool_use::parse_completed (cognitive 33) codex-rs/hooks/src/events/pre_tool_use.rs:199 — codex_hooks::events::pre_tool_use::parse_completed has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (28 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_hooks::events::session_start::parse_completed (cognitive 31) codex-rs/hooks/src/events/session_start.rs:224 — codex_hooks::events::session_start::parse_completed has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (23 pts), match/switch 4 (7 pts), boolean chains 1 (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_hooks::engine::plugin_fingerprint::plugin_content_hash (cognitive 24) codex-rs/hooks/src/engine/plugin_fingerprint.rs:15 — codex_hooks::engine::plugin_fingerprint::plugin_content_hash has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_hooks::events::compact::parse_completed (cognitive 22) codex-rs/hooks/src/events/compact.rs:255 — codex_hooks::events::compact::parse_completed has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (19 pts), match/switch 2 (3 pts) (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_hooks::config_rules::hook_states_from_stack (cognitive 21) codex-rs/hooks/src/config_rules.rs:15 — codex_hooks::config_rules::hook_states_from_stack has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_hooks::engine::command_runner::run_command (cognitive 17) REDACTED:216 — codex_hooks::engine::command_runner::run_command has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 6 (9 pts), if/else 5 (7 pts), boolean chains 1 (nesting depth added 5). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_hooks::events::interrupt::parse_completed (cognitive 17) codex-rs/hooks/src/events/interrupt.rs:117 — codex_hooks::events::interrupt::parse_completed has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 2 (3 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_hooks::engine::discovery::discover_handlers (cognitive 16) codex-rs/hooks/src/engine/discovery.rs:118 — codex_hooks::engine::discovery::discover_handlers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 2 (5 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_hooks::engine::output_parser::parse_pre_tool_use (cognitive 16) codex-rs/hooks/src/engine/output_parser.rs:121 — codex_hooks::engine::output_parser::parse_pre_tool_use has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), match/switch 2 (6 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · codex_network_proxy · ×14
  • codex_network_proxy::state::validate_policy_against_constraints (cognitive 68) codex-rs/network-proxy/src/state.rs:121 — codex_network_proxy::state::validate_policy_against_constraints has cognitive complexity 68 (threshold 15). Drivers by points: if/else 32 (53 pts), match/switch 4 (6 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_network_proxy::credential_broker::matching::virtualize_text (cognitive 58) codex-rs/network-proxy/src/credential_broker/matching.rs:158 — codex_network_proxy::credential_broker::matching::virtualize_text has cognitive complexity 58 (threshold 15). Drivers by points: if/else 11 (29 pts), boolean chains 17, loops 7 (12 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_network_proxy::credential_broker::registry::select_credentials (cognitive 40) codex-rs/network-proxy/src/credential_broker/registry.rs:191 — codex_network_proxy::credential_broker::registry::select_credentials has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 7, loops 4 (7 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_network_proxy::credential_broker::matching::known_credential_matches (cognitive 34) codex-rs/network-proxy/src/credential_broker/matching.rs:23 — codex_network_proxy::credential_broker::matching::known_credential_matches has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 7 (10 pts), boolean chains 9, match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_network_proxy::http_proxy::http_plain_proxy (cognitive 34) codex-rs/network-proxy/src/http_proxy.rs:563 — codex_network_proxy::http_proxy::http_plain_proxy has cognitive complexity 34 (threshold 15). Drivers by points: match/switch 14 (19 pts), if/else 11 (14 pts), loops 1 (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_network_proxy::brokered_tunnel::peek_protocol (cognitive 33) codex-rs/network-proxy/src/brokered_tunnel.rs:43 — codex_network_proxy::brokered_tunnel::peek_protocol has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 7, loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_network_proxy::socks5::handle_socks5_tcp (cognitive 23) codex-rs/network-proxy/src/socks5.rs:200 — codex_network_proxy::socks5::handle_socks5_tcp has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 8 (10 pts), if/else 7 (8 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_network_proxy::credential_broker::providers::github::translate_request_header (cognitive 20) codex-rs/network-proxy/src/credential_broker/providers/github.rs:68 — codex_network_proxy::credential_broker::providers::github::translate_request_header has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_network_proxy::mitm_hook::validate_mitm_hook_config (cognitive 19) codex-rs/network-proxy/src/mitm_hook.rs:195 — codex_network_proxy::mitm_hook::validate_mitm_hook_config has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_network_proxy::network_policy::evaluate_host_policy (cognitive 19) codex-rs/network-proxy/src/network_policy.rs:364 — codex_network_proxy::network_policy::evaluate_host_policy has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, match/switch 2 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_network_proxy::aws_sigv4::mask_local_aws_env (cognitive 16) codex-rs/network-proxy/src/aws_sigv4.rs:280 — codex_network_proxy::aws_sigv4::mask_local_aws_env has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_network_proxy::credential_broker::configured::prepare_credential_pattern (cognitive 16) codex-rs/network-proxy/src/credential_broker/configured.rs:492 — codex_network_proxy::credential_broker::configured::prepare_credential_pattern has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_network_proxy::http_proxy::http_connect_accept (cognitive 16) codex-rs/network-proxy/src/http_proxy.rs:188 — codex_network_proxy::http_proxy::http_connect_accept has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, match/switch 5 (6 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_network_proxy::proxy::apply_proxy_env_overrides (cognitive 16) codex-rs/network-proxy/src/proxy.rs:771 — codex_network_proxy::proxy::apply_proxy_env_overrides has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), loops 1 (2 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · codex_external_agent_migration · ×14
  • codex_external_agent_migration::hooks_cla::append_convertible_hook_groups_cla (cognitive 58) codex-rs/external-agent-migration/src/hooks_cla.rs:100 — codex_external_agent_migration::hooks_cla::append_convertible_hook_groups_cla has cognitive complexity 58 (threshold 15). Drivers by points: if/else 16 (49 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_external_agent_migration::detect::sessions::cur::decode_cur_project_path (cognitive 47) codex-rs/external-agent-migration/src/detect/sessions/cur.rs:100 — codex_external_agent_migration::detect::sessions::cur::decode_cur_project_path has cognitive complexity 47 (threshold 15). Drivers by points: if/else 16 (36 pts), loops 6 (9 pts), boolean chains 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_external_agent_migration::detect::sessions::connectors_cla::detect_connector_names_by_key (cognitive 36) codex-rs/external-agent-migration/src/detect/sessions/connectors_cla.rs:103 — codex_external_agent_migration::detect::sessions::connectors_cla::detect_connector_names_by_key has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (24 pts), loops 5 (11 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_external_agent_migration::hooks_cur::hook_migration_cur (cognitive 34) codex-rs/external-agent-migration/src/hooks_cur.rs:42 — codex_external_agent_migration::hooks_cur::hook_migration_cur has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (30 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_external_agent_migration::source_cla::marketplace_import_sources (cognitive 32) codex-rs/external-agent-migration/src/source_cla.rs:44 — codex_external_agent_migration::source_cla::marketplace_import_sources has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (26 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_external_agent_migration::detect::sessions::common::detect_recent_sessions (cognitive 31) codex-rs/external-agent-migration/src/detect/sessions/common.rs:22 — codex_external_agent_migration::detect::sessions::common::detect_recent_sessions has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 4, match/switch 2 (4 pts), loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_external_agent_migration::mcp::mcp_server_toml_table (cognitive 23) codex-rs/external-agent-migration/src/mcp.rs:186 — codex_external_agent_migration::mcp::mcp_server_toml_table has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (23 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_external_agent_migration::sessions::records_cla::summarize_session (cognitive 23) codex-rs/external-agent-migration/src/sessions/records_cla.rs:23 — codex_external_agent_migration::sessions::records_cla::summarize_session has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_external_agent_migration::sessions::append::append_existing_session (cognitive 19) codex-rs/external-agent-migration/src/sessions/append.rs:30 — codex_external_agent_migration::sessions::append::append_existing_session has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, boolean chains 4, match/switch 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_external_agent_migration::sessions::records_cur::summarize_session (cognitive 19) codex-rs/external-agent-migration/src/sessions/records_cur.rs:23 — codex_external_agent_migration::sessions::records_cur::summarize_session has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_external_agent_migration::detect::sessions::connectors_cur::cached_connector_names_by_server_id (cognitive 18) codex-rs/external-agent-migration/src/detect/sessions/connectors_cur.rs:197 — codex_external_agent_migration::detect::sessions::connectors_cur::cached_connector_names_by_server_id has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 2 (8 pts) (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • codex_external_agent_migration::detect::sessions::cur::cur_transcript_files (cognitive 17) codex-rs/external-agent-migration/src/detect/sessions/cur.rs:59 — codex_external_agent_migration::detect::sessions::cur::cur_transcript_files has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_external_agent_migration::source_cur::cached_marketplace_plugins (cognitive 17) codex-rs/external-agent-migration/src/source_cur.rs:75 — codex_external_agent_migration::source_cur::cached_marketplace_plugins has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_external_agent_migration::detect::sessions::cla::detect_recent_cla_sessions_with_limits (cognitive 16) codex-rs/external-agent-migration/src/detect/sessions/cla.rs:21 — codex_external_agent_migration::detect::sessions::cla::detect_recent_cla_sessions_with_limits has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_config · ×14
  • codex_config::loader::sanitize_project_config (cognitive 45) codex-rs/config/src/loader/mod.rs:1325 — codex_config::loader::sanitize_project_config has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (32 pts), boolean chains 8, loops 3 (5 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_config::loader::load_config_layers_state (cognitive 43) codex-rs/config/src/loader/mod.rs:146 — codex_config::loader::load_config_layers_state has cognitive complexity 43 (threshold 15). Drivers by points: if/else 21 (32 pts), boolean chains 4, match/switch 2 (4 pts), loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_config::requirements_layers::stack::populate_merged_regular_fields_with_sources (cognitive 42) codex-rs/config/src/requirements_layers/stack.rs:201 — codex_config::requirements_layers::stack::populate_merged_regular_fields_with_sources has cognitive complexity 42 (threshold 15). Drivers by points: if/else 42. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_config::schema::features_schema (cognitive 36) codex-rs/config/src/schema.rs:42 — codex_config::schema::features_schema has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (34 pts), loops 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_config::merge::merge_toml_values_at_path (cognitive 32) codex-rs/config/src/merge.rs:81 — codex_config::merge::merge_toml_values_at_path has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 7, loops 2 (5 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_config::loader::discover_project_layers (cognitive 31) codex-rs/config/src/loader/mod.rs:1838 — codex_config::loader::discover_project_layers has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (22 pts), match/switch 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_config::overrides::apply_toml_override (cognitive 25) codex-rs/config/src/overrides.rs:18 — codex_config::overrides::apply_toml_override has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 3 (10 pts), boolean chains 2, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_config::loader::validate_project_mitm_profiles (cognitive 23) codex-rs/config/src/loader/mod.rs:1218 — codex_config::loader::validate_project_mitm_profiles has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4, loops 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_config::diagnostics::first_layer_config_error_for_entries (cognitive 19) codex-rs/config/src/diagnostics.rs:188 — codex_config::diagnostics::first_layer_config_error_for_entries has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_config::fingerprint::record_origins (cognitive 18) codex-rs/config/src/fingerprint.rs:9 — codex_config::fingerprint::record_origins has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_config::tui_keymap::normalize_keybinding_stroke (cognitive 17) codex-rs/config/src/tui_keymap.rs:611 — codex_config::tui_keymap::normalize_keybinding_stroke has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • codex_config::key_aliases::normalize_table_key_aliases (cognitive 16) codex-rs/config/src/key_aliases.rs:27 — codex_config::key_aliases::normalize_table_key_aliases has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_config::state::verify_layer_ordering (cognitive 16) codex-rs/config/src/state.rs:718 — codex_config::state::verify_layer_ordering has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_config::strict_config::ignored_config_warning (cognitive 16) codex-rs/config/src/strict_config.rs:238 — codex_config::strict_config::ignored_config_warning has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), loops 4 (5 pts), match/switch 2 (5 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 · Dependency Vulnerabilities · Medium advisory (unsound) · ×14
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D1 · Cyclomatic Complexity · codex_cli · ×13
  • codex_cli::cli_main (cyclomatic 100) codex-rs/cli/src/main.rs:1053 — codex_cli::cli_main has cyclomatic complexity 100 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_cli::doctor::mcp_check_from_servers (cyclomatic 38) codex-rs/cli/src/doctor.rs:1517 — codex_cli::doctor::mcp_check_from_servers has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_cli::doctor::sandbox::sandbox_check (cyclomatic 38) codex-rs/cli/src/doctor/sandbox.rs:47 — codex_cli::doctor::sandbox::sandbox_check has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_cli::debug_sandbox::run_command_under_sandbox (cyclomatic 26) codex-rs/cli/src/debug_sandbox.rs:203 — codex_cli::debug_sandbox::run_command_under_sandbox has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_cli::doctor::stored_auth_issues (cyclomatic 26) codex-rs/cli/src/doctor.rs:1400 — codex_cli::doctor::stored_auth_issues has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_cli::mcp_cmd::run_get (cyclomatic 20) codex-rs/cli/src/mcp_cmd.rs:958 — codex_cli::mcp_cmd::run_get has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_cli::plugin_cmd::render_plugin_list (cyclomatic 20) codex-rs/cli/src/plugin_cmd.rs:336 — codex_cli::plugin_cmd::render_plugin_list has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_cli::doctor::updates::append_desktop_update (cyclomatic 19) codex-rs/cli/src/doctor/updates.rs:97 — codex_cli::doctor::updates::append_desktop_update has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_cli::debug_sandbox::pid_tracker::track_descendants (cyclomatic 18) codex-rs/cli/src/debug_sandbox/pid_tracker.rs:185 — codex_cli::debug_sandbox::pid_tracker::track_descendants has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_cli::doctor::thread_inventory::parity_check_from_scan_and_rows (cyclomatic 17) codex-rs/cli/src/doctor/thread_inventory.rs:220 — codex_cli::doctor::thread_inventory::parity_check_from_scan_and_rows has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_cli::mcp_cmd::run_list (cyclomatic 17) codex-rs/cli/src/mcp_cmd.rs:690 — codex_cli::mcp_cmd::run_list has cyclomatic complexity 17 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • codex_cli::doctor::filesystem_paths::source (cyclomatic 16) codex-rs/cli/src/doctor/filesystem_paths.rs:207 — codex_cli::doctor::filesystem_paths::source has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_cli::doctor::thread_inventory::scan_rollout_root (cyclomatic 16) codex-rs/cli/src/doctor/thread_inventory.rs:455 — codex_cli::doctor::thread_inventory::scan_rollout_root has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · codex_exec_server · ×13
  • codex_exec_server::relay::run_multiplexed_environment (cognitive 116) codex-rs/exec-server/src/relay.rs:513 — codex_exec_server::relay::run_multiplexed_environment has cognitive complexity 116 (threshold 15). Drivers by points: if/else 20 (66 pts), match/switch 15 (44 pts), loops 3 (6 pts) (nesting depth added 78). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_exec_server::noise_relay::harness::noise_harness_connection_from_websocket_with_readiness (cognitive 112) codex-rs/exec-server/src/noise_relay/harness.rs:88 — codex_exec_server::noise_relay::harness::noise_harness_connection_from_websocket_with_readiness has cognitive complexity 112 (threshold 15). Drivers by points: if/else 21 (59 pts), match/switch 15 (43 pts), boolean chains 8, loops 2 (nesting depth added 66). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_exec_server::relay::harness_connection_from_websocket (cognitive 61) codex-rs/exec-server/src/relay.rs:284 — codex_exec_server::relay::harness_connection_from_websocket has cognitive complexity 61 (threshold 15). Drivers by points: match/switch 10 (40 pts), if/else 6 (20 pts), loops 1 (nesting depth added 44). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_exec_server::discoverV2::capability_discoveries::parse_root (cognitive 41) codex-rs/exec-server/src/discoverV2/capability_discoveries.rs:177 — codex_exec_server::discoverV2::capability_discoveries::parse_root has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (31 pts), loops 3 (4 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_exec_server::capability_discovery::discover_root (cognitive 36) codex-rs/exec-server/src/capability_discovery.rs:64 — codex_exec_server::capability_discovery::discover_root has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (22 pts), match/switch 6 (9 pts), loops 3, boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_exec_server::shell_snapshot_credentials::prepare (cognitive 35) codex-rs/exec-server/src/shell_snapshot_credentials.rs:54 — codex_exec_server::shell_snapshot_credentials::prepare has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 15, if/else 10 (15 pts), loops 5 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_exec_server::server::processor::run_connection (cognitive 28) codex-rs/exec-server/src/server/processor.rs:108 — codex_exec_server::server::processor::run_connection has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 4 (9 pts), loops 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_exec_server::process_sandbox::prepare_exec_request_with_telemetry (cognitive 27) codex-rs/exec-server/src/process_sandbox.rs:114 — codex_exec_server::process_sandbox::prepare_exec_request_with_telemetry has cognitive complexity 27 (threshold 15). Drivers by points: if/else 20 (24 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_exec_server::relay_writer::run (cognitive 27) codex-rs/exec-server/src/relay_writer.rs:15 — codex_exec_server::relay_writer::run has cognitive complexity 27 (threshold 15). Drivers by points: if/else 4 (15 pts), match/switch 3 (9 pts), loops 2 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_exec_server::local_process::watch_exit (cognitive 26) codex-rs/exec-server/src/local_process.rs:1052 — codex_exec_server::local_process::watch_exit has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 2 (5 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_exec_server::client::handle_server_notification (cognitive 24) codex-rs/exec-server/src/client.rs:1906 — codex_exec_server::client::handle_server_notification has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (23 pts), match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_exec_server::shell_snapshot::capture_snapshot (cognitive 19) codex-rs/exec-server/src/shell_snapshot.rs:384 — codex_exec_server::shell_snapshot::capture_snapshot has cognitive complexity 19 (threshold 15). Drivers by points: if/else 17 (19 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_exec_server::discoverV2::capability_locations::discover_cached_plugins (cognitive 17) codex-rs/exec-server/src/discoverV2/capability_locations.rs:94 — codex_exec_server::discoverV2::capability_locations::discover_cached_plugins has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 2 (3 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TranscriptView · ×13
  • TranscriptView::move_copy_target (cognitive 61) codex-rs/tui/src/transcript_view/copy_mode.rs:91 — TranscriptView::move_copy_target has cognitive complexity 61 (threshold 15). Drivers by points: if/else 21 (40 pts), boolean chains 7, loops 3 (7 pts), match/switch 2 (7 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TranscriptView::handle_disclosure_key (cognitive 43) codex-rs/tui/src/transcript_view/disclosure.rs:165 — TranscriptView::handle_disclosure_key has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (30 pts), loops 3 (7 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TranscriptView::handle_mouse_with_mode (cognitive 42) codex-rs/tui/src/transcript_view/input.rs:286 — TranscriptView::handle_mouse_with_mode has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (33 pts), boolean chains 8, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TranscriptView::handle_select_mode_key (cognitive 41) codex-rs/tui/src/transcript_view/select_mode.rs:163 — TranscriptView::handle_select_mode_key has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 13, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TranscriptView::footer_with_navigation (cognitive 39) codex-rs/tui/src/transcript_view/footer.rs:17 — TranscriptView::footer_with_navigation has cognitive complexity 39 (threshold 15). Drivers by points: if/else 25 (33 pts), boolean chains 6 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • TranscriptView::render (cognitive 37) codex-rs/tui/src/transcript_view.rs:185 — TranscriptView::render has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 8, match/switch 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TranscriptView::handle_key (cognitive 26) codex-rs/tui/src/transcript_view/input.rs:193 — TranscriptView::handle_key has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 5 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TranscriptView::next_search_match (cognitive 23) codex-rs/tui/src/transcript_view/search.rs:671 — TranscriptView::next_search_match has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TranscriptView::render_selection (cognitive 23) codex-rs/tui/src/transcript_view/selection.rs:656 — TranscriptView::render_selection has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TranscriptView::handle_search_key (cognitive 19) codex-rs/tui/src/transcript_view/search.rs:184 — TranscriptView::handle_search_key has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, match/switch 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TranscriptView::owns_interaction_key (cognitive 17) codex-rs/tui/src/transcript_view/input.rs:155 — TranscriptView::owns_interaction_key has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 12, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • TranscriptView::move_select_word (cognitive 17) codex-rs/tui/src/transcript_view/select_mode/motion.rs:173 — TranscriptView::move_select_word has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TranscriptView::advance_search (cognitive 16) codex-rs/tui/src/transcript_view/search.rs:526 — TranscriptView::advance_search has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D35 · Change Coupling · Change-coupling hub · ×13
  • Change-coupling hub: windows_sandbox.rs → config_persistence.rs, event_dispatch.rs, permission_popups.rs, windows_sandbox_prompts.rs codex-rs/tui/src/windows_sandbox.rs — `codex-rs/tui/src/windows_sandbox.rs` changes together with 4 other files — `codex-rs/tui/src/app/config_persistence.rs`, `codex-rs/tui/src/app/event_dispatch.rs`, `codex-rs/tui/src/chatwidget/permission_popups.rs`, `codex-rs/tui/src/chatwidget/windows_sandbox_prompts.rs` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
  • Change-coupling hub: connection_manager.rs → installed.rs, codex_apps.rs, tool_catalog_cache.rs codex-rs/codex-mcp/src/connection_manager.rs — `codex-rs/codex-mcp/src/connection_manager.rs` changes together with 3 other files — `codex-rs/app-server/src/request_processors/apps_processor/installed.rs`, `codex-rs/codex-mcp/src/codex_apps.rs`, `codex-rs/codex-mcp/src/tool_catalog_cache.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: turn.rs → wait_handler.rs, world_state.rs, protocol_event.rs codex-rs/core/src/session/turn.rs — `codex-rs/core/src/session/turn.rs` changes together with 3 other files — `codex-rs/core/src/tools/code_mode/wait_handler.rs`, `codex-rs/ext/extension-api/src/contributors/world_state.rs`, `codex-rs/rollout-trace/src/protocol_event.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: tests.rs → pending_input_preview.rs, skills.rs, collaboration_modes.rs codex-rs/tui/src/chatwidget/tests.rs — `codex-rs/tui/src/chatwidget/tests.rs` changes together with 3 other files — `codex-rs/tui/src/bottom_pane/pending_input_preview.rs`, `codex-rs/tui/src/chatwidget/skills.rs`, `codex-rs/tui/src/collaboration_modes.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: remote_file_system.rs → local_file_system.rs, sandboxed_file_system.rs, file_system_handler.rs codex-rs/exec-server/src/remote_file_system.rs — `codex-rs/exec-server/src/remote_file_system.rs` changes together with 3 other files — `codex-rs/exec-server/src/local_file_system.rs`, `codex-rs/exec-server/src/sandboxed_file_system.rs`, `codex-rs/exec-server/src/server/file_system_handler.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: provider.rs → thread_config.rs, auth_env_telemetry.rs, catalog.rs codex-rs/model-provider/src/provider.rs — `codex-rs/model-provider/src/provider.rs` changes together with 3 other files — `codex-rs/config/src/thread_config.rs`, `codex-rs/login/src/auth_env_telemetry.rs`, `codex-rs/model-provider/src/amazon_bedrock/catalog.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: mod.rs → agents_md.rs, environment_context.rs, provider.rs codex-rs/core/src/session/mod.rs — `codex-rs/core/src/session/mod.rs` changes together with 3 other files — `codex-rs/core/src/agents_md.rs`, `codex-rs/core/src/context/environment_context.rs`, `codex-rs/ext/skills/src/provider.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: chatwidget.rs → pending_interactive_replay.rs, pending_input_preview.rs, slash_commands.rs codex-rs/tui/src/chatwidget.rs — `codex-rs/tui/src/chatwidget.rs` changes together with 3 other files — `codex-rs/tui/src/app/pending_interactive_replay.rs`, `codex-rs/tui/src/bottom_pane/pending_input_preview.rs`, `codex-rs/tui/src/bottom_pane/slash_commands.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: vim_commands.rs → tui_keymap.rs, keymap.rs, bindings.rs, actions.rs codex-rs/tui/src/bottom_pane/textarea/vim_commands.rs — `codex-rs/tui/src/bottom_pane/textarea/vim_commands.rs` changes together with 4 other files — `codex-rs/config/src/tui_keymap.rs`, `codex-rs/tui/src/keymap.rs`, `codex-rs/tui/src/keymap/bindings.rs`, `codex-rs/tui/src/keymap_setup/actions.rs` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
  • Change-coupling hub: tests.rs → environment.rs, local_process.rs, processor.rs codex-rs/exec-server/src/server/handler/tests.rs — `codex-rs/exec-server/src/server/handler/tests.rs` changes together with 3 other files — `codex-rs/exec-server/src/environment.rs`, `codex-rs/exec-server/src/local_process.rs`, `codex-rs/exec-server/src/server/processor.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: tests.rs → environment_context.rs, prompt_debug.rs, review.rs, thread_metadata_sync.rs codex-rs/core/src/session/tests.rs — `codex-rs/core/src/session/tests.rs` changes together with 4 other files — `codex-rs/core/src/context/environment_context.rs`, `codex-rs/core/src/prompt_debug.rs`, `codex-rs/core/src/session/review.rs`, `codex-rs/thread-store/src/thread_metadata_sync.rs` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
  • Change-coupling hub: elevated_impl.rs → win.rs, mod.rs, process.rs, spawn_prep.rs codex-rs/windows-sandbox-rs/src/elevated_impl.rs — `codex-rs/windows-sandbox-rs/src/elevated_impl.rs` changes together with 4 other files — `codex-rs/windows-sandbox-rs/src/bin/command_runner/win.rs`, `codex-rs/windows-sandbox-rs/src/conpty/mod.rs`, `codex-rs/windows-sandbox-rs/src/process.rs`, `codex-rs/windows-sandbox-rs/src/spawn_prep.rs` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
  • Change-coupling hub: mod.rs → exec.rs, manager.rs, spawn_prep.rs codex-rs/windows-sandbox-rs/src/unified_exec/mod.rs — `codex-rs/windows-sandbox-rs/src/unified_exec/mod.rs` changes together with 3 other files — `codex-rs/core/src/exec.rs`, `codex-rs/sandboxing/src/manager.rs`, `codex-rs/windows-sandbox-rs/src/spawn_prep.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
D1 · Cyclomatic Complexity · Session · ×12
  • Session::new (cyclomatic 97) codex-rs/core/src/session/session.rs:812 — Session::new has cyclomatic complexity 97 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Session::build_world_state_for_step (cyclomatic 39) codex-rs/core/src/session/world_state.rs:59 — Session::build_world_state_for_step has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Session::build_initial_context_with_world_state (cyclomatic 36) codex-rs/core/src/session/mod.rs:4670 — Session::build_initial_context_with_world_state has cyclomatic complexity 36 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • Session::spawn_internal (cyclomatic 33) codex-rs/core/src/session/mod.rs:603 — Session::spawn_internal has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Session::refresh_config (cyclomatic 24) codex-rs/core/src/session/config_refresh.rs:52 — Session::refresh_config has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Session::on_task_finished (cyclomatic 21) codex-rs/core/src/tasks/mod.rs:655 — Session::on_task_finished has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Session::update_environment_configuration (cyclomatic 20) codex-rs/core/src/session/environment.rs:291 — Session::update_environment_configuration has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Session::record_prepared_conversation_items (cyclomatic 19) codex-rs/core/src/session/mod.rs:3780 — Session::record_prepared_conversation_items has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Session::apply_turn_settings (cyclomatic 19) codex-rs/core/src/session/step_activation.rs:231 — Session::apply_turn_settings has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Session::project_selected_environment_mcp_servers (cyclomatic 18) codex-rs/core/src/session/mcp_runtime.rs:137 — Session::project_selected_environment_mcp_servers has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Session::record_initial_history (cyclomatic 18) codex-rs/core/src/session/mod.rs:1663 — Session::record_initial_history has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Session::replace_compacted_history (cyclomatic 16) codex-rs/core/src/session/mod.rs:4399 — Session::replace_compacted_history has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · AnalyticsView · ×12
  • AnalyticsView::plan_lines (cognitive 93) codex-rs/tui/src/analytics/plan_panel.rs:67 — AnalyticsView::plan_lines has cognitive complexity 93 (threshold 15). Drivers by points: if/else 29 (75 pts), loops 4 (12 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 56). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • AnalyticsView::history_lines (cognitive 67) codex-rs/tui/src/analytics/chart.rs:38 — AnalyticsView::history_lines has cognitive complexity 67 (threshold 15). Drivers by points: if/else 39 (44 pts), boolean chains 12, match/switch 4 (6 pts), loops 3 (5 pts) (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • AnalyticsView::chat_lines (cognitive 50) codex-rs/tui/src/analytics/chat_panel.rs:20 — AnalyticsView::chat_lines has cognitive complexity 50 (threshold 15). Drivers by points: if/else 25 (38 pts), loops 3 (8 pts), boolean chains 4 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AnalyticsView::dashboard_lines (cognitive 50) codex-rs/tui/src/analytics/dashboard.rs:21 — AnalyticsView::dashboard_lines has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (39 pts), loops 3 (8 pts), match/switch 1 (3 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AnalyticsView::handle_key (cognitive 50) codex-rs/tui/src/analytics.rs:297 — AnalyticsView::handle_key has cognitive complexity 50 (threshold 15). Drivers by points: if/else 27 (29 pts), boolean chains 17, match/switch 3 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • AnalyticsView::summary_lines (cognitive 49) codex-rs/tui/src/analytics/summary_panel.rs:18 — AnalyticsView::summary_lines has cognitive complexity 49 (threshold 15). Drivers by points: if/else 25 (37 pts), loops 5 (9 pts), match/switch 1 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AnalyticsView::render_controls (cognitive 37) codex-rs/tui/src/analytics/controls.rs:105 — AnalyticsView::render_controls has cognitive complexity 37 (threshold 15). Drivers by points: if/else 21 (32 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AnalyticsView::task_lines (cognitive 31) codex-rs/tui/src/analytics/task_panel.rs:152 — AnalyticsView::task_lines has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (20 pts), loops 3 (8 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • AnalyticsView::render (cognitive 30) codex-rs/tui/src/analytics/render.rs:86 — AnalyticsView::render has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 6 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AnalyticsView::footer_lines (cognitive 26) codex-rs/tui/src/analytics/hints.rs:11 — AnalyticsView::footer_lines has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AnalyticsView::start_reports (cognitive 25) codex-rs/tui/src/analytics/sections.rs:203 — AnalyticsView::start_reports has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 4, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • AnalyticsView::panel (cognitive 16) codex-rs/tui/src/analytics/panels.rs:18 — AnalyticsView::panel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Writer · ×12
  • Writer::pop_link (cognitive 51) codex-rs/tui/src/markdown_render.rs:2211 — Writer::pop_link has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (38 pts), loops 2 (10 pts), boolean chains 3 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Writer::render_table_row (cognitive 30) codex-rs/tui/src/markdown_render.rs:1807 — Writer::render_table_row has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 3 (5 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::start_tag (cognitive 25) codex-rs/tui/src/markdown_render.rs:648 — Writer::start_tag has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 4 (8 pts), boolean chains 2 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Writer::shrink_columns (cognitive 25) codex-rs/tui/src/markdown_render.rs:1716 — Writer::shrink_columns has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::row_to_pipe_line (cognitive 25) codex-rs/tui/src/markdown_render.rs:1937 — Writer::row_to_pipe_line has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 3 (6 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::html (cognitive 21) codex-rs/tui/src/markdown_render.rs:941 — Writer::html has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::collect_table_column_metrics (cognitive 21) codex-rs/tui/src/markdown_render.rs:1625 — Writer::collect_table_column_metrics has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::render_table_lines (cognitive 20) codex-rs/tui/src/markdown_render.rs:1410 — Writer::render_table_lines has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 5 (6 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::text (cognitive 19) codex-rs/tui/src/markdown_render.rs:861 — Writer::text has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::end_codeblock (cognitive 18) codex-rs/tui/src/markdown_render.rs:1150 — Writer::end_codeblock has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 2 (7 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::prefix_spans (cognitive 18) codex-rs/tui/src/markdown_render.rs:2559 — Writer::prefix_spans has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Writer::start_item (cognitive 17) codex-rs/tui/src/markdown_render.rs:1038 — Writer::start_item has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · TextArea · ×12
  • TextArea::apply_vim_editor_action (cognitive 43) codex-rs/tui/src/bottom_pane/textarea/vim_commands.rs:334 — TextArea::apply_vim_editor_action has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (38 pts), match/switch 3 (5 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TextArea::handle_vim_normal (cognitive 30) codex-rs/tui/src/bottom_pane/textarea.rs:818 — TextArea::handle_vim_normal has cognitive complexity 30 (threshold 15). Drivers by points: if/else 27 (29 pts), match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • TextArea::handle_mouse (cognitive 23) codex-rs/tui/src/bottom_pane/textarea/mouse.rs:105 — TextArea::handle_mouse has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17 (19 pts), boolean chains 3, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • TextArea::move_cursor_up (cognitive 23) codex-rs/tui/src/bottom_pane/textarea.rs:1452 — TextArea::move_cursor_up has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TextArea::paired_text_object_range (cognitive 22) codex-rs/tui/src/bottom_pane/textarea/vim.rs:245 — TextArea::paired_text_object_range has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 1 (4 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TextArea::input_with_keymap (cognitive 22) codex-rs/tui/src/bottom_pane/textarea.rs:652 — TextArea::input_with_keymap has cognitive complexity 22 (threshold 15). Drivers by points: if/else 20 (21 pts), boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • TextArea::apply_vim_operator (cognitive 22) codex-rs/tui/src/bottom_pane/textarea.rs:1069 — TextArea::apply_vim_operator has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 7 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TextArea::move_cursor_down (cognitive 22) codex-rs/tui/src/bottom_pane/textarea.rs:1523 — TextArea::move_cursor_down has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TextArea::quoted_text_object_range (cognitive 20) codex-rs/tui/src/bottom_pane/textarea/vim.rs:282 — TextArea::quoted_text_object_range has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 1 (4 pts), boolean chains 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TextArea::handle_vim_extra_command (cognitive 20) codex-rs/tui/src/bottom_pane/textarea/vim_commands.rs:469 — TextArea::handle_vim_extra_command has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TextArea::replace_element_payload (cognitive 18) codex-rs/tui/src/bottom_pane/textarea.rs:1691 — TextArea::replace_element_payload has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TextArea::apply_vim_search (cognitive 17) codex-rs/tui/src/bottom_pane/textarea/vim_search.rs:192 — TextArea::apply_vim_search has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×12
  • Duplicated block (17 lines × 2) codex-rs/config/src/mcp_edit.rs:34 — codex-rs/config/src/mcp_edit.rs:34-50 | codex-rs/core/src/config/mod.rs:2415-2431 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (17 lines × 2) codex-rs/core/src/client.rs:428 — codex-rs/core/src/client.rs:428-444 | codex-rs/core/src/client.rs:445-461 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) codex-rs/core/src/tools/handlers/mcp_resource.rs:271 — codex-rs/core/src/tools/handlers/mcp_resource.rs:271-287 | codex-rs/core/src/tools/handlers/mcp_resource.rs:316-332 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) codex-rs/core/src/unified_exec/process_manager.rs:699 — codex-rs/core/src/unified_exec/process_manager.rs:699-715 | codex-rs/core/src/unified_exec/process_manager.rs:721-737 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) codex-rs/rmcp-client/src/executor_process_transport.rs:510 — codex-rs/rmcp-client/src/executor_process_transport.rs:510-526 | codex-rs/rmcp-client/src/stdio_server_launcher.rs:832-848 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (17 lines × 2) codex-rs/rollout/src/list.rs:526 — codex-rs/rollout/src/list.rs:526-542 | codex-rs/rollout/src/list.rs:656-672 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) codex-rs/shell-command/src/parse_command.rs:1483 — codex-rs/shell-command/src/parse_command.rs:1483-1499 | codex-rs/shell-command/src/parse_command.rs:2030-2046 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) codex-rs/skills/src/mentions.rs:208 — codex-rs/skills/src/mentions.rs:208-224 | codex-rs/tui/src/mention_codec.rs:306-322 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (17 lines × 2) scripts/mcp_conformance/review_regressions.py:1223 — scripts/mcp_conformance/review_regressions.py:1223-1239 | scripts/mcp_conformance/run_codex_compliance.py:2151-2167 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) scripts/mcp_conformance/run_codex_compliance.py:254 — scripts/mcp_conformance/run_codex_compliance.py:254-270 | scripts/mcp_conformance/run_codex_compliance.py:292-308 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `scripts/mcp_conformance/run_codex_compliance.py:271` calls `get` and `scripts/mcp_conformance/run_codex_compliance.py:309` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (17 lines × 2) sdk/python/src/openai_codex/api.py:268 — sdk/python/src/openai_codex/api.py:268-284 | sdk/python/src/openai_codex/api.py:530-546 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `sdk/python/src/openai_codex/api.py:529` calls `_ensure_initialized` and `sdk/python/src/openai_codex/api.py:266` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (17 lines × 2) codex-rs/rmcp-client/src/bin/test_stdio_server.rs:674 — codex-rs/rmcp-client/src/bin/test_stdio_server.rs:674-690 | codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs:297-313 — before extracting anything, compare `codex-rs/rmcp-client/src/bin/test_stdio_server.rs` and `codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D1 · Cyclomatic Complexity · AnalyticsView · ×11
  • AnalyticsView::handle_key (cyclomatic 59) codex-rs/tui/src/analytics.rs:297 — AnalyticsView::handle_key has cyclomatic complexity 59 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • AnalyticsView::history_lines (cyclomatic 58) codex-rs/tui/src/analytics/chart.rs:38 — AnalyticsView::history_lines has cyclomatic complexity 58 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • AnalyticsView::plan_lines (cyclomatic 32) codex-rs/tui/src/analytics/plan_panel.rs:67 — AnalyticsView::plan_lines has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AnalyticsView::summary_lines (cyclomatic 28) codex-rs/tui/src/analytics/summary_panel.rs:18 — AnalyticsView::summary_lines has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AnalyticsView::chat_lines (cyclomatic 26) codex-rs/tui/src/analytics/chat_panel.rs:20 — AnalyticsView::chat_lines has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AnalyticsView::render_controls (cyclomatic 23) codex-rs/tui/src/analytics/controls.rs:105 — AnalyticsView::render_controls has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AnalyticsView::dashboard_lines (cyclomatic 21) codex-rs/tui/src/analytics/dashboard.rs:21 — AnalyticsView::dashboard_lines has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AnalyticsView::render (cyclomatic 21) codex-rs/tui/src/analytics/render.rs:86 — AnalyticsView::render has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AnalyticsView::footer_lines (cyclomatic 20) codex-rs/tui/src/analytics/hints.rs:11 — AnalyticsView::footer_lines has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AnalyticsView::task_lines (cyclomatic 20) codex-rs/tui/src/analytics/task_panel.rs:152 — AnalyticsView::task_lines has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • AnalyticsView::start_reports (cyclomatic 19) codex-rs/tui/src/analytics/sections.rs:203 — AnalyticsView::start_reports has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ThreadRequestProcessor · ×11
  • ThreadRequestProcessor::thread_fork_inner (cognitive 131) codex-rs/app-server/src/request_processors/thread_processor.rs:5236 — ThreadRequestProcessor::thread_fork_inner has cognitive complexity 131 (threshold 15). Drivers by points: if/else 68 (84 pts), boolean chains 32, match/switch 7 (13 pts), loops 1 (2 pts) (nesting depth added 23). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ThreadRequestProcessor::thread_resume_inner (cognitive 114) codex-rs/app-server/src/request_processors/thread_processor.rs:3951 — ThreadRequestProcessor::thread_resume_inner has cognitive complexity 114 (threshold 15). Drivers by points: if/else 46 (72 pts), match/switch 14 (26 pts), boolean chains 16 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ThreadRequestProcessor::resume_running_thread (cognitive 58) codex-rs/app-server/src/request_processors/thread_processor.rs:4623 — ThreadRequestProcessor::resume_running_thread has cognitive complexity 58 (threshold 15). Drivers by points: if/else 21 (35 pts), match/switch 4 (12 pts), boolean chains 11 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ThreadRequestProcessor::thread_revert_response (cognitive 28) codex-rs/app-server/src/request_processors/thread_processor.rs:2214 — ThreadRequestProcessor::thread_revert_response has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (19 pts), match/switch 3 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ThreadRequestProcessor::list_threads_common (cognitive 25) codex-rs/app-server/src/request_processors/thread_processor.rs:5971 — ThreadRequestProcessor::list_threads_common has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 2 (3 pts), boolean chains 2, match/switch 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ThreadRequestProcessor::thread_metadata_update_response_inner (cognitive 23) codex-rs/app-server/src/request_processors/thread_processor.rs:2005 — ThreadRequestProcessor::thread_metadata_update_response_inner has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (14 pts), match/switch 3 (5 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ThreadRequestProcessor::thread_start_task (cognitive 22) codex-rs/app-server/src/request_processors/thread_processor.rs:1394 — ThreadRequestProcessor::thread_start_task has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (12 pts), match/switch 5 (6 pts), boolean chains 3, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ThreadRequestProcessor::thread_search_response_inner (cognitive 20) codex-rs/app-server/src/request_processors/thread_processor.rs:2871 — ThreadRequestProcessor::thread_search_response_inner has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (4 pts), match/switch 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ThreadRequestProcessor::try_attach_thread_listener (cognitive 19) codex-rs/app-server/src/request_processors/thread_processor.rs:3880 — ThreadRequestProcessor::try_attach_thread_listener has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ThreadRequestProcessor::continue_daemon_turn (cognitive 16) codex-rs/app-server/src/request_processors/daemon_continuation.rs:23 — ThreadRequestProcessor::continue_daemon_turn has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, match/switch 4, boolean chains 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • ThreadRequestProcessor::thread_list_response_inner (cognitive 16) codex-rs/app-server/src/request_processors/thread_processor.rs:2701 — ThreadRequestProcessor::thread_list_response_inner has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), match/switch 4 (5 pts), boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×11
  • Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/analytics/src/events.rs:1518 — codex-rs/analytics/src/events.rs:1518-1535 | codex-rs/core/src/hook_runtime.rs:1005-1052 | codex-rs/hooks/src/engine/dispatcher.rs:296-313 | codex-rs/tui/src/bottom_pane/hooks_browser_view.rs:672-689 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/app-server-daemon/src/backend/pid.rs:537 — codex-rs/app-server-daemon/src/backend/pid.rs:537-549 | codex-rs/app-server-daemon/src/backend/pid.rs:552-564 | codex-rs/app-server-daemon/src/backend/pid.rs:567-579 | codex-rs/app-server-daemon/src/backend/pid.rs:582-594 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/app-server/src/request_processors/apps_processor.rs:334 — codex-rs/app-server/src/request_processors/apps_processor.rs:334-345 | codex-rs/app-server/src/request_processors/mcp_processor.rs:119-130 | codex-rs/app-server/src/request_processors/thread_processor.rs:1044-1056 | codex-rs/app-server/src/request_processors/turn_processor.rs:376-388 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/cli/src/migrate_rollouts.rs:401 — codex-rs/cli/src/migrate_rollouts.rs:401-433 | codex-rs/rollout/src/list.rs:1460-1499 | codex-rs/rollout/src/search.rs:124-176 | codex-rs/rollout/src/search.rs:225-286 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/core-plugins/src/remote.rs:2255 — codex-rs/core-plugins/src/remote.rs:2255-2275 | codex-rs/core-plugins/src/remote.rs:2281-2297 | codex-rs/core-plugins/src/remote.rs:2306-2334 | codex-rs/core-plugins/src/remote/share.rs:390-406 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/core/src/client_common.rs:69 — codex-rs/core/src/client_common.rs:69-108 | codex-rs/core/src/image_preparation.rs:133-219 | codex-rs/ext/image-generation/src/tool.rs:568-621 | codex-rs/utils/audio/src/lib.rs:63-90 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:39 — codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:39-93 | codex-rs/ext/skills/src/dynamic_skill_selector/fielded_bm25.rs:37-90 | codex-rs/ext/skills/src/dynamic_skill_selector/routing_card_lexical.rs:34-76 | codex-rs/ext/skills/src/dynamic_skill_selector/weighted_lexical.rs:33-74 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/hooks/src/events/post_tool_use.rs:78 — codex-rs/hooks/src/events/post_tool_use.rs:78-146 | codex-rs/hooks/src/events/pre_tool_use.rs:79-151 | codex-rs/hooks/src/events/session_start.rs:115-216 | codex-rs/hooks/src/events/user_prompt_submit.rs:67-136 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/tui/src/bottom_pane/chat_composer.rs:2120 — codex-rs/tui/src/bottom_pane/chat_composer.rs:2120-2203 | codex-rs/tui/src/bottom_pane/chat_composer.rs:2206-2286 | codex-rs/tui/src/bottom_pane/chat_composer.rs:2291-2408 | codex-rs/tui/src/bottom_pane/chat_composer/slash_input.rs:241-424 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/tui/src/bottom_pane/experimental_features_view.rs:382 — codex-rs/tui/src/bottom_pane/experimental_features_view.rs:382-430 | codex-rs/tui/src/bottom_pane/memories_settings_view.rs:356-427 | codex-rs/tui/src/bottom_pane/multi_select_picker.rs:570-644 | codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:273-329 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/windows-sandbox-rs/src/acl.rs:164 — codex-rs/windows-sandbox-rs/src/acl.rs:164-227 | codex-rs/windows-sandbox-rs/src/acl.rs:361-400 | codex-rs/windows-sandbox-rs/src/acl.rs:402-445 | codex-rs/windows-sandbox-rs/src/acl.rs:460-503 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×11
  • Duplicated block (19 lines × 2) codex-rs/analytics/src/reducer.rs:3186 — codex-rs/analytics/src/reducer.rs:3186-3204 | codex-rs/analytics/src/reducer.rs:3236-3254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) codex-rs/app-server-protocol/src/protocol/thread_history.rs:921 — codex-rs/app-server-protocol/src/protocol/thread_history.rs:921-939 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:979-997 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) codex-rs/cloud-tasks/src/lib.rs:1885 — codex-rs/cloud-tasks/src/lib.rs:1885-1903 | codex-rs/cloud-tasks/src/lib.rs:1906-1924 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) codex-rs/core/src/session/turn.rs:2301 — codex-rs/core/src/session/turn.rs:2301-2319 | codex-rs/rollout-trace/src/protocol_event.rs:527-545 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (19 lines × 2) codex-rs/core/src/unified_exec/async_watcher.rs:355 — codex-rs/core/src/unified_exec/async_watcher.rs:355-373 | codex-rs/core/src/unified_exec/async_watcher.rs:415-433 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) codex-rs/hooks/src/engine/dispatcher.rs:81 — codex-rs/hooks/src/engine/dispatcher.rs:81-99 | codex-rs/hooks/src/engine/dispatcher.rs:249-267 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) codex-rs/network-proxy/src/http_proxy.rs:249 — codex-rs/network-proxy/src/http_proxy.rs:249-267 | codex-rs/network-proxy/src/http_proxy.rs:785-803 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) codex-rs/network-proxy/src/socks5.rs:324 — codex-rs/network-proxy/src/socks5.rs:324-342 | codex-rs/network-proxy/src/socks5.rs:771-789 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) codex-rs/rollout/src/list.rs:643 — codex-rs/rollout/src/list.rs:643-661 | codex-rs/rollout/src/list.rs:706-724 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:476 — codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:476-494 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:497-515 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) codex-rs/state/src/runtime/goals.rs:289 — codex-rs/state/src/runtime/goals.rs:289-308 | codex-rs/state/src/runtime/goals.rs:324-342 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×11
  • Duplicated block (18 lines × 2) codex-rs/app-server-protocol/src/protocol/v2/config.rs:116 — codex-rs/app-server-protocol/src/protocol/v2/config.rs:116-133 | codex-rs/config/src/config_layer_source.rs:34-51 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (18 lines × 2) codex-rs/app-server-transport/src/transport/remote_control/mod.rs:824 — codex-rs/app-server-transport/src/transport/remote_control/mod.rs:824-841 | codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:338-355 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (18 lines × 2) codex-rs/codex-api/src/endpoint/realtime_websocket/methods_v1.rs:22 — codex-rs/codex-api/src/endpoint/realtime_websocket/methods_v1.rs:22-39 | codex-rs/codex-api/src/endpoint/realtime_websocket/methods_v2.rs:43-60 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (18 lines × 2) codex-rs/core-plugins/src/marketplace_upgrade/git.rs:207 — codex-rs/core-plugins/src/marketplace_upgrade/git.rs:207-224 | codex-rs/core-plugins/src/startup_sync.rs:718-735 — before extracting anything, compare `codex-rs/core-plugins/src/marketplace_upgrade/git.rs` and `codex-rs/core-plugins/src/startup_sync.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (18 lines × 2) codex-rs/core/src/client_common.rs:91 — codex-rs/core/src/client_common.rs:91-108 | codex-rs/utils/audio/src/lib.rs:73-90 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (18 lines × 2) codex-rs/guardian-context/src/profile.rs:65 — codex-rs/guardian-context/src/profile.rs:65-82 | codex-rs/guardian-context/src/profile.rs:91-108 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:901 — codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:901-918 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:925-942 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) codex-rs/thread-store/src/local/thread_history.rs:486 — codex-rs/thread-store/src/local/thread_history.rs:486-503 | codex-rs/thread-store/src/local/thread_history.rs:505-524 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) scripts/mcp_conformance/server.py:848 — scripts/mcp_conformance/server.py:848-865 | scripts/mcp_conformance/server.py:995-1012 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/mcp_conformance/server.py:848` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (18 lines × 2) sdk/python/src/openai_codex/api.py:154 — sdk/python/src/openai_codex/api.py:154-171 | sdk/python/src/openai_codex/api.py:413-430 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `sdk/python/src/openai_codex/api.py:412` calls `_ensure_initialized` and `sdk/python/src/openai_codex/api.py:152` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18 lines × 2) sdk/python/src/openai_codex/api.py:643 — sdk/python/src/openai_codex/api.py:643-660 | sdk/python/src/openai_codex/api.py:750-767 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `sdk/python/src/openai_codex/api.py:749` calls `_ensure_initialized` and `sdk/python/src/openai_codex/api.py:642` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
S1 · Web-Security Posture · Weak hash algorithm · ×11
  • Weak hash algorithm codex-rs/analytics/src/accepted_lines.rs:64 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
  • Weak hash algorithm codex-rs/analytics/src/reducer.rs:1480 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
  • Weak hash algorithm codex-rs/analytics/src/reducer.rs:4146 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
  • Weak hash algorithm codex-rs/codex-mcp/src/tool_catalog_cache.rs:381 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
  • Weak hash algorithm codex-rs/codex-mcp/src/tool_catalog_cache.rs:448 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
  • Weak hash algorithm codex-rs/codex-mcp/src/tools.rs:237 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
  • Weak hash algorithm codex-rs/connectors/src/connector_runtime/persistence.rs:228 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
  • Weak hash algorithm codex-rs/connectors/src/directory_cache.rs:109 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
  • Weak hash algorithm codex-rs/core/src/context/world_state/mod.rs:361 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
  • Weak hash algorithm codex-rs/core/src/context/world_state/mod.rs:365 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
  • Weak hash algorithm codex-rs/utils/cache/src/lib.rs:157 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
D1 · Cyclomatic Complexity · codex_app_server · ×10
  • codex_app_server::run_main_with_transport_options (cyclomatic 111) codex-rs/app-server/src/lib.rs:508 — codex_app_server::run_main_with_transport_options has cyclomatic complexity 111 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_app_server::bespoke_event_handling::apply_bespoke_event_handling (cyclomatic 101) codex-rs/app-server/src/bespoke_event_handling.rs:147 — codex_app_server::bespoke_event_handling::apply_bespoke_event_handling has cyclomatic complexity 101 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_app_server::in_process::start_uninitialized (cyclomatic 46) codex-rs/app-server/src/in_process.rs:433 — codex_app_server::in_process::start_uninitialized has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_app_server::request_processors::thread_lifecycle::ensure_listener_task_running (cyclomatic 36) codex-rs/app-server/src/request_processors/thread_lifecycle.rs:232 — codex_app_server::request_processors::thread_lifecycle::ensure_listener_task_running has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_app_server::mcp_refresh::reload_mcp_config_with_policy (cyclomatic 26) codex-rs/app-server/src/mcp_refresh.rs:44 — codex_app_server::mcp_refresh::reload_mcp_config_with_policy has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_app_server::request_processors::thread_processor::validate_dynamic_tools (cyclomatic 24) codex-rs/app-server/src/request_processors/thread_processor.rs:333 — codex_app_server::request_processors::thread_processor::validate_dynamic_tools has cyclomatic complexity 24 (threshold 15). Of this number, 12 points are the body's own statements and 12 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_app_server::request_processors::thread_lifecycle::handle_pending_thread_resume_request (cyclomatic 23) codex-rs/app-server/src/request_processors/thread_lifecycle.rs:722 — codex_app_server::request_processors::thread_lifecycle::handle_pending_thread_resume_request has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_app_server::request_processors::thread_processor::collect_resume_override_mismatches (cyclomatic 23) codex-rs/app-server/src/request_processors/thread_processor.rs:121 — codex_app_server::request_processors::thread_processor::collect_resume_override_mismatches has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_app_server::request_processors::mcp_event_stream::forward_events (cyclomatic 19) codex-rs/app-server/src/request_processors/mcp_event_stream.rs:183 — codex_app_server::request_processors::mcp_event_stream::forward_events has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_app_server::request_processors::feedback_rollout_history::history_base_attachments (cyclomatic 17) codex-rs/app-server/src/request_processors/feedback_rollout_history.rs:18 — codex_app_server::request_processors::feedback_rollout_history::history_base_attachments has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_shell_command · ×10
  • codex_shell_command::shell_snapshot_literals::literal_words_with_quoting (cyclomatic 96) codex-rs/shell-command/src/shell_snapshot_literals.rs:51 — codex_shell_command::shell_snapshot_literals::literal_words_with_quoting has cyclomatic complexity 96 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_shell_command::parse_command::summarize_main_tokens (cyclomatic 65) codex-rs/shell-command/src/parse_command.rs:2290 — codex_shell_command::parse_command::summarize_main_tokens has cyclomatic complexity 65 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_shell_command::shell_snapshot_credentials::prepare_snapshot_credentials (cyclomatic 49) codex-rs/shell-command/src/shell_snapshot_credentials.rs:39 — codex_shell_command::shell_snapshot_credentials::prepare_snapshot_credentials has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_shell_command::shell_snapshot_literals::decode_ansi_c_bytes (cyclomatic 43) codex-rs/shell-command/src/shell_snapshot_literals.rs:546 — codex_shell_command::shell_snapshot_literals::decode_ansi_c_bytes has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_shell_command::command_safety::powershell_tree_sitter::source_is_covered_by_commands (cyclomatic 30) codex-rs/shell-command/src/command_safety/powershell_tree_sitter.rs:207 — codex_shell_command::command_safety::powershell_tree_sitter::source_is_covered_by_commands has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_shell_command::parse_command::parse_shell_script (cyclomatic 25) codex-rs/shell-command/src/parse_command.rs:1997 — codex_shell_command::parse_command::parse_shell_script has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_shell_command::parse_command::is_small_formatting_command (cyclomatic 24) codex-rs/shell-command/src/parse_command.rs:2128 — codex_shell_command::parse_command::is_small_formatting_command has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_shell_command::command_safety::windows_dangerous_commands::is_dangerous_cmd (cyclomatic 19) codex-rs/shell-command/src/command_safety/windows_dangerous_commands.rs:158 — codex_shell_command::command_safety::windows_dangerous_commands::is_dangerous_cmd has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • codex_shell_command::command_safety::windows_dangerous_commands::classify_powershell_words (cyclomatic 18) codex-rs/shell-command/src/command_safety/windows_dangerous_commands.rs:104 — codex_shell_command::command_safety::windows_dangerous_commands::classify_powershell_words has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • codex_shell_command::shell_snapshot_literals::literal_word_bytes (cyclomatic 16) codex-rs/shell-command/src/shell_snapshot_literals.rs:469 — codex_shell_command::shell_snapshot_literals::literal_word_bytes has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatComposer · ×10
  • ChatComposer::render_with_options (cyclomatic 87) codex-rs/tui/src/bottom_pane/chat_composer.rs:4532 — ChatComposer::render_with_options has cyclomatic complexity 87 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatComposer::handle_key_event_without_popup (cyclomatic 34) codex-rs/tui/src/bottom_pane/chat_composer.rs:3478 — ChatComposer::handle_key_event_without_popup has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatComposer::handle_key_event_with_slash_popup (cyclomatic 30) codex-rs/tui/src/bottom_pane/chat_composer/slash_input.rs:238 — ChatComposer::handle_key_event_with_slash_popup has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatComposer::handle_input_basic_with_time (cyclomatic 29) codex-rs/tui/src/bottom_pane/chat_composer.rs:3632 — ChatComposer::handle_input_basic_with_time has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatComposer::sync_popups (cyclomatic 21) codex-rs/tui/src/bottom_pane/chat_composer.rs:3861 — ChatComposer::sync_popups has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • ChatComposer::mention_items (cyclomatic 20) codex-rs/tui/src/bottom_pane/chat_composer.rs:4160 — ChatComposer::mention_items has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatComposer::handle_submission_with_time (cyclomatic 19) codex-rs/tui/src/bottom_pane/chat_composer.rs:3165 — ChatComposer::handle_submission_with_time has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatComposer::handle_key_event_with_mentions_v2_popup (cyclomatic 17) codex-rs/tui/src/bottom_pane/chat_composer.rs:2288 — ChatComposer::handle_key_event_with_mentions_v2_popup has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ChatComposer::prepare_submission_text_with_options (cyclomatic 17) codex-rs/tui/src/bottom_pane/chat_composer.rs:3007 — ChatComposer::prepare_submission_text_with_options has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • ChatComposer::handle_history_search_key (cyclomatic 16) codex-rs/tui/src/bottom_pane/chat_composer/history_search.rs:166 — ChatComposer::handle_history_search_key has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D2 · Cognitive Complexity · codex_sandboxing · ×10
  • codex_sandboxing::seatbelt::seatbelt_regex_for_glob (cognitive 48) REDACTED:719 — codex_sandboxing::seatbelt::seatbelt_regex_for_glob has cognitive complexity 48 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 5 (12 pts), match/switch 3 (10 pts), boolean chains 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_sandboxing::seatbelt::create_seatbelt_command_args_with_profile (cognitive 37) REDACTED:878 — codex_sandboxing::seatbelt::create_seatbelt_command_args_with_profile has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (26 pts), loops 4 (10 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_sandboxing::policy_transforms::materialize_context_dependent_entries (cognitive 33) codex-rs/sandboxing/src/policy_transforms.rs:468 — codex_sandboxing::policy_transforms::materialize_context_dependent_entries has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (26 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_sandboxing::seatbelt::build_seatbelt_access_policy (cognitive 30) REDACTED:486 — codex_sandboxing::seatbelt::build_seatbelt_access_policy has cognitive complexity 30 (threshold 15). Drivers by points: match/switch 5 (11 pts), if/else 5 (10 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_sandboxing::bwrap::find_executable_in_search_paths (cognitive 25) codex-rs/sandboxing/src/bwrap.rs:210 — codex_sandboxing::bwrap::find_executable_in_search_paths has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 10, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_sandboxing::windows::resolve_windows_restricted_token_filesystem_overrides (cognitive 25) codex-rs/sandboxing/src/windows.rs:74 — codex_sandboxing::windows::resolve_windows_restricted_token_filesystem_overrides has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 4 (6 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_sandboxing::windows::resolve_windows_elevated_filesystem_overrides (cognitive 24) codex-rs/sandboxing/src/windows.rs:215 — codex_sandboxing::windows::resolve_windows_elevated_filesystem_overrides has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5, loops 2 (5 pts) (nesting depth added 6). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_sandboxing::seatbelt::build_seatbelt_unreadable_glob_policy (cognitive 23) REDACTED:624 — codex_sandboxing::seatbelt::build_seatbelt_unreadable_glob_policy has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_sandboxing::seatbelt::dynamic_network_policy_for_network (cognitive 19) REDACTED:319 — codex_sandboxing::seatbelt::dynamic_network_policy_for_network has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_sandboxing::bwrap::system_bwrap_has_user_namespace_access (cognitive 16) codex-rs/sandboxing/src/bwrap.rs:85 — codex_sandboxing::bwrap::system_bwrap_has_user_namespace_access has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×10
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Medium vulnerability · ×10
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D1 · Cyclomatic Complexity · codex_exec_server · ×9
  • codex_exec_server::noise_relay::harness::noise_harness_connection_from_websocket_with_readiness (cyclomatic 60) codex-rs/exec-server/src/noise_relay/harness.rs:88 — codex_exec_server::noise_relay::harness::noise_harness_connection_from_websocket_with_readiness has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_exec_server::relay::run_multiplexed_environment (cyclomatic 50) codex-rs/exec-server/src/relay.rs:513 — codex_exec_server::relay::run_multiplexed_environment has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_exec_server::shell_snapshot_credentials::prepare (cyclomatic 29) codex-rs/exec-server/src/shell_snapshot_credentials.rs:54 — codex_exec_server::shell_snapshot_credentials::prepare has cyclomatic complexity 29 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • codex_exec_server::capability_discovery::discover_root (cyclomatic 27) codex-rs/exec-server/src/capability_discovery.rs:64 — codex_exec_server::capability_discovery::discover_root has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_exec_server::relay::harness_connection_from_websocket (cyclomatic 24) codex-rs/exec-server/src/relay.rs:284 — codex_exec_server::relay::harness_connection_from_websocket has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_exec_server::discoverV2::capability_discoveries::parse_root (cyclomatic 21) codex-rs/exec-server/src/discoverV2/capability_discoveries.rs:177 — codex_exec_server::discoverV2::capability_discoveries::parse_root has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_exec_server::server::processor::run_connection (cyclomatic 20) codex-rs/exec-server/src/server/processor.rs:108 — codex_exec_server::server::processor::run_connection has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_exec_server::process_sandbox::prepare_exec_request_with_telemetry (cyclomatic 18) codex-rs/exec-server/src/process_sandbox.rs:114 — codex_exec_server::process_sandbox::prepare_exec_request_with_telemetry has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_exec_server::client::handle_server_notification (cyclomatic 16) codex-rs/exec-server/src/client.rs:1906 — codex_exec_server::client::handle_server_notification has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TranscriptView · ×9
  • TranscriptView::handle_select_mode_key (cyclomatic 48) codex-rs/tui/src/transcript_view/select_mode.rs:163 — TranscriptView::handle_select_mode_key has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TranscriptView::move_copy_target (cyclomatic 32) codex-rs/tui/src/transcript_view/copy_mode.rs:91 — TranscriptView::move_copy_target has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TranscriptView::handle_mouse_with_mode (cyclomatic 31) codex-rs/tui/src/transcript_view/input.rs:286 — TranscriptView::handle_mouse_with_mode has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TranscriptView::handle_disclosure_key (cyclomatic 28) codex-rs/tui/src/transcript_view/disclosure.rs:165 — TranscriptView::handle_disclosure_key has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TranscriptView::render (cyclomatic 26) codex-rs/tui/src/transcript_view.rs:185 — TranscriptView::render has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TranscriptView::footer_with_navigation (cyclomatic 25) codex-rs/tui/src/transcript_view/footer.rs:17 — TranscriptView::footer_with_navigation has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • TranscriptView::handle_search_key (cyclomatic 21) codex-rs/tui/src/transcript_view/search.rs:184 — TranscriptView::handle_search_key has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • TranscriptView::handle_key (cyclomatic 19) codex-rs/tui/src/transcript_view/input.rs:193 — TranscriptView::handle_key has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TranscriptView::owns_interaction_key (cyclomatic 18) codex-rs/tui/src/transcript_view/input.rs:155 — TranscriptView::owns_interaction_key has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · codex_cloud_tasks · ×9
  • codex_cloud_tasks::run_main (cognitive 758) codex-rs/cloud-tasks/src/lib.rs:753 — codex_cloud_tasks::run_main has cognitive complexity 758 (threshold 15). Drivers by points: if/else 125 (595 pts), match/switch 26 (128 pts), boolean chains 21, loops 4 (14 pts) (nesting depth added 582). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • codex_cloud_tasks::pretty_lines_from_error (cognitive 44) codex-rs/cloud-tasks/src/lib.rs:2078 — codex_cloud_tasks::pretty_lines_from_error has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (41 pts), boolean chains 3 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • codex_cloud_tasks::ui::draw_diff_overlay (cognitive 41) codex-rs/cloud-tasks/src/ui.rs:312 — codex_cloud_tasks::ui::draw_diff_overlay has cognitive complexity 41 (threshold 15). Drivers by points: if/else 22 (35 pts), boolean chains 6 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cloud_tasks::env_detect::list_environments_with_origins (cognitive 39) codex-rs/cloud-tasks/src/env_detect.rs:317 — codex_cloud_tasks::env_detect::list_environments_with_origins has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 3 (7 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cloud_tasks::ui::draw_apply_modal (cognitive 30) codex-rs/cloud-tasks/src/ui.rs:469 — codex_cloud_tasks::ui::draw_apply_modal has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (10 pts), match/switch 1 (3 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • codex_cloud_tasks::ui::style_conversation_lines (cognitive 25) codex-rs/cloud-tasks/src/ui.rs:558 — codex_cloud_tasks::ui::style_conversation_lines has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cloud_tasks::env_detect::get_git_origins (cognitive 20) codex-rs/cloud-tasks/src/env_detect.rs:217 — codex_cloud_tasks::env_detect::get_git_origins has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_cloud_tasks::format_task_status_lines (cognitive 16) codex-rs/cloud-tasks/src/lib.rs:429 — codex_cloud_tasks::format_task_status_lines has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (14 pts), match/switch 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_cloud_tasks::env_detect::autodetect_environment_id_with_origins (cognitive 16) codex-rs/cloud-tasks/src/env_detect.rs:43 — codex_cloud_tasks::env_detect::autodetect_environment_id_with_origins has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_app_server_daemon · ×9
  • codex_app_server_daemon::prepare_install::prepare_from_package (cognitive 64) codex-rs/app-server-daemon/src/prepare_install.rs:87 — codex_app_server_daemon::prepare_install::prepare_from_package has cognitive complexity 64 (threshold 15). Drivers by points: if/else 39 (54 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server_daemon::manual_update::request (cognitive 63) codex-rs/app-server-daemon/src/manual_update.rs:28 — codex_app_server_daemon::manual_update::request has cognitive complexity 63 (threshold 15). Drivers by points: if/else 15 (48 pts), loops 3 (9 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server_daemon::update_loop::run_with_http (cognitive 56) codex-rs/app-server-daemon/src/update_loop.rs:98 — codex_app_server_daemon::update_loop::run_with_http has cognitive complexity 56 (threshold 15). Drivers by points: if/else 12 (37 pts), match/switch 6 (16 pts), loops 2, boolean chains 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server_daemon::release_pruning::prune (cognitive 34) codex-rs/app-server-daemon/src/release_pruning.rs:134 — codex_app_server_daemon::release_pruning::prune has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 4 (8 pts), boolean chains 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server_daemon::update_loop::update_once (cognitive 27) codex-rs/app-server-daemon/src/update_loop.rs:334 — codex_app_server_daemon::update_loop::update_once has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (18 pts), match/switch 4 (5 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server_daemon::install_lock::acquire_install_lock (cognitive 26) codex-rs/app-server-daemon/src/install_lock.rs:25 — codex_app_server_daemon::install_lock::acquire_install_lock has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 3 (6 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server_daemon::update_loop::run_installer_script (cognitive 23) codex-rs/app-server-daemon/src/update_loop.rs:576 — codex_app_server_daemon::update_loop::run_installer_script has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server_daemon::background_command::set_working_directory (cognitive 22) codex-rs/app-server-daemon/src/background_command.rs:9 — codex_app_server_daemon::background_command::set_working_directory has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 4, loops 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server_daemon::prepare_install::package_tree (cognitive 20) codex-rs/app-server-daemon/src/prepare_install.rs:430 — codex_app_server_daemon::prepare_install::package_tree has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_rmcp_client · ×9
  • codex_rmcp_client::ema_auth::discover_ema_authorization_metadata (cognitive 35) codex-rs/rmcp-client/src/ema_auth.rs:135 — codex_rmcp_client::ema_auth::discover_ema_authorization_metadata has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (25 pts), match/switch 2 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rmcp_client::ema_resource::discover_ema_resource (cognitive 31) codex-rs/rmcp-client/src/ema_resource.rs:237 — codex_rmcp_client::ema_resource::discover_ema_resource has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (25 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rmcp_client::request_input::request (cognitive 23) codex-rs/rmcp-client/src/request_input.rs:84 — codex_rmcp_client::request_input::request has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 3 (6 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rmcp_client::rmcp_client::active_time_timeout (cognitive 22) codex-rs/rmcp-client/src/rmcp_client.rs:251 — codex_rmcp_client::rmcp_client::active_time_timeout has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (16 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rmcp_client::utils::build_default_headers (cognitive 21) codex-rs/rmcp-client/src/utils.rs:103 — codex_rmcp_client::utils::build_default_headers has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 4 (8 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rmcp_client::perform_oauth_login::spawn_callback_server (cognitive 18) codex-rs/rmcp-client/src/perform_oauth_login.rs:284 — codex_rmcp_client::perform_oauth_login::spawn_callback_server has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rmcp_client::oauth::load_oauth_tokens_from_file_with_lock_held (cognitive 17) codex-rs/rmcp-client/src/oauth.rs:888 — codex_rmcp_client::oauth::load_oauth_tokens_from_file_with_lock_held has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rmcp_client::http_client_adapter::legacy_discovery_fallback_response (cognitive 16) codex-rs/rmcp-client/src/http_client_adapter.rs:811 — codex_rmcp_client::http_client_adapter::legacy_discovery_fallback_response has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 6, match/switch 2 (3 pts) (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_rmcp_client::oauth_client_registration::start_authorization (cognitive 16) codex-rs/rmcp-client/src/oauth_client_registration.rs:37 — codex_rmcp_client::oauth_client_registration::start_authorization has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_skills_extension · ×9
  • codex_skills_extension::loader::discovery::discover_skills (cognitive 23) codex-rs/ext/skills/src/loader/discovery.rs:54 — codex_skills_extension::loader::discovery::discover_skills has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 6, match/switch 3 (4 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_skills_extension::invocation::detect_implicit_skill_invocation (cognitive 21) codex-rs/ext/skills/src/invocation.rs:41 — codex_skills_extension::invocation::detect_implicit_skill_invocation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_skills_extension::selection::collect_explicit_skill_mentions (cognitive 20) codex-rs/ext/skills/src/selection.rs:21 — codex_skills_extension::selection::collect_explicit_skill_mentions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (6 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_skills_extension::catalog::merge_catalogs (cognitive 19) codex-rs/ext/skills/src/catalog.rs:421 — codex_skills_extension::catalog::merge_catalogs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_skills_extension::dynamic_skill_selector::character_ngram::grams (cognitive 18) codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:190 — codex_skills_extension::dynamic_skill_selector::character_ngram::grams has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_skills_extension::catalog::apply_plugin_denials (cognitive 17) codex-rs/ext/skills/src/catalog.rs:371 — codex_skills_extension::catalog::apply_plugin_denials has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_skills_extension::loader::host::load_skills_under_root (cognitive 17) codex-rs/ext/skills/src/loader/host.rs:146 — codex_skills_extension::loader::host::load_skills_under_root has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 7 (9 pts), if/else 4 (6 pts), loops 2 (nesting depth added 4). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_skills_extension::loader::host_merge::load_and_merge_host_skill_roots_with_request_snapshots (cognitive 17) codex-rs/ext/skills/src/loader/host_merge.rs:42 — codex_skills_extension::loader::host_merge::load_and_merge_host_skill_roots_with_request_snapshots has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3, boolean chains 2, match/switch 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_skills_extension::loader::host_merge::merge_host_skill_root_snapshots (cognitive 17) codex-rs/ext/skills/src/loader/host_merge.rs:198 — codex_skills_extension::loader::host_merge::merge_host_skill_root_snapshots has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×9
  • Duplicated block (20 lines × 2) codex-rs/app-server-client/src/lib.rs:495 — codex-rs/app-server-client/src/lib.rs:495-514 | codex-rs/app-server-client/src/lib.rs:679-698 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) codex-rs/cli/src/doctor/thread_inventory.rs:199 — codex-rs/cli/src/doctor/thread_inventory.rs:199-218 | codex-rs/cli/src/doctor/thread_inventory.rs:417-436 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) codex-rs/core-plugins/src/remote.rs:847 — codex-rs/core-plugins/src/remote.rs:847-866 | codex-rs/core-plugins/src/remote.rs:874-893 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) codex-rs/core/src/mcp_tool_call.rs:1062 — codex-rs/core/src/mcp_tool_call.rs:1062-1081 | codex-rs/core/src/tools/handlers/mcp_resource.rs:305-324 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (20 lines × 2) codex-rs/exec/src/lib.rs:1519 — codex-rs/exec/src/lib.rs:1519-1538 | codex-rs/tui/src/app_server_session.rs:2088-2107 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (20 lines × 2) codex-rs/rollout-trace/src/protocol_event.rs:413 — codex-rs/rollout-trace/src/protocol_event.rs:413-432 | codex-rs/rollout-trace/src/protocol_event.rs:494-513 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) codex-rs/tui/src/bottom_pane/chat_composer.rs:4192 — codex-rs/tui/src/bottom_pane/chat_composer.rs:4192-4211 | codex-rs/tui/src/bottom_pane/mentions_v2/search_catalog.rs:217-236 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (20 lines × 2) codex-rs/tui/src/resume_picker.rs:489 — codex-rs/tui/src/resume_picker.rs:489-508 | codex-rs/tui/src/resume_picker.rs:551-570 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) codex-rs/apply-patch/src/lib.rs:523 — codex-rs/apply-patch/src/lib.rs:523-542 | codex-rs/apply-patch/src/lib.rs:617-636 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×9
  • Duplicated block (11–12 lines × 2) codex-rs/analytics/src/events.rs:1539 — codex-rs/analytics/src/events.rs:1539-1550 | codex-rs/core/src/hook_runtime.rs:1023-1033 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11–12 lines × 2) codex-rs/core/src/realtime_conversation.rs:1107 — codex-rs/core/src/realtime_conversation.rs:1107-1117 | codex-rs/core/src/realtime_conversation.rs:1175-1186 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–12 lines × 2) codex-rs/ext/goal/src/runtime.rs:351 — codex-rs/ext/goal/src/runtime.rs:351-362 | codex-rs/ext/goal/src/runtime.rs:465-475 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–12 lines × 2) codex-rs/login/src/auth/manager.rs:2317 — codex-rs/login/src/auth/manager.rs:2317-2328 | codex-rs/login/src/auth/manager.rs:2382-2392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–12 lines × 2) codex-rs/rollout-trace/src/protocol_event.rs:385 — codex-rs/rollout-trace/src/protocol_event.rs:385-395 | codex-rs/rollout-trace/src/protocol_event.rs:467-478 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–12 lines × 2) codex-rs/sandboxing/src/manager.rs:402 — codex-rs/sandboxing/src/manager.rs:402-412 | codex-rs/sandboxing/src/manager.rs:485-496 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–12 lines × 2) codex-rs/tui/src/bottom_pane/chat_composer_history.rs:638 — codex-rs/tui/src/bottom_pane/chat_composer_history.rs:638-649 | codex-rs/tui/src/bottom_pane/chat_composer_history.rs:702-712 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–12 lines × 2) scripts/mcp_conformance/run_codex_compliance.py:1556 — scripts/mcp_conformance/run_codex_compliance.py:1556-1566 | scripts/mcp_conformance/run_codex_compliance.py:1616-1627 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–12 lines × 2) codex-rs/skills/src/assets/samples/imagegen/scripts/image_gen.py:779 — codex-rs/skills/src/assets/samples/imagegen/scripts/image_gen.py:779-790 | codex-rs/skills/src/assets/samples/imagegen/scripts/image_gen.py:861-871 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D1 · Cyclomatic Complexity · ThreadRequestProcessor · ×8
  • ThreadRequestProcessor::thread_fork_inner (cyclomatic 100) codex-rs/app-server/src/request_processors/thread_processor.rs:5236 — ThreadRequestProcessor::thread_fork_inner has cyclomatic complexity 100 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • ThreadRequestProcessor::thread_resume_inner (cyclomatic 67) codex-rs/app-server/src/request_processors/thread_processor.rs:3951 — ThreadRequestProcessor::thread_resume_inner has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ThreadRequestProcessor::resume_running_thread (cyclomatic 33) codex-rs/app-server/src/request_processors/thread_processor.rs:4623 — ThreadRequestProcessor::resume_running_thread has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ThreadRequestProcessor::thread_revert_response (cyclomatic 23) codex-rs/app-server/src/request_processors/thread_processor.rs:2214 — ThreadRequestProcessor::thread_revert_response has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ThreadRequestProcessor::thread_list_response_inner (cyclomatic 22) codex-rs/app-server/src/request_processors/thread_processor.rs:2701 — ThreadRequestProcessor::thread_list_response_inner has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ThreadRequestProcessor::continue_daemon_turn (cyclomatic 20) codex-rs/app-server/src/request_processors/daemon_continuation.rs:23 — ThreadRequestProcessor::continue_daemon_turn has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ThreadRequestProcessor::thread_start_task (cyclomatic 19) codex-rs/app-server/src/request_processors/thread_processor.rs:1394 — ThreadRequestProcessor::thread_start_task has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • ThreadRequestProcessor::thread_metadata_update_response_inner (cyclomatic 19) codex-rs/app-server/src/request_processors/thread_processor.rs:2005 — ThreadRequestProcessor::thread_metadata_update_response_inner has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · codex_app_server_daemon · ×8
  • codex_app_server_daemon::prepare_install::prepare_from_package (cyclomatic 40) codex-rs/app-server-daemon/src/prepare_install.rs:87 — codex_app_server_daemon::prepare_install::prepare_from_package has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_app_server_daemon::update_loop::run_with_http (cyclomatic 27) codex-rs/app-server-daemon/src/update_loop.rs:98 — codex_app_server_daemon::update_loop::run_with_http has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_app_server_daemon::update_loop::update_once (cyclomatic 25) codex-rs/app-server-daemon/src/update_loop.rs:334 — codex_app_server_daemon::update_loop::update_once has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_app_server_daemon::install_lock::acquire_install_lock (cyclomatic 20) codex-rs/app-server-daemon/src/install_lock.rs:25 — codex_app_server_daemon::install_lock::acquire_install_lock has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • codex_app_server_daemon::manual_update::request (cyclomatic 20) codex-rs/app-server-daemon/src/manual_update.rs:28 — codex_app_server_daemon::manual_update::request has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_app_server_daemon::release_pruning::prune (cyclomatic 18) codex-rs/app-server-daemon/src/release_pruning.rs:134 — codex_app_server_daemon::release_pruning::prune has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_app_server_daemon::background_command::set_working_directory (cyclomatic 17) codex-rs/app-server-daemon/src/background_command.rs:9 — codex_app_server_daemon::background_command::set_working_directory has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_app_server_daemon::update_loop::run_installer_script (cyclomatic 16) codex-rs/app-server-daemon/src/update_loop.rs:576 — codex_app_server_daemon::update_loop::run_installer_script has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_windows_sandbox · ×8
  • codex_windows_sandbox::setup_provisioning::run_setup_full (cyclomatic 35) codex-rs/windows-sandbox-rs/src/setup_provisioning.rs:912 — codex_windows_sandbox::setup_provisioning::run_setup_full has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_windows_sandbox::bin::command_runner::win::main (cyclomatic 24) codex-rs/windows-sandbox-rs/src/bin/command_runner/win.rs:547 — codex_windows_sandbox::bin::command_runner::win::main has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_windows_sandbox::windows_impl::run_windows_sandbox_capture_with_filesystem_overrides (cyclomatic 21) codex-rs/windows-sandbox-rs/src/lib.rs:708 — codex_windows_sandbox::windows_impl::run_windows_sandbox_capture_with_filesystem_overrides has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_windows_sandbox::acl::ensure_allow_mask_aces_with_inheritance_impl (cyclomatic 19) codex-rs/windows-sandbox-rs/src/acl.rs:541 — codex_windows_sandbox::acl::ensure_allow_mask_aces_with_inheritance_impl has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_windows_sandbox::acl::dacl_mask_allows_with_scope (cyclomatic 18) codex-rs/windows-sandbox-rs/src/acl.rs:158 — codex_windows_sandbox::acl::dacl_mask_allows_with_scope has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_windows_sandbox::bin::command_runner::win::spawn_input_loop (cyclomatic 18) codex-rs/windows-sandbox-rs/src/bin/command_runner/win.rs:442 — codex_windows_sandbox::bin::command_runner::win::spawn_input_loop has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_windows_sandbox::spawn_prep::apply_legacy_session_acl_rules (cyclomatic 18) codex-rs/windows-sandbox-rs/src/spawn_prep.rs:268 — codex_windows_sandbox::spawn_prep::apply_legacy_session_acl_rules has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_windows_sandbox::setup_provisioning::setup_runtime_bin::ensure_runtime_tree_readable (cyclomatic 16) codex-rs/windows-sandbox-rs/src/setup_provisioning/setup_runtime_bin.rs:110 — codex_windows_sandbox::setup_provisioning::setup_runtime_bin::ensure_runtime_tree_readable has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_network_proxy · ×8
  • codex_network_proxy::credential_broker::matching::virtualize_text (cyclomatic 34) codex-rs/network-proxy/src/credential_broker/matching.rs:158 — codex_network_proxy::credential_broker::matching::virtualize_text has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_network_proxy::state::validate_policy_against_constraints (cyclomatic 32) codex-rs/network-proxy/src/state.rs:121 — codex_network_proxy::state::validate_policy_against_constraints has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_network_proxy::http_proxy::http_plain_proxy (cyclomatic 29) codex-rs/network-proxy/src/http_proxy.rs:563 — codex_network_proxy::http_proxy::http_plain_proxy has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_network_proxy::credential_broker::matching::known_credential_matches (cyclomatic 25) codex-rs/network-proxy/src/credential_broker/matching.rs:23 — codex_network_proxy::credential_broker::matching::known_credential_matches has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • codex_network_proxy::socks5::handle_socks5_tcp (cyclomatic 24) codex-rs/network-proxy/src/socks5.rs:200 — codex_network_proxy::socks5::handle_socks5_tcp has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_network_proxy::credential_broker::registry::select_credentials (cyclomatic 23) codex-rs/network-proxy/src/credential_broker/registry.rs:191 — codex_network_proxy::credential_broker::registry::select_credentials has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_network_proxy::brokered_tunnel::peek_protocol (cyclomatic 19) codex-rs/network-proxy/src/brokered_tunnel.rs:43 — codex_network_proxy::brokered_tunnel::peek_protocol has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_network_proxy::http_proxy::http_connect_accept (cyclomatic 17) codex-rs/network-proxy/src/http_proxy.rs:188 — codex_network_proxy::http_proxy::http_connect_accept has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D2 · Cognitive Complexity · codex_git_utils · ×8
  • codex_git_utils::apply::parse_git_apply_output (cognitive 86) codex-rs/git-utils/src/apply.rs:355 — codex_git_utils::apply::parse_git_apply_output has cognitive complexity 86 (threshold 15). Drivers by points: if/else 30 (77 pts), boolean chains 6, loops 3 (nesting depth added 47). Of this number, 80 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_git_utils::apply::unescape_c_string (cognitive 23) codex-rs/git-utils/src/apply.rs:278 — codex_git_utils::apply::unescape_c_string has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 2 (6 pts), loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_git_utils::info::get_default_branch (cognitive 22) codex-rs/git-utils/src/info.rs:456 — codex_git_utils::info::get_default_branch has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_git_utils::trust::resolve_root (cognitive 22) codex-rs/git-utils/src/trust.rs:71 — codex_git_utils::trust::resolve_root has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 4, match/switch 3 (4 pts), loops 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_git_utils::apply::read_diff_git_token (cognitive 21) codex-rs/git-utils/src/apply.rs:227 — codex_git_utils::apply::read_diff_git_token has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 2 (3 pts), loops 2, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_git_utils::info::branch_remote_and_distance (cognitive 21) codex-rs/git-utils/src/info.rs:606 — codex_git_utils::info::branch_remote_and_distance has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (16 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_git_utils::info::diff_against_sha (cognitive 19) codex-rs/git-utils/src/info.rs:712 — codex_git_utils::info::diff_against_sha has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_git_utils::info::branch_ancestry (cognitive 17) codex-rs/git-utils/src/info.rs:535 — codex_git_utils::info::branch_ancestry has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PluginsManager · ×8
  • PluginsManager::plugins_for_config (cognitive 36) codex-rs/core-plugins/src/manager.rs:825 — PluginsManager::plugins_for_config has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (35 pts), loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PluginsManager::maybe_start_plugin_startup_tasks_for_config (cognitive 34) codex-rs/core-plugins/src/manager.rs:2879 — PluginsManager::maybe_start_plugin_startup_tasks_for_config has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 4 (9 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PluginsManager::run_non_curated_plugin_cache_refresh_loop (cognitive 27) codex-rs/core-plugins/src/manager.rs:3552 — PluginsManager::run_non_curated_plugin_cache_refresh_loop has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 5 (10 pts), loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PluginsManager::list_tool_suggest_discoverable_plugins (cognitive 25) codex-rs/core-plugins/src/discoverable.rs:71 — PluginsManager::list_tool_suggest_discoverable_plugins has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 7, loops 3 (5 pts), match/switch 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PluginsManager::run_remote_installed_plugins_cache_refresh_loop (cognitive 22) codex-rs/core-plugins/src/manager.rs:3423 — PluginsManager::run_remote_installed_plugins_cache_refresh_loop has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 3 (6 pts), boolean chains 3, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PluginsManager::schedule_non_curated_plugin_cache_refresh (cognitive 20) codex-rs/core-plugins/src/manager.rs:3276 — PluginsManager::schedule_non_curated_plugin_cache_refresh has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 7, match/switch 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • PluginsManager::read_plugin_detail_for_marketplace_plugin (cognitive 19) codex-rs/core-plugins/src/manager.rs:2678 — PluginsManager::read_plugin_detail_for_marketplace_plugin has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 3, loops 1, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • PluginsManager::schedule_remote_installed_plugins_cache_refresh (cognitive 19) codex-rs/core-plugins/src/manager.rs:3151 — PluginsManager::schedule_remote_installed_plugins_cache_refresh has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×8
  • Duplicated block (9–10 lines × 2) codex-rs/app-server/src/in_process_bootstrap.rs:111 — codex-rs/app-server/src/in_process_bootstrap.rs:111-119 | codex-rs/app-server/src/in_process_bootstrap.rs:135-144 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) codex-rs/cloud-tasks/src/lib.rs:1787 — codex-rs/cloud-tasks/src/lib.rs:1787-1795 | codex-rs/cloud-tasks/src/lib.rs:1825-1834 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) codex-rs/core/src/unified_exec/process_manager.rs:529 — codex-rs/core/src/unified_exec/process_manager.rs:529-538 | codex-rs/core/src/unified_exec/process_manager.rs:905-913 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) codex-rs/exec/src/lib.rs:940 — codex-rs/exec/src/lib.rs:940-949 | codex-rs/exec/src/lib.rs:963-971 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) codex-rs/ext/memories/src/local/list.rs:61 — codex-rs/ext/memories/src/local/list.rs:61-70 | codex-rs/ext/memories/src/local/search.rs:72-80 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9–10 lines × 2) codex-rs/ext/skills/src/render.rs:791 — codex-rs/ext/skills/src/render.rs:791-799 | codex-rs/ext/skills/src/render.rs:988-997 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) codex-rs/git-utils/src/apply.rs:84 — codex-rs/git-utils/src/apply.rs:84-92 | codex-rs/git-utils/src/apply.rs:105-114 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) codex-rs/tui/src/markdown_render/inline_directives.rs:74 — codex-rs/tui/src/markdown_render/inline_directives.rs:74-83 | codex-rs/tui/src/markdown_render/math.rs:49-57 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×8
  • Duplicated block (7 lines × 3) codex-rs/app-server-protocol/src/protocol/thread_history_projection.rs:89 — codex-rs/app-server-protocol/src/protocol/thread_history_projection.rs:89-95 | codex-rs/rollout/src/list.rs:1134-1141 | codex-rs/rollout/src/list.rs:1228-1235 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (7 lines × 3) codex-rs/core/src/hook_runtime.rs:551 — codex-rs/core/src/hook_runtime.rs:551-557 | codex-rs/core/src/hook_runtime.rs:593-599 | codex-rs/core/src/hook_runtime.rs:696-702 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) codex-rs/ext/memories/src/tools/list.rs:95 — codex-rs/ext/memories/src/tools/list.rs:95-101 | codex-rs/ext/memories/src/tools/read.rs:92-98 | codex-rs/ext/memories/src/tools/search.rs:93-99 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (7 lines × 3) codex-rs/network-proxy/src/http_proxy.rs:814 — codex-rs/network-proxy/src/http_proxy.rs:814-820 | codex-rs/network-proxy/src/http_proxy.rs:865-871 | codex-rs/network-proxy/src/http_proxy.rs:978-984 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) codex-rs/tui/src/app/plugin_mentions.rs:64 — codex-rs/tui/src/app/plugin_mentions.rs:64-70 | codex-rs/tui/src/chatwidget/plugin_catalog.rs:1809-1815 | codex-rs/tui/src/chatwidget/plugin_catalog.rs:1843-1849 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (7 lines × 3) codex-rs/tui/src/app_server_session.rs:2460 — codex-rs/tui/src/app_server_session.rs:2460-2466 | codex-rs/tui/src/app_server_session.rs:2498-2504 | codex-rs/tui/src/app_server_session.rs:2535-2541 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) codex-rs/tui/src/keymap.rs:1082 — codex-rs/tui/src/keymap.rs:1082-1088 | codex-rs/tui/src/keymap.rs:1091-1097 | codex-rs/tui/src/keymap.rs:1126-1132 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) codex-rs/core-plugins/src/marketplace_upgrade/git.rs:227 — codex-rs/core-plugins/src/marketplace_upgrade/git.rs:227-233 | codex-rs/core-plugins/src/startup_sync.rs:738-744 | codex-rs/tui/src/app/history_ui.rs:447-457 — before extracting anything, compare `codex-rs/core-plugins/src/marketplace_upgrade/git.rs` and `codex-rs/core-plugins/src/startup_sync.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D1 · Cyclomatic Complexity · codex_thread_store · ×7
  • codex_thread_store::local::update_thread_metadata::apply_metadata_update (cyclomatic 52) codex-rs/thread-store/src/local/update_thread_metadata.rs:347 — codex_thread_store::local::update_thread_metadata::apply_metadata_update has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_thread_store::local::update_thread_metadata::update_thread_metadata (cyclomatic 41) codex-rs/thread-store/src/local/update_thread_metadata.rs:38 — codex_thread_store::local::update_thread_metadata::update_thread_metadata has cyclomatic complexity 41 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_thread_store::local::thread_history_materialization::read_projection_batches (cyclomatic 24) codex-rs/thread-store/src/local/thread_history_materialization.rs:84 — codex_thread_store::local::thread_history_materialization::read_projection_batches has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_thread_store::local::thread_history::segment_paging::page_item_rows (cyclomatic 23) codex-rs/thread-store/src/local/thread_history/segment_paging.rs:194 — codex_thread_store::local::thread_history::segment_paging::page_item_rows has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_thread_store::local::read_thread::read_thread (cyclomatic 19) codex-rs/thread-store/src/local/read_thread.rs:32 — codex_thread_store::local::read_thread::read_thread has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_thread_store::local::search_threads::search_threads (cyclomatic 19) codex-rs/thread-store/src/local/search_threads.rs:36 — codex_thread_store::local::search_threads::search_threads has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_thread_store::local::rollout_migration::legacy_event::completed_item (cyclomatic 17) codex-rs/thread-store/src/local/rollout_migration/legacy_event.rs:137 — codex_thread_store::local::rollout_migration::legacy_event::completed_item has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · codex_config · ×7
  • codex_config::requirements_layers::stack::populate_merged_regular_fields_with_sources (cyclomatic 43) codex-rs/config/src/requirements_layers/stack.rs:201 — codex_config::requirements_layers::stack::populate_merged_regular_fields_with_sources has cyclomatic complexity 43 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_config::loader::sanitize_project_config (cyclomatic 29) codex-rs/config/src/loader/mod.rs:1325 — codex_config::loader::sanitize_project_config has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_config::loader::load_config_layers_state (cyclomatic 27) codex-rs/config/src/loader/mod.rs:146 — codex_config::loader::load_config_layers_state has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_config::schema::features_schema (cyclomatic 20) codex-rs/config/src/schema.rs:42 — codex_config::schema::features_schema has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_config::merge::merge_toml_values_at_path (cyclomatic 19) codex-rs/config/src/merge.rs:81 — codex_config::merge::merge_toml_values_at_path has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_config::loader::validate_project_mitm_profiles (cyclomatic 17) codex-rs/config/src/loader/mod.rs:1218 — codex_config::loader::validate_project_mitm_profiles has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_config::tui_keymap::normalize_keybinding_stroke (cyclomatic 17) codex-rs/config/src/tui_keymap.rs:611 — codex_config::tui_keymap::normalize_keybinding_stroke has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · LocalAgentControl · ×7
  • LocalAgentControl::ensure_v2_agent_loaded (cognitive 66) codex-rs/core/src/agent/control/spawn.rs:325 — LocalAgentControl::ensure_v2_agent_loaded has cognitive complexity 66 (threshold 15). Drivers by points: if/else 33 (49 pts), match/switch 4 (9 pts), boolean chains 5, loops 1 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LocalAgentControl::prepare_forked_history (cognitive 66) codex-rs/core/src/agent/control/spawn.rs:1059 — LocalAgentControl::prepare_forked_history has cognitive complexity 66 (threshold 15). Drivers by points: if/else 32 (47 pts), boolean chains 14, match/switch 3 (4 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LocalAgentControl::root_user_authorization (cognitive 44) codex-rs/core/src/agent/control/user_authorization.rs:48 — LocalAgentControl::root_user_authorization has cognitive complexity 44 (threshold 15). Drivers by points: if/else 24 (31 pts), boolean chains 10, loops 1 (2 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • LocalAgentControl::spawn_agent_internal (cognitive 29) codex-rs/core/src/agent/control/spawn.rs:720 — LocalAgentControl::spawn_agent_internal has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (18 pts), match/switch 6 (7 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • LocalAgentControl::maybe_start_completion_watcher (cognitive 29) codex-rs/core/src/agent/control.rs:471 — LocalAgentControl::maybe_start_completion_watcher has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 5 (8 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LocalAgentControl::resume_agent_from_rollout (cognitive 19) codex-rs/core/src/agent/control/spawn.rs:1387 — LocalAgentControl::resume_agent_from_rollout has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 2 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LocalAgentControl::notify_parent_of_terminal_turn (cognitive 17) codex-rs/core/src/agent/control/completion.rs:27 — LocalAgentControl::notify_parent_of_terminal_turn has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · codex_app_server_protocol · ×7
  • codex_app_server_protocol::export::build_schema_bundle (cognitive 41) codex-rs/app-server-protocol/src/export.rs:1020 — codex_app_server_protocol::export::build_schema_bundle has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (29 pts), loops 3 (6 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server_protocol::export::variant_title_collision_key (cognitive 20) codex-rs/app-server-protocol/src/export.rs:1878 — codex_app_server_protocol::export::variant_title_collision_key has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server_protocol::export::annotate_object (cognitive 18) codex-rs/app-server-protocol/src/export.rs:1782 — codex_app_server_protocol::export::annotate_object has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, loops 4 (7 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server_protocol::export::collect_namespaced_types (cognitive 17) codex-rs/app-server-protocol/src/export.rs:1678 — codex_app_server_protocol::export::collect_namespaced_types has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (9 pts), if/else 3 (8 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • codex_app_server_protocol::protocol::event_mapping::item_event_to_server_notification (cognitive 17) codex-rs/app-server-protocol/src/protocol/event_mapping.rs:30 — codex_app_server_protocol::protocol::event_mapping::item_event_to_server_notification has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 7 (11 pts), if/else 4 (6 pts) (nesting depth added 6). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_app_server_protocol::export::variant_definition_name (cognitive 16) codex-rs/app-server-protocol/src/export.rs:1714 — codex_app_server_protocol::export::variant_definition_name has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), match/switch 2 (6 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server_protocol::export::annotate_variant_list (cognitive 16) codex-rs/app-server-protocol/src/export.rs:1837 — codex_app_server_protocol::export::annotate_variant_list has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_windows_sandbox_service · ×7
  • codex_windows_sandbox_service::ipc::handle_request (cognitive 35) codex-rs/windows-sandbox-service/src/ipc.rs:260 — codex_windows_sandbox_service::ipc::handle_request has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (34 pts), loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox_service::package_lifecycle::cleanup::clean_up (cognitive 28) codex-rs/windows-sandbox-service/src/package_lifecycle/cleanup.rs:23 — codex_windows_sandbox_service::package_lifecycle::cleanup::clean_up has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_windows_sandbox_service::registered_runtime::provision (cognitive 25) codex-rs/windows-sandbox-service/src/registered_runtime.rs:89 — codex_windows_sandbox_service::registered_runtime::provision has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (5 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox_service::ipc::home::prepare_codex_home (cognitive 23) codex-rs/windows-sandbox-service/src/ipc/home.rs:26 — codex_windows_sandbox_service::ipc::home::prepare_codex_home has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 2 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox_service::ipc::authentication::authenticate_impersonated_client (cognitive 19) codex-rs/windows-sandbox-service/src/ipc/authentication.rs:74 — codex_windows_sandbox_service::ipc::authentication::authenticate_impersonated_client has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 1 (2 pts), match/switch 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_windows_sandbox_service::machine_policy::validate_requirements (cognitive 19) codex-rs/windows-sandbox-service/src/machine_policy.rs:106 — codex_windows_sandbox_service::machine_policy::validate_requirements has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_windows_sandbox_service::service::runtime_lifecycle::run (cognitive 16) codex-rs/windows-sandbox-service/src/service/runtime_lifecycle.rs:55 — codex_windows_sandbox_service::service::runtime_lifecycle::run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_app_server_transport · ×7
  • codex_app_server_transport::transport::websocket::run_websocket_outbound_loop (cognitive 29) codex-rs/app-server-transport/src/transport/websocket.rs:350 — codex_app_server_transport::transport::websocket::run_websocket_outbound_loop has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (22 pts), match/switch 2 (6 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server_transport::transport::stdio::start_stdio_connection (cognitive 28) codex-rs/app-server-transport/src/transport/stdio.rs:28 — codex_app_server_transport::transport::stdio::start_stdio_connection has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 4, boolean chains 3, match/switch 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server_transport::transport::unix_socket::run_control_socket_acceptor (cognitive 23) codex-rs/app-server-transport/src/transport/unix_socket.rs:148 — codex_app_server_transport::transport::unix_socket::run_control_socket_acceptor has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 3 (7 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server_transport::transport::websocket::run_websocket_inbound_loop (cognitive 21) codex-rs/app-server-transport/src/transport/websocket.rs:403 — codex_app_server_transport::transport::websocket::run_websocket_inbound_loop has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 3 (8 pts), loops 1 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_app_server_transport::transport::remote_control::controller::start_remote_control (cognitive 20) codex-rs/app-server-transport/src/transport/remote_control/controller.rs:265 — codex_app_server_transport::transport::remote_control::controller::start_remote_control has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 5 (8 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_app_server_transport::transport::remote_control::segment::split_server_envelope_for_transport (cognitive 18) codex-rs/app-server-transport/src/transport/remote_control/segment.rs:301 — codex_app_server_transport::transport::remote_control::segment::split_server_envelope_for_transport has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_app_server_transport::transport::remote_control::websocket::prepare_remote_control_enrollment (cognitive 16) codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:1534 — codex_app_server_transport::transport::remote_control::websocket::prepare_remote_control_enrollment has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 · Dependency Vulnerabilities · Medium CVE · ×7
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×7
  • Duplicated block (14–15 lines × 2) codex-rs/core/src/plugins/mentions.rs:42 — codex-rs/core/src/plugins/mentions.rs:42-55 | codex-rs/core/src/plugins/mentions.rs:84-98 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–15 lines × 2) codex-rs/core/src/tools/orchestrator.rs:367 — codex-rs/core/src/tools/orchestrator.rs:367-380 | codex-rs/core/src/tools/orchestrator.rs:562-576 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–15 lines × 2) codex-rs/ext/skills/src/dynamic_skill_selector/lru_plus_character_routing.rs:50 — codex-rs/ext/skills/src/dynamic_skill_selector/lru_plus_character_routing.rs:50-64 | codex-rs/ext/skills/src/dynamic_skill_selector/lru_plus_lexical.rs:42-55 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (14–15 lines × 2) codex-rs/external-agent-migration/src/sessions/records_cla.rs:65 — codex-rs/external-agent-migration/src/sessions/records_cla.rs:65-78 | codex-rs/external-agent-migration/src/sessions/records_cur.rs:52-66 — before extracting anything, compare `codex-rs/external-agent-migration/src/sessions/records_cla.rs` and `codex-rs/external-agent-migration/src/sessions/records_cur.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 104 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14–15 lines × 2) codex-rs/linux-sandbox/src/bundled_bwrap.rs:83 — codex-rs/linux-sandbox/src/bundled_bwrap.rs:83-97 | codex-rs/linux-sandbox/src/launcher.rs:233-246 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (14–15 lines × 2) codex-rs/tui/src/markdown_render.rs:2021 — codex-rs/tui/src/markdown_render.rs:2021-2034 | codex-rs/tui/src/markdown_render/table_key_value.rs:273-287 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14–15 lines × 2) codex-rs/tui/src/session_archive_commands.rs:289 — codex-rs/tui/src/session_archive_commands.rs:289-303 | codex-rs/tui/src/startup_orchestration.rs:363-376 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×7
  • Duplicated block (8–9 lines × 2) codex-rs/app-server/src/fuzzy_file_search.rs:30 — codex-rs/app-server/src/fuzzy_file_search.rs:30-38 | codex-rs/app-server/src/fuzzy_file_search.rs:123-130 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–9 lines × 2) codex-rs/codex-mcp/src/tools.rs:157 — codex-rs/codex-mcp/src/tools.rs:157-164 | codex-rs/codex-mcp/src/tools.rs:179-187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–9 lines × 2) codex-rs/core/src/turn_diff_tracker.rs:214 — codex-rs/core/src/turn_diff_tracker.rs:214-221 | codex-rs/core/src/turn_diff_tracker.rs:254-262 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–9 lines × 2) codex-rs/rollout/src/search.rs:341 — codex-rs/rollout/src/search.rs:341-348 | codex-rs/state/src/extract.rs:69-77 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8–9 lines × 2) codex-rs/tui/src/onboarding/auth.rs:547 — codex-rs/tui/src/onboarding/auth.rs:547-555 | codex-rs/tui/src/onboarding/auth.rs:751-758 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–9 lines × 2) codex-rs/tui/src/tui/event_stream.rs:226 — codex-rs/tui/src/tui/event_stream.rs:226-233 | codex-rs/tui/src/tui/event_stream.rs:242-250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–9 lines × 2) codex-rs/windows-sandbox-rs/src/acl.rs:185 — codex-rs/windows-sandbox-rs/src/acl.rs:185-193 | codex-rs/windows-sandbox-rs/src/acl.rs:377-384 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
X3 · Exception handling · Swallowed exception (empty catch) · ×7
  • Swallowed exception (empty catch) sdk/typescript/src/exec.ts:261 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) sdk/typescript/src/outputSchemaFile.ts:24 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) sdk/python/src/openai_codex/client.py:576 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) sdk/python/src/openai_codex/client.py:594 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) sdk/python/src/openai_codex/client.py:596 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) codex-rs/windows-sandbox-rs/sandbox_smoketests.py:146 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) codex-rs/windows-sandbox-rs/sandbox_smoketests.py:899 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
D1 · Cyclomatic Complexity · codex_mermaid · ×6
  • codex_mermaid::relations::parse (cyclomatic 62) codex-rs/mermaid/src/relations.rs:11 — codex_mermaid::relations::parse has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_mermaid::sequence::render (cyclomatic 45) codex-rs/mermaid/src/sequence.rs:31 — codex_mermaid::sequence::render has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_mermaid::draw::render (cyclomatic 33) codex-rs/mermaid/src/draw.rs:16 — codex_mermaid::draw::render has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_mermaid::syntax::statements (cyclomatic 25) codex-rs/mermaid/src/syntax.rs:9 — codex_mermaid::syntax::statements has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • codex_mermaid::state::parse (cyclomatic 20) codex-rs/mermaid/src/state.rs:12 — codex_mermaid::state::parse has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_mermaid::parse::parse (cyclomatic 17) codex-rs/mermaid/src/parse.rs:15 — codex_mermaid::parse::parse has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_hooks · ×6
  • codex_hooks::engine::discovery::append_matcher_groups (cyclomatic 33) codex-rs/hooks/src/engine/discovery.rs:623 — codex_hooks::engine::discovery::append_matcher_groups has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_hooks::events::stop::parse_completed (cyclomatic 24) codex-rs/hooks/src/events/stop.rs:237 — codex_hooks::events::stop::parse_completed has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_hooks::events::post_tool_use::parse_completed (cyclomatic 20) codex-rs/hooks/src/events/post_tool_use.rs:173 — codex_hooks::events::post_tool_use::parse_completed has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_hooks::events::user_prompt_submit::parse_completed (cyclomatic 19) codex-rs/hooks/src/events/user_prompt_submit.rs:138 — codex_hooks::events::user_prompt_submit::parse_completed has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_hooks::events::pre_tool_use::parse_completed (cyclomatic 16) codex-rs/hooks/src/events/pre_tool_use.rs:199 — codex_hooks::events::pre_tool_use::parse_completed has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_hooks::events::session_start::parse_completed (cyclomatic 16) codex-rs/hooks/src/events/session_start.rs:224 — codex_hooks::events::session_start::parse_completed has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_external_agent_migration · ×6
  • codex_external_agent_migration::detect::sessions::cur::decode_cur_project_path (cyclomatic 25) codex-rs/external-agent-migration/src/detect/sessions/cur.rs:100 — codex_external_agent_migration::detect::sessions::cur::decode_cur_project_path has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_external_agent_migration::hooks_cla::append_convertible_hook_groups_cla (cyclomatic 22) codex-rs/external-agent-migration/src/hooks_cla.rs:100 — codex_external_agent_migration::hooks_cla::append_convertible_hook_groups_cla has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_external_agent_migration::detect::sessions::common::detect_recent_sessions (cyclomatic 21) codex-rs/external-agent-migration/src/detect/sessions/common.rs:22 — codex_external_agent_migration::detect::sessions::common::detect_recent_sessions has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_external_agent_migration::sessions::append::append_existing_session (cyclomatic 20) codex-rs/external-agent-migration/src/sessions/append.rs:30 — codex_external_agent_migration::sessions::append::append_existing_session has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_external_agent_migration::hooks_cur::hook_migration_cur (cyclomatic 16) codex-rs/external-agent-migration/src/hooks_cur.rs:42 — codex_external_agent_migration::hooks_cur::hook_migration_cur has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_external_agent_migration::sessions::records_cla::summarize_session (cyclomatic 16) codex-rs/external-agent-migration/src/sessions/records_cla.rs:23 — codex_external_agent_migration::sessions::records_cla::summarize_session has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · codex_mermaid · ×6
  • codex_mermaid::relations::parse (cognitive 104) codex-rs/mermaid/src/relations.rs:11 — codex_mermaid::relations::parse has cognitive complexity 104 (threshold 15). Drivers by points: if/else 31 (70 pts), boolean chains 19, match/switch 4 (11 pts), loops 2 (4 pts) (nesting depth added 48). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • codex_mermaid::sequence::render (cognitive 104) codex-rs/mermaid/src/sequence.rs:31 — codex_mermaid::sequence::render has cognitive complexity 104 (threshold 15). Drivers by points: if/else 38 (78 pts), loops 9 (20 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_mermaid::draw::render (cognitive 67) codex-rs/mermaid/src/draw.rs:16 — codex_mermaid::draw::render has cognitive complexity 67 (threshold 15). Drivers by points: if/else 33 (45 pts), loops 12 (20 pts), match/switch 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_mermaid::parse::parse (cognitive 39) codex-rs/mermaid/src/parse.rs:15 — codex_mermaid::parse::parse has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 4 (10 pts), boolean chains 2, match/switch 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_mermaid::state::parse (cognitive 39) codex-rs/mermaid/src/state.rs:12 — codex_mermaid::state::parse has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (35 pts), boolean chains 3, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_mermaid::syntax::statements (cognitive 31) codex-rs/mermaid/src/syntax.rs:9 — codex_mermaid::syntax::statements has cognitive complexity 31 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (10 pts), boolean chains 8, loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_api · ×6
  • codex_api::endpoint::responses_websocket::run_websocket_response_stream (cognitive 86) codex-rs/codex-api/src/endpoint/responses_websocket.rs:708 — codex_api::endpoint::responses_websocket::run_websocket_response_stream has cognitive complexity 86 (threshold 15). Drivers by points: if/else 20 (61 pts), match/switch 6 (15 pts), boolean chains 9, loops 1 (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_api::api_bridge::map_api_error_details (cognitive 58) codex-rs/codex-api/src/api_bridge.rs:52 — codex_api::api_bridge::map_api_error_details has cognitive complexity 58 (threshold 15). Drivers by points: if/else 20 (46 pts), match/switch 3 (7 pts), boolean chains 5 (nesting depth added 30). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_api::sse::responses::process_responses_event (cognitive 49) codex-rs/codex-api/src/sse/responses.rs:345 — codex_api::sse::responses::process_responses_event has cognitive complexity 49 (threshold 15). Drivers by points: if/else 19 (45 pts), match/switch 2 (4 pts) (nesting depth added 28). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_api::files::upload_openai_file (cognitive 43) codex-rs/codex-api/src/files.rs:129 — codex_api::files::upload_openai_file has cognitive complexity 43 (threshold 15). Drivers by points: if/else 18 (31 pts), match/switch 4 (8 pts), boolean chains 2, loops 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_api::sse::responses::process_sse_with_treatment (cognitive 36) codex-rs/codex-api/src/sse/responses.rs:543 — codex_api::sse::responses::process_sse_with_treatment has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 5 (11 pts), boolean chains 4, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_api::endpoint::realtime_websocket::methods::websocket_url_from_api_url (cognitive 22) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:1328 — codex_api::endpoint::realtime_websocket::methods::websocket_url_from_api_url has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, loops 1 (3 pts), match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_linux_sandbox · ×6
  • codex_linux_sandbox::bwrap::create_filesystem_args (cognitive 70) REDACTED:409 — codex_linux_sandbox::bwrap::create_filesystem_args has cognitive complexity 70 (threshold 15). Drivers by points: if/else 25 (48 pts), loops 7 (11 pts), boolean chains 10, match/switch 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_linux_sandbox::linux_run_main::run_main (cognitive 49) codex-rs/linux-sandbox/src/linux_run_main.rs:135 — codex_linux_sandbox::linux_run_main::run_main has cognitive complexity 49 (threshold 15). Drivers by points: if/else 21 (39 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_linux_sandbox::daemon_mounts::check_mounts (cognitive 39) codex-rs/linux-sandbox/src/daemon_mounts.rs:63 — codex_linux_sandbox::daemon_mounts::check_mounts has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 10, loops 3 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_linux_sandbox::proxy_lifecycle::detach_bridge_stdio (cognitive 22) codex-rs/linux-sandbox/src/proxy_lifecycle.rs:133 — codex_linux_sandbox::proxy_lifecycle::detach_bridge_stdio has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_linux_sandbox::bwrap::expand_unreadable_globs_with_ripgrep (cognitive 18) REDACTED:879 — codex_linux_sandbox::bwrap::expand_unreadable_globs_with_ripgrep has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (4 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_linux_sandbox::proxy_routing::activate_proxy_routes_in_netns (cognitive 17) codex-rs/linux-sandbox/src/proxy_routing.rs:131 — codex_linux_sandbox::proxy_routing::activate_proxy_routes_in_netns has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnalyticsReducer · ×6
  • AnalyticsReducer::ingest_notification (cognitive 63) codex-rs/analytics/src/reducer.rs:2038 — AnalyticsReducer::ingest_notification has cognitive complexity 63 (threshold 15). Drivers by points: if/else 26 (53 pts), boolean chains 5, match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 29). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • AnalyticsReducer::ingest_server_request (cognitive 32) codex-rs/analytics/src/reducer.rs:1741 — AnalyticsReducer::ingest_server_request has cognitive complexity 32 (threshold 15). Drivers by points: if/else 19 (27 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • AnalyticsReducer::ingest (cognitive 22) codex-rs/analytics/src/reducer.rs:603 — AnalyticsReducer::ingest has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 3 (6 pts) (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • AnalyticsReducer::ingest_code_mode_tool_call (cognitive 19) codex-rs/analytics/src/reducer.rs:896 — AnalyticsReducer::ingest_code_mode_tool_call has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 3 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AnalyticsReducer::ingest_sampling_response_completed (cognitive 18) codex-rs/analytics/src/reducer.rs:1143 — AnalyticsReducer::ingest_sampling_response_completed has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AnalyticsReducer::ingest_skill_invoked (cognitive 18) codex-rs/analytics/src/reducer.rs:1433 — AnalyticsReducer::ingest_skill_invoked has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 3 (6 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_mcp · ×6
  • codex_mcp::mcp::auth::compute_auth_status (cognitive 32) codex-rs/codex-mcp/src/mcp/auth.rs:257 — codex_mcp::mcp::auth::compute_auth_status has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (20 pts), match/switch 4 (8 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_mcp::rmcp_client::make_rmcp_client (cognitive 28) codex-rs/codex-mcp/src/rmcp_client.rs:1403 — codex_mcp::rmcp_client::make_rmcp_client has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 4, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_mcp::codex_apps::file_params::openai_file_schema_info (cognitive 22) codex-rs/codex-mcp/src/codex_apps/file_params.rs:95 — codex_mcp::codex_apps::file_params::openai_file_schema_info has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_mcp::agent_plugin_config::resolve_existing_path_prefix (cognitive 18) codex-rs/codex-mcp/src/agent_plugin_config.rs:431 — codex_mcp::agent_plugin_config::resolve_existing_path_prefix has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_mcp::rmcp_client::add_plugin_provenance_to_tool (cognitive 18) codex-rs/codex-mcp/src/rmcp_client.rs:904 — codex_mcp::rmcp_client::add_plugin_provenance_to_tool has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (17 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_mcp::rmcp_client::start_server_task (cognitive 16) codex-rs/codex-mcp/src/rmcp_client.rs:1111 — codex_mcp::rmcp_client::start_server_task has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 4, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×6
  • Duplicated block (13–14 lines × 2) codex-rs/app-server/src/request_processors/command_exec_processor.rs:157 — codex-rs/app-server/src/request_processors/command_exec_processor.rs:157-170 | codex-rs/app-server/src/request_processors/process_exec_processor.rs:99-111 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (13–14 lines × 2) codex-rs/core/src/exec.rs:377 — codex-rs/core/src/exec.rs:377-389 | codex-rs/core/src/exec.rs:945-958 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–14 lines × 2) codex-rs/core/src/guardian/review_session.rs:855 — codex-rs/core/src/guardian/review_session.rs:855-868 | codex-rs/core/src/guardian/review_session.rs:898-910 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–14 lines × 2) codex-rs/tui/src/bottom_pane/list_selection_view.rs:1149 — codex-rs/tui/src/bottom_pane/list_selection_view.rs:1149-1162 | codex-rs/tui/src/bottom_pane/list_selection_view.rs:1170-1182 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–14 lines × 2) codex-rs/tui/src/bottom_pane/textarea.rs:1839 — codex-rs/tui/src/bottom_pane/textarea.rs:1839-1851 | codex-rs/tui/src/bottom_pane/textarea.rs:1856-1869 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–14 lines × 2) codex-rs/tui/src/cwd_prompt.rs:129 — codex-rs/tui/src/cwd_prompt.rs:129-142 | codex-rs/tui/src/update_prompt.rs:64-76 — before extracting anything, compare `codex-rs/tui/src/cwd_prompt.rs` and `codex-rs/tui/src/update_prompt.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×6
  • Duplicated block (9 lines × 3) codex-rs/core-plugins/src/command_migration/render.rs:49 — codex-rs/core-plugins/src/command_migration/render.rs:49-57 | codex-rs/external-agent-migration/src/rewrite.rs:93-101 | codex-rs/external-agent-migration/src/rewrite.rs:132-140 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (9 lines × 3) codex-rs/core-plugins/src/marketplace_upgrade/git.rs:196 — codex-rs/core-plugins/src/marketplace_upgrade/git.rs:196-204 | codex-rs/core-plugins/src/startup_sync.rs:697-705 | codex-rs/core-plugins/src/startup_sync.rs:708-716 — before extracting anything, compare `codex-rs/core-plugins/src/marketplace_upgrade/git.rs` and `codex-rs/core-plugins/src/startup_sync.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 3) codex-rs/tui/src/bottom_pane/app_link_view.rs:428 — codex-rs/tui/src/bottom_pane/app_link_view.rs:428-436 | codex-rs/tui/src/bottom_pane/app_link_view.rs:438-446 | codex-rs/tui/src/bottom_pane/app_link_view.rs:448-456 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) codex-rs/core/src/config/edit.rs:920 — codex-rs/core/src/config/edit.rs:920-928 | codex-rs/core/src/config/edit.rs:932-940 | codex-rs/core/src/config/edit.rs:944-952 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) codex-rs/hooks/src/events/permission_request.rs:252 — codex-rs/hooks/src/events/permission_request.rs:252-260 | codex-rs/hooks/src/events/post_tool_use.rs:257-265 | codex-rs/hooks/src/events/pre_tool_use.rs:261-269 — before extracting anything, compare `codex-rs/hooks/src/events/permission_request.rs` and `codex-rs/hooks/src/events/post_tool_use.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 3) scripts/mcp_conformance/review_regressions.py:887 — scripts/mcp_conformance/review_regressions.py:887-895 | scripts/mcp_conformance/review_regressions.py:941-949 | scripts/mcp_conformance/run_codex_compliance.py:1595-1603 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D1 · Cyclomatic Complexity · LocalAgentControl · ×5
  • LocalAgentControl::prepare_forked_history (cyclomatic 53) codex-rs/core/src/agent/control/spawn.rs:1059 — LocalAgentControl::prepare_forked_history has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LocalAgentControl::ensure_v2_agent_loaded (cyclomatic 39) codex-rs/core/src/agent/control/spawn.rs:325 — LocalAgentControl::ensure_v2_agent_loaded has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LocalAgentControl::root_user_authorization (cyclomatic 36) codex-rs/core/src/agent/control/user_authorization.rs:48 — LocalAgentControl::root_user_authorization has cyclomatic complexity 36 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • LocalAgentControl::spawn_agent_internal (cyclomatic 23) codex-rs/core/src/agent/control/spawn.rs:720 — LocalAgentControl::spawn_agent_internal has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • LocalAgentControl::maybe_start_completion_watcher (cyclomatic 22) codex-rs/core/src/agent/control.rs:471 — LocalAgentControl::maybe_start_completion_watcher has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_api · ×5
  • codex_api::api_bridge::map_api_error_details (cyclomatic 48) codex-rs/codex-api/src/api_bridge.rs:52 — codex_api::api_bridge::map_api_error_details has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_api::endpoint::responses_websocket::run_websocket_response_stream (cyclomatic 43) codex-rs/codex-api/src/endpoint/responses_websocket.rs:708 — codex_api::endpoint::responses_websocket::run_websocket_response_stream has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_api::sse::responses::process_responses_event (cyclomatic 34) codex-rs/codex-api/src/sse/responses.rs:345 — codex_api::sse::responses::process_responses_event has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_api::files::upload_openai_file (cyclomatic 25) codex-rs/codex-api/src/files.rs:129 — codex_api::files::upload_openai_file has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_api::sse::responses::process_sse_with_treatment (cyclomatic 23) codex-rs/codex-api/src/sse/responses.rs:543 — codex_api::sse::responses::process_sse_with_treatment has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TextArea · ×5
  • TextArea::apply_vim_editor_action (cyclomatic 46) codex-rs/tui/src/bottom_pane/textarea/vim_commands.rs:334 — TextArea::apply_vim_editor_action has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TextArea::handle_vim_normal (cyclomatic 31) codex-rs/tui/src/bottom_pane/textarea.rs:818 — TextArea::handle_vim_normal has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • TextArea::input_with_keymap (cyclomatic 22) codex-rs/tui/src/bottom_pane/textarea.rs:652 — TextArea::input_with_keymap has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • TextArea::handle_mouse (cyclomatic 18) codex-rs/tui/src/bottom_pane/textarea/mouse.rs:105 — TextArea::handle_mouse has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • TextArea::apply_vim_operator (cyclomatic 16) codex-rs/tui/src/bottom_pane/textarea.rs:1069 — TextArea::apply_vim_operator has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_rollout · ×5
  • codex_rollout::metadata::backfill_sessions_with_lease (cyclomatic 31) codex-rs/rollout/src/metadata.rs:199 — codex_rollout::metadata::backfill_sessions_with_lease has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_rollout::list::read_head_summary (cyclomatic 28) codex-rs/rollout/src/list.rs:977 — codex_rollout::list::read_head_summary has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_rollout::compression::worker::compress_rollouts_in_root (cyclomatic 18) codex-rs/rollout/src/compression.rs:591 — codex_rollout::compression::worker::compress_rollouts_in_root has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_rollout::list::find_thread_path_by_id_str_in_subdir (cyclomatic 18) codex-rs/rollout/src/list.rs:1260 — codex_rollout::list::find_thread_path_by_id_str_in_subdir has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_rollout::recorder::fill_missing_thread_item_metadata (cyclomatic 17) codex-rs/rollout/src/recorder.rs:1418 — codex_rollout::recorder::fill_missing_thread_item_metadata has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · codex_sandboxing · ×5
  • codex_sandboxing::seatbelt::seatbelt_regex_for_glob (cyclomatic 26) REDACTED:719 — codex_sandboxing::seatbelt::seatbelt_regex_for_glob has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_sandboxing::bwrap::find_executable_in_search_paths (cyclomatic 21) codex-rs/sandboxing/src/bwrap.rs:210 — codex_sandboxing::bwrap::find_executable_in_search_paths has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_sandboxing::windows::resolve_windows_restricted_token_filesystem_overrides (cyclomatic 19) codex-rs/sandboxing/src/windows.rs:74 — codex_sandboxing::windows::resolve_windows_restricted_token_filesystem_overrides has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_sandboxing::seatbelt::create_seatbelt_command_args_with_profile (cyclomatic 18) REDACTED:878 — codex_sandboxing::seatbelt::create_seatbelt_command_args_with_profile has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_sandboxing::windows::resolve_windows_elevated_filesystem_overrides (cyclomatic 16) codex-rs/sandboxing/src/windows.rs:215 — codex_sandboxing::windows::resolve_windows_elevated_filesystem_overrides has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Writer · ×5
  • Writer::start_tag (cyclomatic 26) codex-rs/tui/src/markdown_render.rs:648 — Writer::start_tag has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Writer::handle_event (cyclomatic 20) codex-rs/tui/src/markdown_render.rs:561 — Writer::handle_event has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Writer::end_tag (cyclomatic 20) codex-rs/tui/src/markdown_render.rs:733 — Writer::end_tag has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Writer::pop_link (cyclomatic 18) codex-rs/tui/src/markdown_render.rs:2211 — Writer::pop_link has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Writer::render_table_row (cyclomatic 16) codex-rs/tui/src/markdown_render.rs:1807 — Writer::render_table_row has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · AgentsOverviewView · ×5
  • AgentsOverviewView::render_center_rows (cognitive 77) codex-rs/tui/src/app/agent_center/rows.rs:38 — AgentsOverviewView::render_center_rows has cognitive complexity 77 (threshold 15). Drivers by points: if/else 39 (62 pts), boolean chains 7, match/switch 3 (7 pts), loops 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AgentsOverviewView::handle_key_event (cognitive 65) codex-rs/tui/src/app/agents_overview_view.rs:628 — AgentsOverviewView::handle_key_event has cognitive complexity 65 (threshold 15). Drivers by points: if/else 32 (50 pts), boolean chains 8, match/switch 3 (6 pts), loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AgentsOverviewView::render (cognitive 21) codex-rs/tui/src/app/agent_center/render.rs:126 — AgentsOverviewView::render has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 3, match/switch 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • AgentsOverviewView::command_center_key (cognitive 17) codex-rs/tui/src/app/agent_center/input.rs:53 — AgentsOverviewView::command_center_key has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • AgentsOverviewView::center_footer_hints (cognitive 16) codex-rs/tui/src/app/agent_center/hints.rs:130 — AgentsOverviewView::center_footer_hints has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · RemoteControlWebsocket · ×5
  • RemoteControlWebsocket::connect (cognitive 51) codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:696 — RemoteControlWebsocket::connect has cognitive complexity 51 (threshold 15). Drivers by points: if/else 10 (32 pts), match/switch 7 (18 pts), loops 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RemoteControlWebsocket::run_server_writer_inner (cognitive 40) codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:978 — RemoteControlWebsocket::run_server_writer_inner has cognitive complexity 40 (threshold 15). Drivers by points: match/switch 8 (18 pts), if/else 5 (16 pts), loops 4 (6 pts) (nesting depth added 23). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • RemoteControlWebsocket::run_websocket_reader_inner (cognitive 34) codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:1138 — RemoteControlWebsocket::run_websocket_reader_inner has cognitive complexity 34 (threshold 15). Drivers by points: match/switch 6 (15 pts), if/else 6 (14 pts), loops 2 (5 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RemoteControlWebsocket::run (cognitive 24) codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:459 — RemoteControlWebsocket::run has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 4 (8 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RemoteControlWebsocket::resolve_unknown_desired_state (cognitive 17) codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:597 — RemoteControlWebsocket::resolve_unknown_desired_state has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 4 (7 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_login · ×5
  • codex_login::server::process_request (cognitive 31) codex-rs/login/src/server.rs:345 — codex_login::server::process_request has cognitive complexity 31 (threshold 15). Drivers by points: match/switch 8 (18 pts), if/else 5 (11 pts), boolean chains 2 (nesting depth added 16). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_login::server::bind_server (cognitive 26) codex-rs/login/src/server.rs:627 — codex_login::server::bind_server has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (21 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_login::server::run_login_server (cognitive 21) codex-rs/login/src/server.rs:178 — codex_login::server::run_login_server has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 3 (7 pts), loops 2 (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_login::auth::manager::enforce_login_restrictions_with_agent_identity_authapi_base_url (cognitive 19) codex-rs/login/src/auth/manager.rs:1368 — codex_login::auth::manager::enforce_login_restrictions_with_agent_identity_authapi_base_url has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (10 pts), if/else 6 (8 pts), boolean chains 1 (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_login::auth::manager::load_auth (cognitive 17) codex-rs/login/src/auth/manager.rs:1531 — codex_login::auth::manager::load_auth has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · codex_utils_pty · ×5
  • codex_utils_pty::linux_fds::close_from_proc (cognitive 22) codex-rs/utils/pty/src/linux_fds.rs:64 — codex_utils_pty::linux_fds::close_from_proc has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_utils_pty::process_group::signal_process_group_with_member_fallback (cognitive 21) codex-rs/utils/pty/src/process_group.rs:152 — codex_utils_pty::process_group::signal_process_group_with_member_fallback has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 2 (3 pts), loops 2, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_utils_pty::pipe::spawn_process_with_stdin_mode (cognitive 19) codex-rs/utils/pty/src/pipe.rs:133 — codex_utils_pty::pipe::spawn_process_with_stdin_mode has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), match/switch 5, loops 1 (2 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_utils_pty::child_reaper::sender (cognitive 18) codex-rs/utils/pty/src/child_reaper.rs:26 — codex_utils_pty::child_reaper::sender has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 3 (8 pts), if/else 4 (7 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_utils_pty::pty::close_inherited_fds_except (cognitive 18) codex-rs/utils/pty/src/pty.rs:612 — codex_utils_pty::pty::close_inherited_fds_except has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (29 lines × 2) · ×5
  • Duplicated block (29 lines × 2) codex-rs/app-server/src/command_exec.rs:270 — codex-rs/app-server/src/command_exec.rs:270-298 | codex-rs/app-server/src/request_processors/process_exec_processor.rs:309-337 — before extracting anything, compare `codex-rs/app-server/src/command_exec.rs` and `codex-rs/app-server/src/request_processors/process_exec_processor.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (29 lines × 2) codex-rs/app-server/src/lib.rs:395 — codex-rs/app-server/src/lib.rs:395-423 | codex-rs/tui/src/app/startup_prompts.rs:70-98 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (29 lines × 2) codex-rs/config/src/config_requirements.rs:1400 — codex-rs/config/src/config_requirements.rs:1400-1428 | codex-rs/ext/guardian-v2/src/async_scorer/classification.rs:121-149 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (29 lines × 2) codex-rs/external-agent-migration/src/sessions/records_cla.rs:201 — codex-rs/external-agent-migration/src/sessions/records_cla.rs:201-229 | codex-rs/external-agent-migration/src/sessions/records_cur.rs:166-194 — before extracting anything, compare `codex-rs/external-agent-migration/src/sessions/records_cla.rs` and `codex-rs/external-agent-migration/src/sessions/records_cur.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 104 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (29 lines × 2) codex-rs/state/src/runtime/memories.rs:882 — codex-rs/state/src/runtime/memories.rs:882-910 | codex-rs/state/src/runtime/memories.rs:959-987 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×5
  • Duplicated block (22 lines × 2) codex-rs/app-server-client/src/lib.rs:255 — codex-rs/app-server-client/src/lib.rs:255-276 | codex-rs/app-server-client/src/remote.rs:97-118 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (22 lines × 2) codex-rs/rollout-trace/src/reducer/conversation.rs:274 — codex-rs/rollout-trace/src/reducer/conversation.rs:274-295 | codex-rs/rollout-trace/src/reducer/conversation.rs:400-421 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22 lines × 2) codex-rs/rollout/src/list.rs:566 — codex-rs/rollout/src/list.rs:566-587 | codex-rs/rollout/src/list.rs:688-709 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22 lines × 2) codex-rs/rollout/src/recorder.rs:711 — codex-rs/rollout/src/recorder.rs:711-732 | codex-rs/rollout/src/recorder.rs:753-774 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22 lines × 2) codex-rs/tui/src/bottom_pane/multi_select_picker.rs:520 — codex-rs/tui/src/bottom_pane/multi_select_picker.rs:520-541 | codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:206-227 — before extracting anything, compare `codex-rs/tui/src/bottom_pane/multi_select_picker.rs` and `codex-rs/tui/src/bottom_pane/skills_toggle_view.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 97 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×5
  • Duplicated block (6 lines × 3) codex-rs/core/src/session/mcp.rs:746 — codex-rs/core/src/session/mcp.rs:746-751 | codex-rs/core/src/session/mod.rs:3078-3083 | codex-rs/core/src/session/mod.rs:3322-3327 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6 lines × 3) codex-rs/tui/src/bottom_pane/textarea.rs:2201 — codex-rs/tui/src/bottom_pane/textarea.rs:2201-2206 | codex-rs/tui/src/bottom_pane/textarea.rs:2220-2225 | codex-rs/tui/src/bottom_pane/textarea.rs:2242-2247 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) codex-rs/codex-mcp/src/tools.rs:236 — codex-rs/codex-mcp/src/tools.rs:236-241 | codex-rs/connectors/src/connector_runtime/persistence.rs:227-232 | codex-rs/connectors/src/directory_cache.rs:108-113 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (6 lines × 3) codex-rs/core/src/agent/control.rs:762 — codex-rs/core/src/agent/control.rs:762-767 | codex-rs/tui/src/app/app_server_thread_ownership.rs:51-58 | codex-rs/tui/src/app/loaded_threads.rs:115-122 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (6 lines × 3) codex-rs/network-proxy/src/http_proxy.rs:908 — codex-rs/network-proxy/src/http_proxy.rs:908-913 | codex-rs/network-proxy/src/socks5.rs:309-314 | codex-rs/network-proxy/src/socks5.rs:754-759 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
P7 · Outbound HTTP resilience · Outbound HTTP without resilience · ×5
  • Outbound HTTP without resilience codex-rs/http-client/src/client_builder.rs:356 — `reqwest::Client::new(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience codex-rs/http-client/src/client_builder.rs:382 — `reqwest::Client::builder(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience REDACTED:163 — `urllib.request.urlopen(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience REDACTED:191 — `urllib.request.urlopen(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience REDACTED:223 — `urllib.request.urlopen(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
D1 · Cyclomatic Complexity · codex_cloud_tasks · ×4
  • codex_cloud_tasks::run_main (cyclomatic 222) codex-rs/cloud-tasks/src/lib.rs:753 — codex_cloud_tasks::run_main has cyclomatic complexity 222 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_cloud_tasks::ui::draw_diff_overlay (cyclomatic 21) codex-rs/cloud-tasks/src/ui.rs:312 — codex_cloud_tasks::ui::draw_diff_overlay has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_cloud_tasks::pretty_lines_from_error (cyclomatic 19) codex-rs/cloud-tasks/src/lib.rs:2078 — codex_cloud_tasks::pretty_lines_from_error has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_cloud_tasks::env_detect::list_environments_with_origins (cyclomatic 17) codex-rs/cloud-tasks/src/env_detect.rs:317 — codex_cloud_tasks::env_detect::list_environments_with_origins has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ContextManager · ×4
  • ContextManager::reconstruct_rollout (cyclomatic 57) codex-rs/core/src/session/rollout_reconstruction.rs:208 — ContextManager::reconstruct_rollout has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ContextManager::restore_review_context (cyclomatic 21) codex-rs/core/src/context_manager/history.rs:318 — ContextManager::restore_review_context has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • ContextManager::record_retained_message (cyclomatic 18) codex-rs/core/src/context_manager/history_user_authorization.rs:105 — ContextManager::record_retained_message has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • ContextManager::drop_last_n_user_turns (cyclomatic 17) codex-rs/core/src/context_manager/history.rs:777 — ContextManager::drop_last_n_user_turns has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: codex_core::context_manager::history::estimate_response_item_model_visible_bytes (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · codex_exec · ×4
  • codex_exec::run_exec_session (cyclomatic 48) codex-rs/exec/src/lib.rs:855 — codex_exec::run_exec_session has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_exec::run_main (cyclomatic 39) codex-rs/exec/src/lib.rs:266 — codex_exec::run_main has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_exec::should_process_notification (cyclomatic 29) codex-rs/exec/src/lib.rs:1674 — codex_exec::should_process_notification has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_exec::resolve_resume_thread_id (cyclomatic 25) codex-rs/exec/src/lib.rs:1858 — codex_exec::resolve_resume_thread_id has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AnalyticsReducer · ×4
  • AnalyticsReducer::ingest (cyclomatic 47) codex-rs/analytics/src/reducer.rs:603 — AnalyticsReducer::ingest has cyclomatic complexity 47 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • AnalyticsReducer::ingest_notification (cyclomatic 43) codex-rs/analytics/src/reducer.rs:2038 — AnalyticsReducer::ingest_notification has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AnalyticsReducer::ingest_server_request (cyclomatic 21) codex-rs/analytics/src/reducer.rs:1741 — AnalyticsReducer::ingest_server_request has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AnalyticsReducer::ingest_code_mode_tool_call (cyclomatic 16) codex-rs/analytics/src/reducer.rs:896 — AnalyticsReducer::ingest_code_mode_tool_call has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MathParser · ×4
  • MathParser::command (cyclomatic 43) codex-rs/tui/src/markdown_render/math/render.rs:206 — MathParser::command has cyclomatic complexity 43 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: codex_tui::markdown_render::math::render::symbol (cyclomatic 124) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • MathParser::aligned (cyclomatic 22) codex-rs/tui/src/markdown_render/math/render/structured.rs:166 — MathParser::aligned has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MathParser::structured_command (cyclomatic 17) codex-rs/tui/src/markdown_render/math/render/structured.rs:85 — MathParser::structured_command has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • MathParser::sequence (cyclomatic 16) codex-rs/tui/src/markdown_render/math/render.rs:99 — MathParser::sequence has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: codex_tui::markdown_render::math::render::symbol (cyclomatic 124) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · RemoteControlWebsocket · ×4
  • RemoteControlWebsocket::connect (cyclomatic 22) codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:696 — RemoteControlWebsocket::connect has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • RemoteControlWebsocket::run_websocket_reader_inner (cyclomatic 21) codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:1138 — RemoteControlWebsocket::run_websocket_reader_inner has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • RemoteControlWebsocket::run_server_writer_inner (cyclomatic 20) codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:978 — RemoteControlWebsocket::run_server_writer_inner has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • RemoteControlWebsocket::run (cyclomatic 16) codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:459 — RemoteControlWebsocket::run has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_core_plugins · ×4
  • codex_core_plugins::remote::fetch_remote_marketplaces (cyclomatic 19) codex-rs/core-plugins/src/remote.rs:820 — codex_core_plugins::remote::fetch_remote_marketplaces has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_core_plugins::loader::refresh_non_curated_plugin_cache_with_mode (cyclomatic 17) codex-rs/core-plugins/src/loader.rs:577 — codex_core_plugins::loader::refresh_non_curated_plugin_cache_with_mode has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • codex_core_plugins::agent_plugin_manifest::parse_agent_plugin_manifest_uri (cyclomatic 16) codex-rs/core-plugins/src/agent_plugin_manifest.rs:64 — codex_core_plugins::agent_plugin_manifest::parse_agent_plugin_manifest_uri has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_core_plugins::loader::apply_configured_plugin_mcp_server_policies (cyclomatic 16) codex-rs/core-plugins/src/loader.rs:1451 — codex_core_plugins::loader::apply_configured_plugin_mcp_server_policies has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_rmcp_client · ×4
  • codex_rmcp_client::ema_auth::discover_ema_authorization_metadata (cyclomatic 18) codex-rs/rmcp-client/src/ema_auth.rs:135 — codex_rmcp_client::ema_auth::discover_ema_authorization_metadata has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_rmcp_client::ema_resource::discover_ema_resource (cyclomatic 18) codex-rs/rmcp-client/src/ema_resource.rs:237 — codex_rmcp_client::ema_resource::discover_ema_resource has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_rmcp_client::request_input::request (cyclomatic 17) codex-rs/rmcp-client/src/request_input.rs:84 — codex_rmcp_client::request_input::request has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • codex_rmcp_client::http_client_adapter::legacy_discovery_fallback_response (cyclomatic 16) codex-rs/rmcp-client/src/http_client_adapter.rs:811 — codex_rmcp_client::http_client_adapter::legacy_discovery_fallback_response has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D2 · Cognitive Complexity · CredentialBroker · ×4
  • CredentialBroker::virtualize_env (cognitive 99) codex-rs/network-proxy/src/credential_broker.rs:561 — CredentialBroker::virtualize_env has cognitive complexity 99 (threshold 15). Drivers by points: if/else 17 (38 pts), boolean chains 33, loops 17 (28 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CredentialBroker::configure (cognitive 51) codex-rs/network-proxy/src/credential_broker.rs:295 — CredentialBroker::configure has cognitive complexity 51 (threshold 15). Drivers by points: if/else 17 (34 pts), match/switch 3 (9 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CredentialBroker::provider_sources_allowed (cognitive 27) codex-rs/network-proxy/src/credential_broker.rs:1247 — CredentialBroker::provider_sources_allowed has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 6, loops 3 (5 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CredentialBroker::discover_parent_credentials_for_environment (cognitive 17) codex-rs/network-proxy/src/credential_broker.rs:484 — CredentialBroker::discover_parent_credentials_for_environment has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_code_mode_runtime · ×4
  • codex_code_mode_runtime::cell_actor::run_cell (cognitive 95) codex-rs/code-mode-runtime/src/cell_actor/mod.rs:109 — codex_code_mode_runtime::cell_actor::run_cell has cognitive complexity 95 (threshold 15). Drivers by points: if/else 20 (54 pts), match/switch 11 (34 pts), boolean chains 6, loops 1 (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_code_mode_runtime::runtime::run_runtime (cognitive 22) codex-rs/code-mode-runtime/src/runtime/mod.rs:178 — codex_code_mode_runtime::runtime::run_runtime has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 4 (5 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_code_mode_runtime::runtime::audio::wav_duration_seconds (cognitive 21) codex-rs/code-mode-runtime/src/runtime/audio.rs:8 — codex_code_mode_runtime::runtime::audio::wav_duration_seconds has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_code_mode_runtime::runtime::value::normalize_output_image (cognitive 16) codex-rs/code-mode-runtime/src/runtime/value.rs:47 — codex_code_mode_runtime::runtime::value::normalize_output_image has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · RequestUserInputOverlay · ×4
  • RequestUserInputOverlay::handle_key_event (cognitive 89) codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:1213 — RequestUserInputOverlay::handle_key_event has cognitive complexity 89 (threshold 15). Drivers by points: if/else 29 (68 pts), boolean chains 14, match/switch 4 (7 pts) (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RequestUserInputOverlay::render_ui_at (cognitive 24) codex-rs/tui/src/bottom_pane/request_user_input/render.rs:249 — RequestUserInputOverlay::render_ui_at has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • RequestUserInputOverlay::footer_tips (cognitive 22) codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:590 — RequestUserInputOverlay::footer_tips has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • RequestUserInputOverlay::handle_composer_input_result (cognitive 16) codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:1097 — RequestUserInputOverlay::handle_composer_input_result has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 1, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ContextManager · ×4
  • ContextManager::reconstruct_rollout (cognitive 78) codex-rs/core/src/session/rollout_reconstruction.rs:208 — ContextManager::reconstruct_rollout has cognitive complexity 78 (threshold 15). Drivers by points: if/else 26 (58 pts), match/switch 6 (10 pts), boolean chains 7, loops 3 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ContextManager::restore_review_context (cognitive 28) codex-rs/core/src/context_manager/history.rs:318 — ContextManager::restore_review_context has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 8, match/switch 2 (3 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ContextManager::drop_last_n_user_turns (cognitive 23) codex-rs/core/src/context_manager/history.rs:777 — ContextManager::drop_last_n_user_turns has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 7 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ContextManager::record_retained_message (cognitive 21) codex-rs/core/src/context_manager/history_user_authorization.rs:105 — ContextManager::record_retained_message has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (9 pts), match/switch 1 (2 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · codex_exec · ×4
  • codex_exec::run_exec_session (cognitive 74) codex-rs/exec/src/lib.rs:855 — codex_exec::run_exec_session has cognitive complexity 74 (threshold 15). Drivers by points: if/else 30 (50 pts), match/switch 8 (15 pts), boolean chains 8, loops 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_exec::run_main (cognitive 55) codex-rs/exec/src/lib.rs:266 — codex_exec::run_main has cognitive complexity 55 (threshold 15). Drivers by points: if/else 29 (40 pts), match/switch 8 (10 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_exec::resolve_resume_thread_id (cognitive 54) codex-rs/exec/src/lib.rs:1858 — codex_exec::resolve_resume_thread_id has cognitive complexity 54 (threshold 15). Drivers by points: if/else 15 (41 pts), loops 4 (8 pts), boolean chains 5 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_exec::daybreak::program_for_turn (cognitive 21) codex-rs/exec/src/daybreak.rs:16 — codex_exec::daybreak::program_for_turn has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_protocol · ×4
  • codex_protocol::permission_profile_intersection::intersect_effective_permission_profiles (cognitive 63) codex-rs/protocol/src/permission_profile_intersection.rs:37 — codex_protocol::permission_profile_intersection::intersect_effective_permission_profiles has cognitive complexity 63 (threshold 15). Drivers by points: if/else 18 (30 pts), boolean chains 15, loops 7 (10 pts), match/switch 3 (8 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_protocol::models::executed_tool_calls::truncate_call_arguments_to_fit (cognitive 20) codex-rs/protocol/src/models/executed_tool_calls.rs:298 — codex_protocol::models::executed_tool_calls::truncate_call_arguments_to_fit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 3 (6 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_protocol::models::convert_mcp_content_to_items (cognitive 18) codex-rs/protocol/src/models.rs:2509 — codex_protocol::models::convert_mcp_content_to_items has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_protocol::permission_profile_intersection::normalize_policy (cognitive 18) codex-rs/protocol/src/permission_profile_intersection.rs:275 — codex_protocol::permission_profile_intersection::normalize_policy has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_memories_write · ×4
  • codex_memories_write::rollout_input::serialize_tiered_input (cognitive 61) codex-rs/memories/write/src/rollout_input.rs:105 — codex_memories_write::rollout_input::serialize_tiered_input has cognitive complexity 61 (threshold 15). Drivers by points: if/else 13 (25 pts), match/switch 8 (19 pts), boolean chains 9, loops 5 (8 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_memories_write::extensions::prune::prune_old_extension_resources_with_now (cognitive 33) codex-rs/memories/write/src/extensions/prune.rs:13 — codex_memories_write::extensions::prune::prune_old_extension_resources_with_now has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 2 (3 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_memories_write::phase2::agent::handle (cognitive 22) codex-rs/memories/write/src/phase2.rs:382 — codex_memories_write::phase2::agent::handle has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_memories_write::phase2::run (cognitive 17) codex-rs/memories/write/src/phase2.rs:50 — codex_memories_write::phase2::run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 5, boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · MathParser · ×4
  • MathParser::aligned (cognitive 50) codex-rs/tui/src/markdown_render/math/render/structured.rs:166 — MathParser::aligned has cognitive complexity 50 (threshold 15). Drivers by points: if/else 18 (41 pts), loops 4 (7 pts), boolean chains 2 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MathParser::structured_command (cognitive 27) codex-rs/tui/src/markdown_render/math/render/structured.rs:85 — MathParser::structured_command has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • MathParser::sequence (cognitive 26) codex-rs/tui/src/markdown_render/math/render.rs:99 — MathParser::sequence has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 5, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MathParser::command (cognitive 25) codex-rs/tui/src/markdown_render/math/render.rs:206 — MathParser::command has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 5 (9 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Renderer · ×4
  • Renderer::frame (cognitive 49) codex-rs/tui/src/empty_state_animation/renderer.rs:52 — Renderer::frame has cognitive complexity 49 (threshold 15). Drivers by points: if/else 16 (29 pts), loops 8 (19 pts), boolean chains 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Renderer::annotate_selection (cognitive 40) codex-rs/tui/src/analytics/plot/annotations.rs:45 — Renderer::annotate_selection has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18 (31 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Renderer::paint_bars (cognitive 20) codex-rs/tui/src/analytics/plot/painting.rs:47 — Renderer::paint_bars has cognitive complexity 20 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 2 (9 pts), boolean chains 1 (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • Renderer::annotate_calendar (cognitive 17) codex-rs/tui/src/analytics/plot/annotations.rs:156 — Renderer::annotate_calendar has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PluginRequestProcessor · ×4
  • PluginRequestProcessor::plugin_search_response (cognitive 44) codex-rs/app-server/src/request_processors/plugins/search.rs:25 — PluginRequestProcessor::plugin_search_response has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (23 pts), loops 5 (10 pts), boolean chains 7, match/switch 2 (4 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PluginRequestProcessor::plugin_list_response (cognitive 40) codex-rs/app-server/src/request_processors/plugins.rs:549 — PluginRequestProcessor::plugin_list_response has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17, boolean chains 12, match/switch 4 (8 pts), loops 1 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PluginRequestProcessor::plugin_read_response (cognitive 20) codex-rs/app-server/src/request_processors/plugins.rs:1008 — PluginRequestProcessor::plugin_read_response has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 5 (8 pts), boolean chains 2 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • PluginRequestProcessor::start_plugin_mcp_oauth_logins (cognitive 18) codex-rs/app-server/src/request_processors/plugins.rs:1863 — PluginRequestProcessor::start_plugin_mcp_oauth_logins has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 3 (6 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ListSelectionView · ×4
  • ListSelectionView::render (cognitive 44) codex-rs/tui/src/bottom_pane/list_selection_view.rs:1617 — ListSelectionView::render has cognitive complexity 44 (threshold 15). Drivers by points: if/else 26 (36 pts), boolean chains 3, loops 1 (3 pts), match/switch 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ListSelectionView::handle_key_event (cognitive 29) codex-rs/tui/src/bottom_pane/list_selection_view.rs:1289 — ListSelectionView::handle_key_event has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 24, if/else 2 (4 pts), match/switch 1 (nesting depth added 2). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ListSelectionView::accept (cognitive 20) codex-rs/tui/src/bottom_pane/list_selection_view.rs:973 — ListSelectionView::accept has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 1 (3 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ListSelectionView::build_rows (cognitive 16) codex-rs/tui/src/bottom_pane/list_selection_view.rs:742 — ListSelectionView::build_rows has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ExecCell · ×4
  • ExecCell::exploring_display_lines (cognitive 41) codex-rs/tui/src/exec_cell/render.rs:318 — ExecCell::exploring_display_lines has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 3 (12 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExecCell::command_display_lines_with_hidden_details (cognitive 34) codex-rs/tui/src/exec_cell/render.rs:459 — ExecCell::command_display_lines_with_hidden_details has cognitive complexity 34 (threshold 15). Drivers by points: if/else 20 (29 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExecCell::detailed_hyperlink_lines (cognitive 25) codex-rs/tui/src/exec_cell/transcript.rs:17 — ExecCell::detailed_hyperlink_lines has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExecCell::compact_command_lines (cognitive 22) codex-rs/tui/src/exec_cell/compact.rs:68 — ExecCell::compact_command_lines has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · codex_skills · ×4
  • codex_skills::parser::repair_frontmatter_scalar_fields (cognitive 35) codex-rs/skills/src/parser.rs:98 — codex_skills::parser::repair_frontmatter_scalar_fields has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 7, loops 3 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_skills::mentions::extract_tool_mentions_with_sigil (cognitive 22) codex-rs/skills/src/mentions.rs:88 — codex_skills::mentions::extract_tool_mentions_with_sigil has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_skills::selection::select_skills_from_mentions (cognitive 19) codex-rs/skills/src/selection.rs:121 — codex_skills::selection::select_skills_from_mentions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_skills::selection::collect_explicit_skill_mentions (cognitive 17) codex-rs/skills/src/selection.rs:44 — codex_skills::selection::collect_explicit_skill_mentions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 2, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×4
  • Duplicated block (28 lines × 2) REDACTED:990 — REDACTED:990-1017 | REDACTED:255-282 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (28 lines × 2) codex-rs/skills/src/mentions.rs:110 — codex-rs/skills/src/mentions.rs:110-137 | codex-rs/tui/src/chatwidget/skills.rs:335-362 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (28 lines × 2) codex-rs/tui/src/app/startup.rs:764 — codex-rs/tui/src/app/startup.rs:764-791 | codex-rs/tui/src/app/startup.rs:877-904 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (28 lines × 2) codex-rs/tui/src/bottom_pane/multi_select_picker.rs:252 — codex-rs/tui/src/bottom_pane/multi_select_picker.rs:252-279 | codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:114-141 — before extracting anything, compare `codex-rs/tui/src/bottom_pane/multi_select_picker.rs` and `codex-rs/tui/src/bottom_pane/skills_toggle_view.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 97 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×4
  • Duplicated block (13 lines × 3) REDACTED:1169 — REDACTED:1169-1181 | REDACTED:1472-1484 | REDACTED:1510-1522 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (13 lines × 3) codex-rs/rollout/src/list.rs:1465 — codex-rs/rollout/src/list.rs:1465-1477 | codex-rs/rollout/src/search.rs:133-145 | codex-rs/rollout/src/search.rs:233-245 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (13 lines × 3) codex-rs/core/src/client.rs:3030 — codex-rs/core/src/client.rs:3030-3042 | codex-rs/core/src/client.rs:3053-3065 | codex-rs/core/src/client.rs:3086-3098 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (13 lines × 3) codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:36 — codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:36-48 | codex-rs/rmcp-client/src/bin/test_stdio_server.rs:212-224 | codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs:366-378 — before extracting anything, compare `codex-rs/rmcp-client/src/bin/rmcp_test_server.rs` and `codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×4
  • Duplicated block (12–13 lines × 2) codex-rs/app-server-protocol/src/protocol/item_builders.rs:97 — codex-rs/app-server-protocol/src/protocol/item_builders.rs:97-108 | codex-rs/app-server-protocol/src/protocol/item_builders.rs:124-136 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) codex-rs/core/src/client.rs:1700 — codex-rs/core/src/client.rs:1700-1711 | codex-rs/core/src/client.rs:2105-2117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) codex-rs/tui/src/bottom_pane/multi_select_picker.rs:593 — codex-rs/tui/src/bottom_pane/multi_select_picker.rs:593-605 | codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:300-311 — before extracting anything, compare `codex-rs/tui/src/bottom_pane/multi_select_picker.rs` and `codex-rs/tui/src/bottom_pane/skills_toggle_view.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 97 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12–13 lines × 2) codex-rs/tui/src/lib.rs:1256 — codex-rs/tui/src/lib.rs:1256-1267 | codex-rs/tui/src/lib.rs:1837-1849 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×4
  • Duplicated block (10–11 lines × 2) codex-rs/protocol/src/protocol.rs:2673 — codex-rs/protocol/src/protocol.rs:2673-2683 | codex-rs/tui/src/token_usage.rs:44-53 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10–11 lines × 2) codex-rs/tui/src/app/history_ui.rs:194 — codex-rs/tui/src/app/history_ui.rs:194-203 | codex-rs/tui/src/app/history_ui.rs:210-220 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–11 lines × 2) codex-rs/tui/src/worktree_browser.rs:119 — codex-rs/tui/src/worktree_browser.rs:119-129 | codex-rs/tui/src/worktree_browser.rs:155-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–11 lines × 2) codex-rs/windows-sandbox-rs/src/acl.rs:793 — codex-rs/windows-sandbox-rs/src/acl.rs:793-802 | codex-rs/windows-sandbox-rs/src/acl.rs:1126-1136 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×4
  • Duplicated block (8 lines × 3) codex-rs/app-server-protocol/src/protocol/event_mapping.rs:159 — codex-rs/app-server-protocol/src/protocol/event_mapping.rs:159-166 | codex-rs/app-server-protocol/src/protocol/event_mapping.rs:285-292 | codex-rs/app-server-protocol/src/protocol/event_mapping.rs:338-345 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 3) codex-rs/state/src/runtime/thread_attachments.rs:36 — codex-rs/state/src/runtime/thread_attachments.rs:36-43 | codex-rs/state/src/runtime/thread_attachments.rs:88-95 | codex-rs/state/src/runtime/thread_attachments.rs:156-163 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 3) codex-rs/tui/src/bottom_pane/experimental_features_view.rs:420 — codex-rs/tui/src/bottom_pane/experimental_features_view.rs:420-430 | codex-rs/tui/src/bottom_pane/memories_settings_view.rs:420-427 | codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:319-329 — before extracting anything, compare `codex-rs/tui/src/bottom_pane/experimental_features_view.rs` and `codex-rs/tui/src/bottom_pane/memories_settings_view.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 3) codex-rs/core/src/util.rs:90 — codex-rs/core/src/util.rs:90-97 | codex-rs/hooks/src/engine/output_parser.rs:514-521 | codex-rs/hooks/src/events/common.rs:39-46 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D1 · Cyclomatic Complexity · CredentialBroker · ×3
  • CredentialBroker::virtualize_env (cyclomatic 67) codex-rs/network-proxy/src/credential_broker.rs:561 — CredentialBroker::virtualize_env has cyclomatic complexity 67 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • CredentialBroker::configure (cyclomatic 27) codex-rs/network-proxy/src/credential_broker.rs:295 — CredentialBroker::configure has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • CredentialBroker::provider_sources_allowed (cyclomatic 16) codex-rs/network-proxy/src/credential_broker.rs:1247 — CredentialBroker::provider_sources_allowed has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentsOverviewView · ×3
  • AgentsOverviewView::handle_key_event (cyclomatic 58) codex-rs/tui/src/app/agents_overview_view.rs:628 — AgentsOverviewView::handle_key_event has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AgentsOverviewView::render_center_rows (cyclomatic 43) codex-rs/tui/src/app/agent_center/rows.rs:38 — AgentsOverviewView::render_center_rows has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AgentsOverviewView::render (cyclomatic 18) codex-rs/tui/src/app/agent_center/render.rs:126 — AgentsOverviewView::render has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RequestUserInputOverlay · ×3
  • RequestUserInputOverlay::handle_key_event (cyclomatic 56) codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:1213 — RequestUserInputOverlay::handle_key_event has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • RequestUserInputOverlay::render_ui_at (cyclomatic 18) codex-rs/tui/src/bottom_pane/request_user_input/render.rs:249 — RequestUserInputOverlay::render_ui_at has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • RequestUserInputOverlay::footer_tips (cyclomatic 17) codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:590 — RequestUserInputOverlay::footer_tips has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · codex_code_mode_runtime · ×3
  • codex_code_mode_runtime::cell_actor::run_cell (cyclomatic 51) codex-rs/code-mode-runtime/src/cell_actor/mod.rs:109 — codex_code_mode_runtime::cell_actor::run_cell has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_code_mode_runtime::runtime::run_runtime (cyclomatic 16) codex-rs/code-mode-runtime/src/runtime/mod.rs:178 — codex_code_mode_runtime::runtime::run_runtime has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_code_mode_runtime::runtime::value::normalize_output_image (cyclomatic 16) codex-rs/code-mode-runtime/src/runtime/value.rs:47 — codex_code_mode_runtime::runtime::value::normalize_output_image has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · codex_memories_write · ×3
  • codex_memories_write::rollout_input::serialize_tiered_input (cyclomatic 43) codex-rs/memories/write/src/rollout_input.rs:105 — codex_memories_write::rollout_input::serialize_tiered_input has cyclomatic complexity 43 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • codex_memories_write::extensions::prune::prune_old_extension_resources_with_now (cyclomatic 18) codex-rs/memories/write/src/extensions/prune.rs:13 — codex_memories_write::extensions::prune::prune_old_extension_resources_with_now has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_memories_write::phase2::agent::handle (cyclomatic 16) codex-rs/memories/write/src/phase2.rs:382 — codex_memories_write::phase2::agent::handle has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_linux_sandbox · ×3
  • codex_linux_sandbox::bwrap::create_filesystem_args (cyclomatic 40) REDACTED:409 — codex_linux_sandbox::bwrap::create_filesystem_args has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_linux_sandbox::linux_run_main::run_main (cyclomatic 30) codex-rs/linux-sandbox/src/linux_run_main.rs:135 — codex_linux_sandbox::linux_run_main::run_main has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_linux_sandbox::daemon_mounts::check_mounts (cyclomatic 25) codex-rs/linux-sandbox/src/daemon_mounts.rs:63 — codex_linux_sandbox::daemon_mounts::check_mounts has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_git_utils · ×3
  • codex_git_utils::apply::parse_git_apply_output (cyclomatic 39) codex-rs/git-utils/src/apply.rs:355 — codex_git_utils::apply::parse_git_apply_output has cyclomatic complexity 39 (threshold 15). Of this number, 34 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_git_utils::trust::resolve_root (cyclomatic 20) codex-rs/git-utils/src/trust.rs:71 — codex_git_utils::trust::resolve_root has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_git_utils::apply::unescape_c_string (cyclomatic 19) codex-rs/git-utils/src/apply.rs:278 — codex_git_utils::apply::unescape_c_string has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · BedrockState · ×3
  • BedrockState::render (cyclomatic 38) codex-rs/tui/src/onboarding/bedrock.rs:364 — BedrockState::render has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • BedrockState::handle_key_event (cyclomatic 20) codex-rs/tui/src/onboarding/bedrock.rs:241 — BedrockState::handle_key_event has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • BedrockState::render_methods (cyclomatic 18) codex-rs/tui/src/onboarding/bedrock.rs:591 — BedrockState::render_methods has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LocalThreadStore · ×3
  • LocalThreadStore::migrate_rollout_path (cyclomatic 34) codex-rs/thread-store/src/local/rollout_migration.rs:396 — LocalThreadStore::migrate_rollout_path has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LocalThreadStore::resolve_rollout_lineage_with_mode (cyclomatic 21) codex-rs/thread-store/src/local/rollout_lineage.rs:74 — LocalThreadStore::resolve_rollout_lineage_with_mode has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LocalThreadStore::migrate_one_rollout (cyclomatic 18) codex-rs/thread-store/src/local/rollout_migration.rs:627 — LocalThreadStore::migrate_one_rollout has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · UnifiedExecProcessManager · ×3
  • UnifiedExecProcessManager::write_stdin_inner (cyclomatic 25) codex-rs/core/src/unified_exec/process_manager.rs:915 — UnifiedExecProcessManager::write_stdin_inner has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • UnifiedExecProcessManager::exec_command_inner (cyclomatic 22) codex-rs/core/src/unified_exec/process_manager.rs:540 — UnifiedExecProcessManager::exec_command_inner has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • UnifiedExecProcessManager::collect_output_until_deadline (cyclomatic 20) codex-rs/core/src/unified_exec/process_manager.rs:1625 — UnifiedExecProcessManager::collect_output_until_deadline has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_mcp · ×3
  • codex_mcp::mcp::auth::compute_auth_status (cyclomatic 21) codex-rs/codex-mcp/src/mcp/auth.rs:257 — codex_mcp::mcp::auth::compute_auth_status has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_mcp::rmcp_client::start_server_task (cyclomatic 16) codex-rs/codex-mcp/src/rmcp_client.rs:1111 — codex_mcp::rmcp_client::start_server_task has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_mcp::rmcp_client::make_rmcp_client (cyclomatic 16) codex-rs/codex-mcp/src/rmcp_client.rs:1403 — codex_mcp::rmcp_client::make_rmcp_client has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExecCell · ×3
  • ExecCell::command_display_lines_with_hidden_details (cyclomatic 21) codex-rs/tui/src/exec_cell/render.rs:459 — ExecCell::command_display_lines_with_hidden_details has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ExecCell::exploring_display_lines (cyclomatic 19) codex-rs/tui/src/exec_cell/render.rs:318 — ExecCell::exploring_display_lines has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ExecCell::compact_command_lines (cyclomatic 16) codex-rs/tui/src/exec_cell/compact.rs:68 — ExecCell::compact_command_lines has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PluginsManager · ×3
  • PluginsManager::schedule_non_curated_plugin_cache_refresh (cyclomatic 20) codex-rs/core-plugins/src/manager.rs:3276 — PluginsManager::schedule_non_curated_plugin_cache_refresh has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • PluginsManager::list_tool_suggest_discoverable_plugins (cyclomatic 17) codex-rs/core-plugins/src/discoverable.rs:71 — PluginsManager::list_tool_suggest_discoverable_plugins has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • PluginsManager::plugins_for_config (cyclomatic 17) codex-rs/core-plugins/src/manager.rs:825 — PluginsManager::plugins_for_config has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · McpConnectionSet · ×3
  • McpConnectionSet::new (cognitive 186) codex-rs/codex-mcp/src/connection_manager.rs:350 — McpConnectionSet::new has cognitive complexity 186 (threshold 15). Drivers by points: if/else 55 (116 pts), boolean chains 31, match/switch 10 (28 pts), loops 4 (11 pts) (nesting depth added 86). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • McpConnectionSet::capture_binding_with_metadata (cognitive 68) codex-rs/codex-mcp/src/connection_manager/tool_catalog.rs:295 — McpConnectionSet::capture_binding_with_metadata has cognitive complexity 68 (threshold 15). Drivers by points: if/else 31 (49 pts), boolean chains 14, loops 3, match/switch 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • McpConnectionSet::stable_catalog_revisions (cognitive 20) codex-rs/codex-mcp/src/connection_manager/tool_catalog.rs:124 — McpConnectionSet::stable_catalog_revisions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 7, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Config · ×3
  • Config::load_config_with_layer_stack (cognitive 125) codex-rs/core/src/config/mod.rs:3333 — Config::load_config_with_layer_stack has cognitive complexity 125 (threshold 15). Drivers by points: if/else 68 (80 pts), boolean chains 33, match/switch 10 (11 pts), loops 1 (nesting depth added 13). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • Config::resolve_runtime_refresh (cognitive 22) codex-rs/core/src/config/runtime_refresh.rs:38 — Config::resolve_runtime_refresh has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 9, loops 1, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Config::to_mcp_config_with_loaded_plugins (cognitive 19) codex-rs/core/src/config/mod.rs:1862 — Config::to_mcp_config_with_loaded_plugins has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (12 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · RuntimeKeymap · ×3
  • RuntimeKeymap::from_config (cognitive 62) codex-rs/tui/src/keymap.rs:672 — RuntimeKeymap::from_config has cognitive complexity 62 (threshold 15). Drivers by points: boolean chains 30, if/else 20 (26 pts), loops 6 (nesting depth added 6). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • RuntimeKeymap::validate_conflicts (cognitive 31) codex-rs/tui/src/keymap.rs:2017 — RuntimeKeymap::validate_conflicts has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 7, loops 6 (7 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RuntimeKeymap::configure_search (cognitive 20) codex-rs/tui/src/keymap/vim_search.rs:29 — RuntimeKeymap::configure_search has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 6, match/switch 2 (3 pts), loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExternalAgentConfigService · ×3
  • ExternalAgentConfigService::import (cognitive 61) codex-rs/external-agent-migration/src/service.rs:203 — ExternalAgentConfigService::import has cognitive complexity 61 (threshold 15). Drivers by points: loops 10 (30 pts), if/else 7 (18 pts), match/switch 4 (12 pts), boolean chains 1 (nesting depth added 39). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • ExternalAgentConfigService::detect_migrations (cognitive 47) codex-rs/external-agent-migration/src/detect/mod.rs:79 — ExternalAgentConfigService::detect_migrations has cognitive complexity 47 (threshold 15). Drivers by points: if/else 22 (38 pts), match/switch 2 (5 pts), boolean chains 2, loops 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExternalAgentConfigService::import_plugins (cognitive 27) codex-rs/external-agent-migration/src/plugins.rs:86 — ExternalAgentConfigService::import_plugins has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 3 (8 pts), loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PidBackend · ×3
  • PidBackend::start_inner (cognitive 57) codex-rs/app-server-daemon/src/backend/pid_start.rs:21 — PidBackend::start_inner has cognitive complexity 57 (threshold 15). Drivers by points: if/else 21 (40 pts), match/switch 9 (15 pts), boolean chains 1, loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PidBackend::stop_with_grace (cognitive 36) codex-rs/app-server-daemon/src/backend/pid.rs:171 — PidBackend::stop_with_grace has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (25 pts), match/switch 3 (6 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PidBackend::finish_updater_start (cognitive 21) codex-rs/app-server-daemon/src/backend/pid_windows.rs:71 — PidBackend::finish_updater_start has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BottomPane · ×3
  • BottomPane::renderable_for_views (cognitive 56) codex-rs/tui/src/bottom_pane/mod.rs:2418 — BottomPane::renderable_for_views has cognitive complexity 56 (threshold 15). Drivers by points: if/else 24 (40 pts), boolean chains 16 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BottomPane::handle_key_event_with_activation_key (cognitive 48) codex-rs/tui/src/bottom_pane/mod.rs:858 — BottomPane::handle_key_event_with_activation_key has cognitive complexity 48 (threshold 15). Drivers by points: if/else 24 (37 pts), boolean chains 7, loops 2 (4 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BottomPane::handle_paste (cognitive 16) codex-rs/tui/src/bottom_pane/mod.rs:1063 — BottomPane::handle_paste has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BedrockState · ×3
  • BedrockState::render (cognitive 55) codex-rs/tui/src/onboarding/bedrock.rs:364 — BedrockState::render has cognitive complexity 55 (threshold 15). Drivers by points: if/else 27 (46 pts), boolean chains 6, loops 1 (2 pts), match/switch 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BedrockState::render_methods (cognitive 33) codex-rs/tui/src/onboarding/bedrock.rs:591 — BedrockState::render_methods has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BedrockState::handle_key_event (cognitive 23) codex-rs/tui/src/onboarding/bedrock.rs:241 — BedrockState::handle_key_event has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · LocalThreadStore · ×3
  • LocalThreadStore::migrate_rollout_path (cognitive 52) codex-rs/thread-store/src/local/rollout_migration.rs:396 — LocalThreadStore::migrate_rollout_path has cognitive complexity 52 (threshold 15). Drivers by points: if/else 20 (30 pts), match/switch 7 (14 pts), boolean chains 7, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LocalThreadStore::resolve_rollout_lineage_with_mode (cognitive 33) codex-rs/thread-store/src/local/rollout_lineage.rs:74 — LocalThreadStore::resolve_rollout_lineage_with_mode has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 5 (10 pts), boolean chains 4, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LocalThreadStore::migrate_one_rollout (cognitive 25) codex-rs/thread-store/src/local/rollout_migration.rs:627 — LocalThreadStore::migrate_one_rollout has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 3, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · UnifiedExecProcessManager · ×3
  • UnifiedExecProcessManager::write_stdin_inner (cognitive 47) codex-rs/core/src/unified_exec/process_manager.rs:915 — UnifiedExecProcessManager::write_stdin_inner has cognitive complexity 47 (threshold 15). Drivers by points: if/else 23 (39 pts), boolean chains 4, match/switch 2 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • UnifiedExecProcessManager::exec_command_inner (cognitive 33) codex-rs/core/src/unified_exec/process_manager.rs:540 — UnifiedExecProcessManager::exec_command_inner has cognitive complexity 33 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 4, match/switch 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • UnifiedExecProcessManager::collect_output_until_deadline (cognitive 31) codex-rs/core/src/unified_exec/process_manager.rs:1625 — UnifiedExecProcessManager::collect_output_until_deadline has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (19 pts), match/switch 3 (8 pts), boolean chains 3, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CredentialBrokerState · ×3
  • CredentialBrokerState::register (cognitive 46) codex-rs/network-proxy/src/credential_broker.rs:1612 — CredentialBrokerState::register has cognitive complexity 46 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 16, loops 3 (9 pts), match/switch 3 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CredentialBrokerState::environment (cognitive 23) codex-rs/network-proxy/src/credential_broker/environment.rs:117 — CredentialBrokerState::environment has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 8 (9 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CredentialBrokerState::restore_child_env (cognitive 19) codex-rs/network-proxy/src/credential_broker.rs:1504 — CredentialBrokerState::restore_child_env has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 7, if/else 3 (7 pts), loops 3 (5 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpToolCallCell · ×3
  • McpToolCallCell::compact_mcp_lines (cognitive 44) codex-rs/tui/src/history_cell/mcp_preview.rs:20 — McpToolCallCell::compact_mcp_lines has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (31 pts), boolean chains 5, loops 3 (5 pts), match/switch 2 (3 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • McpToolCallCell::render_detail_lines (cognitive 31) codex-rs/tui/src/history_cell/mcp.rs:241 — McpToolCallCell::render_detail_lines has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 3 (7 pts), boolean chains 1, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • McpToolCallCell::render_hyperlink_lines (cognitive 17) codex-rs/tui/src/history_cell/mcp.rs:145 — McpToolCallCell::render_hyperlink_lines has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · codex_tools · ×3
  • codex_tools::json_schema::sanitize_json_schema (cognitive 40) codex-rs/tools/src/json_schema.rs:91 — codex_tools::json_schema::sanitize_json_schema has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 4 (9 pts), boolean chains 8, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_tools::json_schema::traversal::for_each_schema_child (cognitive 20) codex-rs/tools/src/json_schema/traversal.rs:13 — codex_tools::json_schema::traversal::for_each_schema_child has cognitive complexity 20 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 5 (8 pts), boolean chains 3 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: one other method here (codex_tools::json_schema::traversal::for_each_schema_child_mut) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • codex_tools::json_schema::traversal::for_each_schema_child_mut (cognitive 20) codex-rs/tools/src/json_schema/traversal.rs:51 — codex_tools::json_schema::traversal::for_each_schema_child_mut has cognitive complexity 20 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 5 (8 pts), boolean chains 3 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: one other method here (codex_tools::json_schema::traversal::for_each_schema_child) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · codex_apply_patch · ×3
  • codex_apply_patch::file_update::compute_replacements (cognitive 35) codex-rs/apply-patch/src/file_update.rs:60 — codex_apply_patch::file_update::compute_replacements has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (27 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_apply_patch::apply_hunks_to_files (cognitive 33) codex-rs/apply-patch/src/lib.rs:438 — codex_apply_patch::apply_hunks_to_files has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (18 pts), match/switch 5 (14 pts), loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_apply_patch::seek_sequence::seek_sequence (cognitive 33) codex-rs/apply-patch/src/seek_sequence.rs:12 — codex_apply_patch::seek_sequence::seek_sequence has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 7 (10 pts), boolean chains 1, match/switch 1 (nesting depth added 13). Of this number, 32 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_memories_extension · ×3
  • codex_memories_extension::local::search::search_file (cognitive 35) codex-rs/ext/memories/src/local/search.rs:130 — codex_memories_extension::local::search::search_file has cognitive complexity 35 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 6 (15 pts), boolean chains 2, match/switch 2 (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_memories_extension::local::search::search_entries (cognitive 18) codex-rs/ext/memories/src/local/search.rs:91 — codex_memories_extension::local::search::search_entries has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_memories_extension::local::list::list (cognitive 17) codex-rs/ext/memories/src/local/list.rs:14 — codex_memories_extension::local::list::list has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_message_history · ×3
  • codex_message_history::batch::scan_batch_backward (cognitive 33) codex-rs/message-history/src/batch.rs:235 — codex_message_history::batch::scan_batch_backward has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_message_history::lookup_history_entry (cognitive 23) codex-rs/message-history/src/lib.rs:356 — codex_message_history::lookup_history_entry has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 5 (13 pts), if/else 2 (5 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 13). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • codex_message_history::batch::scan_batch_forward (cognitive 21) codex-rs/message-history/src/batch.rs:175 — codex_message_history::batch::scan_batch_forward has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AppLinkView · ×3
  • AppLinkView::activate_selected_action (cognitive 33) codex-rs/tui/src/bottom_pane/app_link_view.rs:413 — AppLinkView::activate_selected_action has cognitive complexity 33 (threshold 15). Drivers by points: match/switch 16 (32 pts), if/else 1 (nesting depth added 16). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • AppLinkView::link_content_lines (cognitive 28) codex-rs/tui/src/bottom_pane/app_link_view.rs:481 — AppLinkView::link_content_lines has cognitive complexity 28 (threshold 15). Drivers by points: loops 7 (17 pts), if/else 7 (10 pts), boolean chains 1 (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • AppLinkView::install_confirmation_lines (cognitive 26) codex-rs/tui/src/bottom_pane/app_link_view.rs:552 — AppLinkView::install_confirmation_lines has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 6 (12 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · RmcpClient · ×3
  • RmcpClient::create_pending_transport (cognitive 29) codex-rs/rmcp-client/src/rmcp_client.rs:1364 — RmcpClient::create_pending_transport has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 3 (7 pts), boolean chains 3 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • RmcpClient::connect_pending_transport_with_initialize_retries (cognitive 21) codex-rs/rmcp-client/src/streamable_http_retry.rs:27 — RmcpClient::connect_pending_transport_with_initialize_retries has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 4 (8 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RmcpClient::call_tool_inner (cognitive 16) codex-rs/rmcp-client/src/rmcp_client.rs:1026 — RmcpClient::call_tool_inner has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), match/switch 5, boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · codex_state · ×3
  • codex_state::runtime::threads::push_thread_filters_with_preview (cognitive 28) codex-rs/state/src/runtime/threads.rs:1446 — codex_state::runtime::threads::push_thread_filters_with_preview has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 5 (7 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_state::runtime::reclamation::reclaim_pages (cognitive 23) codex-rs/state/src/runtime/reclamation.rs:278 — codex_state::runtime::reclamation::reclaim_pages has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 5, match/switch 2 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_state::runtime::logs::push_log_filters (cognitive 19) codex-rs/state/src/runtime/logs.rs:471 — codex_state::runtime::logs::push_log_filters has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_guardian_reviewer · ×3
  • codex_guardian_reviewer::execution::wait_for_guardian_review (cognitive 27) codex-rs/ext/guardian-reviewer/src/execution.rs:68 — codex_guardian_reviewer::execution::wait_for_guardian_review has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 3 (9 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_guardian_reviewer::completion::complete_review (cognitive 21) codex-rs/ext/guardian-reviewer/src/completion.rs:38 — codex_guardian_reviewer::completion::complete_review has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (12 pts), match/switch 6 (9 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_guardian_reviewer::retry::run_with_retry (cognitive 19) codex-rs/ext/guardian-reviewer/src/retry.rs:24 — codex_guardian_reviewer::retry::run_with_retry has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 3 (8 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Daemon · ×3
  • Daemon::try_restart_if_running (cognitive 26) codex-rs/app-server-daemon/src/lib.rs:542 — Daemon::try_restart_if_running has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Daemon::bootstrap_locked (cognitive 25) codex-rs/app-server-daemon/src/lib.rs:860 — Daemon::bootstrap_locked has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Daemon::set_remote_control_locked (cognitive 18) codex-rs/app-server-daemon/src/lib.rs:786 — Daemon::set_remote_control_locked has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TranscriptOverlay · ×3
  • TranscriptOverlay::render (cognitive 25) codex-rs/tui/src/pager_overlay/transcript.rs:78 — TranscriptOverlay::render has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TranscriptOverlay::handle_key (cognitive 23) codex-rs/tui/src/pager_overlay/transcript.rs:455 — TranscriptOverlay::handle_key has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 9 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • TranscriptOverlay::handle_event (cognitive 19) codex-rs/tui/src/pager_overlay/transcript.rs:194 — TranscriptOverlay::handle_event has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkerRuntime · ×3
  • WorkerRuntime::run_with_backend_availability (cognitive 20) codex-rs/app-server/src/turn_cost_worker.rs:210 — WorkerRuntime::run_with_backend_availability has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (9 pts), match/switch 3 (7 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • WorkerRuntime::query_chatgpt_turn_costs (cognitive 19) codex-rs/app-server/src/turn_cost_worker_chatgpt.rs:14 — WorkerRuntime::query_chatgpt_turn_costs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • WorkerRuntime::record_observation (cognitive 16) codex-rs/app-server/src/turn_cost_worker.rs:305 — WorkerRuntime::record_observation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 1, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D29 · Static Analysis (SAST) · REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (5 members, 50+ identical tokens) codex-rs/core/src/session/mcp.rs:724 — codex-rs/core/src/session/mcp.rs:724-798 | codex-rs/core/src/session/mod.rs:3071-3146 | codex-rs/core/src/session/mod.rs:3159-3190 | codex-rs/core/src/session/mod.rs:3203-3369 | codex-rs/core/src/session/mod.rs:3380-3413 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) codex-rs/hooks/src/events/compact.rs:261 — codex-rs/hooks/src/events/compact.rs:261-343 | codex-rs/hooks/src/events/pre_tool_use.rs:203-317 | codex-rs/hooks/src/events/session_start.rs:228-347 | codex-rs/hooks/src/events/stop.rs:241-399 | codex-rs/hooks/src/events/user_prompt_submit.rs:142-277 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) codex-rs/tui/src/config_panel/render.rs:124 — codex-rs/tui/src/config_panel/render.rs:124-158 | codex-rs/tui/src/config_panel/render.rs:163-197 | codex-rs/tui/src/config_panel/render.rs:202-233 | codex-rs/tui/src/config_panel/render.rs:238-271 | codex-rs/tui/src/config_panel/render.rs:277-321 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×3
  • Duplicated block (31 lines × 2) codex-rs/cli/src/doctor/output/detail.rs:235 — codex-rs/cli/src/doctor/output/detail.rs:235-265 | codex-rs/cli/src/doctor/output/detail.rs:292-322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (31 lines × 2) codex-rs/shell-command/src/parse_command.rs:2592 — codex-rs/shell-command/src/parse_command.rs:2592-2622 | codex-rs/shell-command/src/parse_command.rs:2646-2676 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (31 lines × 2) codex-rs/tui/src/app.rs:388 — codex-rs/tui/src/app.rs:388-418 | codex-rs/tui/src/approval_events.rs:74-104 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×3
  • Duplicated block (25 lines × 2) codex-rs/core/src/tools/network_approval.rs:936 — codex-rs/core/src/tools/network_approval.rs:936-960 | codex-rs/core/src/tools/network_approval.rs:985-1009 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (25 lines × 2) codex-rs/rollout/src/list.rs:589 — codex-rs/rollout/src/list.rs:589-613 | codex-rs/rollout/src/list.rs:711-735 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (25 lines × 2) codex-rs/state/src/runtime/memories.rs:1338 — codex-rs/state/src/runtime/memories.rs:1338-1362 | codex-rs/state/src/runtime/memories.rs:1379-1404 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×3
  • Duplicated block (21 lines × 2) codex-rs/model-provider/src/models_endpoint.rs:348 — codex-rs/model-provider/src/models_endpoint.rs:348-368 | codex-rs/model-provider/src/models_endpoint.rs:374-394 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) codex-rs/tui/src/resume_picker.rs:511 — codex-rs/tui/src/resume_picker.rs:511-531 | codex-rs/tui/src/resume_picker.rs:573-593 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) scripts/mcp_conformance/server.py:803 — scripts/mcp_conformance/server.py:803-823 | scripts/mcp_conformance/server.py:952-972 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/mcp_conformance/server.py:803` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×3
  • Duplicated block (17–18 lines × 2) codex-rs/codex-api/src/files.rs:170 — codex-rs/codex-api/src/files.rs:170-186 | codex-rs/codex-api/src/files.rs:369-386 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17–18 lines × 2) codex-rs/hooks/src/events/pre_tool_use.rs:224 — codex-rs/hooks/src/events/pre_tool_use.rs:224-240 | codex-rs/hooks/src/events/user_prompt_submit.rs:164-181 — before extracting anything, compare `codex-rs/hooks/src/events/pre_tool_use.rs` and `codex-rs/hooks/src/events/user_prompt_submit.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 89 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (17–18 lines × 2) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:734 — codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:734-750 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:193-210 — before extracting anything, compare `codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs` and `codex-rs/tui/src/bottom_pane/request_user_input/mod.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (17 lines × 3) · ×3
  • Duplicated block (17 lines × 3) codex-rs/analytics/src/events.rs:1519 — codex-rs/analytics/src/events.rs:1519-1535 | codex-rs/hooks/src/engine/dispatcher.rs:297-313 | codex-rs/tui/src/bottom_pane/hooks_browser_view.rs:673-689 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (17 lines × 3) codex-rs/ext/memories/src/schema.rs:26 — codex-rs/ext/memories/src/schema.rs:26-42 | codex-rs/ext/skills/src/tools/schema.rs:26-42 | codex-rs/ext/web-search/src/schema.rs:20-36 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (17 lines × 3) codex-rs/tui/src/chatwidget/plugin_catalog.rs:591 — codex-rs/tui/src/chatwidget/plugin_catalog.rs:591-607 | codex-rs/tui/src/chatwidget/plugin_catalog.rs:645-661 | codex-rs/tui/src/chatwidget/plugin_catalog.rs:682-698 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×3
  • Duplicated block (16–17 lines × 2) codex-rs/codex-experimental-api-macros/src/lib.rs:50 — codex-rs/codex-experimental-api-macros/src/lib.rs:50-66 | codex-rs/codex-experimental-api-macros/src/lib.rs:96-111 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16–17 lines × 2) codex-rs/external-agent-migration/src/sessions/records_cla.rs:184 — codex-rs/external-agent-migration/src/sessions/records_cla.rs:184-199 | codex-rs/external-agent-migration/src/sessions/records_cur.rs:148-164 — before extracting anything, compare `codex-rs/external-agent-migration/src/sessions/records_cla.rs` and `codex-rs/external-agent-migration/src/sessions/records_cur.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 104 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16–17 lines × 2) codex-rs/tui/src/app/startup.rs:734 — codex-rs/tui/src/app/startup.rs:734-750 | codex-rs/tui/src/app/startup.rs:840-855 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×3
  • Duplicated block (11 lines × 3) codex-rs/analytics/src/reducer.rs:1772 — codex-rs/analytics/src/reducer.rs:1772-1782 | codex-rs/analytics/src/reducer.rs:1806-1816 | codex-rs/analytics/src/reducer.rs:1846-1856 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) codex-rs/app-server-transport/src/transport/remote_control/mod.rs:826 — codex-rs/app-server-transport/src/transport/remote_control/mod.rs:826-836 | codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:340-350 | codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:373-383 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (11 lines × 3) codex-rs/tui/src/bottom_pane/experimental_features_view.rs:390 — codex-rs/tui/src/bottom_pane/experimental_features_view.rs:390-400 | codex-rs/tui/src/bottom_pane/memories_settings_view.rs:364-374 | codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:280-290 — before extracting anything, compare `codex-rs/tui/src/bottom_pane/experimental_features_view.rs` and `codex-rs/tui/src/bottom_pane/memories_settings_view.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×3
  • Duplicated block (10 lines × 4) codex-rs/tui/src/cwd_prompt.rs:341 — codex-rs/tui/src/cwd_prompt.rs:341-350 | codex-rs/tui/src/model_migration.rs:309-318 | codex-rs/tui/src/oss_selection.rs:261-270 | codex-rs/tui/src/update_prompt.rs:259-268 — before extracting anything, compare `codex-rs/tui/src/cwd_prompt.rs` and `codex-rs/tui/src/update_prompt.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 4) codex-rs/tui/src/lib.rs:1516 — codex-rs/tui/src/lib.rs:1516-1525 | codex-rs/tui/src/lib.rs:1555-1565 | codex-rs/tui/src/lib.rs:1614-1623 | codex-rs/tui/src/lib.rs:1653-1663 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 4) codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:230 — codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:230-239 | codex-rs/ext/skills/src/dynamic_skill_selector/fielded_bm25.rs:226-235 | codex-rs/ext/skills/src/dynamic_skill_selector/routing_card_lexical.rs:245-254 | codex-rs/ext/skills/src/dynamic_skill_selector/weighted_lexical.rs:195-204 — before extracting anything, compare `codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs` and `codex-rs/ext/skills/src/dynamic_skill_selector/fielded_bm25.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×3
  • Duplicated block (10 lines × 3) codex-rs/core/src/session/mcp.rs:268 — codex-rs/core/src/session/mcp.rs:268-277 | codex-rs/core/src/session/mcp.rs:351-360 | codex-rs/core/src/session/mcp.rs:910-919 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 3) codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:219 — codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:219-228 | codex-rs/ext/skills/src/dynamic_skill_selector/fielded_bm25.rs:215-224 | codex-rs/ext/skills/src/dynamic_skill_selector/routing_card_lexical.rs:227-236 — before extracting anything, compare `codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs` and `codex-rs/ext/skills/src/dynamic_skill_selector/fielded_bm25.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 3) codex-rs/tui/src/app_server_session.rs:2471 — codex-rs/tui/src/app_server_session.rs:2471-2480 | codex-rs/tui/src/app_server_session.rs:2509-2518 | codex-rs/tui/src/app_server_session.rs:2546-2555 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×3
  • Duplicated block (7 lines × 4) codex-rs/app-server-daemon/src/backend/pid.rs:541 — codex-rs/app-server-daemon/src/backend/pid.rs:541-547 | codex-rs/app-server-daemon/src/backend/pid.rs:556-562 | codex-rs/app-server-daemon/src/backend/pid.rs:571-577 | codex-rs/app-server-daemon/src/backend/pid.rs:586-592 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 4) codex-rs/tui/src/bottom_pane/approval_overlay.rs:718 — codex-rs/tui/src/bottom_pane/approval_overlay.rs:718-724 | codex-rs/tui/src/bottom_pane/approval_overlay.rs:762-768 | codex-rs/tui/src/bottom_pane/approval_overlay.rs:791-797 | codex-rs/tui/src/bottom_pane/user_verification.rs:280-286 — before extracting anything, compare `codex-rs/tui/src/bottom_pane/approval_overlay.rs` and `codex-rs/tui/src/bottom_pane/user_verification.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 4) codex-rs/model-provider/src/amazon_bedrock/mantle.rs:36 — codex-rs/model-provider/src/amazon_bedrock/mantle.rs:36-42 | codex-rs/thread-store/src/local/helpers.rs:205-212 | codex-rs/tui/src/bottom_pane/chat_composer.rs:4269-4276 | codex-rs/tui/src/chatwidget/connectors.rs:396-403 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×3
  • Duplicated block (5 lines × 3) codex-rs/otel/src/events/session_telemetry.rs:801 — codex-rs/otel/src/events/session_telemetry.rs:801-805 | codex-rs/otel/src/events/session_telemetry.rs:857-861 | codex-rs/otel/src/events/session_telemetry.rs:901-905 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) codex-rs/network-proxy/src/runtime.rs:784 — codex-rs/network-proxy/src/runtime.rs:784-788 | codex-rs/network-proxy/src/runtime.rs:807-811 | codex-rs/network-proxy/src/runtime.rs:1236-1240 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) codex-rs/rollout-trace/src/reducer/code_cell.rs:761 — codex-rs/rollout-trace/src/reducer/code_cell.rs:761-765 | codex-rs/rollout-trace/src/reducer/tool.rs:518-522 | codex-rs/rollout-trace/src/reducer/tool/agents.rs:764-768 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
R4 · Test Coverage · No test reaches this file · ×3
  • No test reaches this file codex-cli/bin/codex.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file codex-rs/responses-api-proxy/npm/bin/codex-responses-api-proxy.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file codex-rs/code-mode-runtime/src/runtime/settled.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
AC3 · Page structure · Page without a main landmark · ×2
  • Page without a main landmark codex-rs/login/src/assets/error.html:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
  • Page without a main landmark codex-rs/login/src/assets/success_legacy.html:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
D1 · Cyclomatic Complexity · Config · ×2
  • Config::load_config_with_layer_stack (cyclomatic 105) codex-rs/core/src/config/mod.rs:3333 — Config::load_config_with_layer_stack has cyclomatic complexity 105 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Config::resolve_runtime_refresh (cyclomatic 19) codex-rs/core/src/config/runtime_refresh.rs:38 — Config::resolve_runtime_refresh has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · McpConnectionSet · ×2
  • McpConnectionSet::new (cyclomatic 88) codex-rs/codex-mcp/src/connection_manager.rs:350 — McpConnectionSet::new has cyclomatic complexity 88 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • McpConnectionSet::capture_binding_with_metadata (cyclomatic 43) codex-rs/codex-mcp/src/connection_manager/tool_catalog.rs:295 — McpConnectionSet::capture_binding_with_metadata has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExecutedToolCalls · ×2
  • ExecutedToolCalls::attach_pending_to_prompt_with_state (cyclomatic 75) codex-rs/core/src/tools/executed_tool_calls/request_metadata.rs:63 — ExecutedToolCalls::attach_pending_to_prompt_with_state has cyclomatic complexity 75 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ExecutedToolCalls::record_nested_tool_call (cyclomatic 16) codex-rs/core/src/tools/executed_tool_calls.rs:510 — ExecutedToolCalls::record_nested_tool_call has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · codex_connectors · ×2
  • codex_connectors::merge_directory_app (cyclomatic 54) codex-rs/connectors/src/lib.rs:306 — codex_connectors::merge_directory_app has cyclomatic complexity 54 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_connectors::merge::merge_connectors (cyclomatic 19) codex-rs/connectors/src/merge.rs:8 — codex_connectors::merge::merge_connectors has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RuntimeKeymap · ×2
  • RuntimeKeymap::from_config (cyclomatic 54) codex-rs/tui/src/keymap.rs:672 — RuntimeKeymap::from_config has cyclomatic complexity 54 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • RuntimeKeymap::validate_conflicts (cyclomatic 22) codex-rs/tui/src/keymap.rs:2017 — RuntimeKeymap::validate_conflicts has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: codex_tui::keymap::parse_keybinding (cyclomatic 25) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ListSelectionView · ×2
  • ListSelectionView::handle_key_event (cyclomatic 48) codex-rs/tui/src/bottom_pane/list_selection_view.rs:1289 — ListSelectionView::handle_key_event has cyclomatic complexity 48 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • ListSelectionView::render (cyclomatic 27) codex-rs/tui/src/bottom_pane/list_selection_view.rs:1617 — ListSelectionView::render has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PickerState · ×2
  • PickerState::handle_key (cyclomatic 47) codex-rs/tui/src/resume_picker.rs:1357 — PickerState::handle_key has cyclomatic complexity 47 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • PickerState::handle_background_event (cyclomatic 18) codex-rs/tui/src/resume_picker.rs:1611 — PickerState::handle_background_event has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_protocol · ×2
  • codex_protocol::permission_profile_intersection::intersect_effective_permission_profiles (cyclomatic 46) codex-rs/protocol/src/permission_profile_intersection.rs:37 — codex_protocol::permission_profile_intersection::intersect_effective_permission_profiles has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_protocol::permission_profile_intersection::normalize_policy (cyclomatic 16) codex-rs/protocol/src/permission_profile_intersection.rs:275 — codex_protocol::permission_profile_intersection::normalize_policy has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncQuestions · ×2
  • AsyncQuestions::handle_key_event (cyclomatic 41) codex-rs/tui/src/bottom_pane/async_questions/input.rs:155 — AsyncQuestions::handle_key_event has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AsyncQuestions::footer_lines (cyclomatic 17) codex-rs/tui/src/bottom_pane/async_questions/render.rs:168 — AsyncQuestions::footer_lines has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PluginRequestProcessor · ×2
  • PluginRequestProcessor::plugin_list_response (cyclomatic 39) codex-rs/app-server/src/request_processors/plugins.rs:549 — PluginRequestProcessor::plugin_list_response has cyclomatic complexity 39 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • PluginRequestProcessor::plugin_search_response (cyclomatic 28) codex-rs/app-server/src/request_processors/plugins/search.rs:25 — PluginRequestProcessor::plugin_search_response has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PidBackend · ×2
  • PidBackend::start_inner (cyclomatic 36) codex-rs/app-server-daemon/src/backend/pid_start.rs:21 — PidBackend::start_inner has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PidBackend::stop_with_grace (cyclomatic 18) codex-rs/app-server-daemon/src/backend/pid.rs:171 — PidBackend::stop_with_grace has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BottomPane · ×2
  • BottomPane::renderable_for_views (cyclomatic 36) codex-rs/tui/src/bottom_pane/mod.rs:2418 — BottomPane::renderable_for_views has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • BottomPane::handle_key_event_with_activation_key (cyclomatic 31) codex-rs/tui/src/bottom_pane/mod.rs:858 — BottomPane::handle_key_event_with_activation_key has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_app_server_protocol · ×2
  • codex_app_server_protocol::protocol::event_mapping::item_event_to_server_notification (cyclomatic 35) codex-rs/app-server-protocol/src/protocol/event_mapping.rs:30 — codex_app_server_protocol::protocol::event_mapping::item_event_to_server_notification has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • codex_app_server_protocol::export::build_schema_bundle (cyclomatic 16) codex-rs/app-server-protocol/src/export.rs:1020 — codex_app_server_protocol::export::build_schema_bundle has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EventProcessorWithJsonOutput · ×2
  • EventProcessorWithJsonOutput::map_item_with_id (cyclomatic 35) codex-rs/exec/src/event_processor_with_jsonl_output.rs:143 — EventProcessorWithJsonOutput::map_item_with_id has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EventProcessorWithJsonOutput::collect_thread_events (cyclomatic 28) codex-rs/exec/src/event_processor_with_jsonl_output.rs:423 — EventProcessorWithJsonOutput::collect_thread_events has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · CredentialBrokerState · ×2
  • CredentialBrokerState::register (cyclomatic 32) codex-rs/network-proxy/src/credential_broker.rs:1612 — CredentialBrokerState::register has cyclomatic complexity 32 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • CredentialBrokerState::environment (cyclomatic 18) codex-rs/network-proxy/src/credential_broker/environment.rs:117 — CredentialBrokerState::environment has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExternalAgentConfigService · ×2
  • ExternalAgentConfigService::import (cyclomatic 31) codex-rs/external-agent-migration/src/service.rs:203 — ExternalAgentConfigService::import has cyclomatic complexity 31 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • ExternalAgentConfigService::detect_migrations (cyclomatic 26) codex-rs/external-agent-migration/src/detect/mod.rs:79 — ExternalAgentConfigService::detect_migrations has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EventProcessorWithHumanOutput · ×2
  • EventProcessorWithHumanOutput::process_server_notification (cyclomatic 30) codex-rs/exec/src/event_processor_with_human_output.rs:229 — EventProcessorWithHumanOutput::process_server_notification has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • EventProcessorWithHumanOutput::render_item_completed (cyclomatic 22) codex-rs/exec/src/event_processor_with_human_output.rs:100 — EventProcessorWithHumanOutput::render_item_completed has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · FileSystemSandboxPolicy · ×2
  • FileSystemSandboxPolicy::to_legacy_sandbox_policy (cyclomatic 29) codex-rs/protocol/src/permissions.rs:1854 — FileSystemSandboxPolicy::to_legacy_sandbox_policy has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FileSystemSandboxPolicy::get_writable_roots_with_cwd_impl (cyclomatic 18) codex-rs/protocol/src/permissions.rs:1549 — FileSystemSandboxPolicy::get_writable_roots_with_cwd_impl has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · JsonSchemaTypeRenderer · ×2
  • JsonSchemaTypeRenderer::render_map (cyclomatic 28) codex-rs/code-mode-protocol/src/json_schema_types.rs:82 — JsonSchemaTypeRenderer::render_map has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • JsonSchemaTypeRenderer::render_object (cyclomatic 17) codex-rs/code-mode-protocol/src/json_schema_types.rs:325 — JsonSchemaTypeRenderer::render_object has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConfigDocument · ×2
  • ConfigDocument::apply (cyclomatic 28) codex-rs/core/src/config/edit.rs:218 — ConfigDocument::apply has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ConfigDocument::set_skill_config (cyclomatic 23) codex-rs/core/src/config/edit.rs:499 — ConfigDocument::set_skill_config has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_state · ×2
  • codex_state::runtime::threads::push_thread_filters_with_preview (cyclomatic 26) codex-rs/state/src/runtime/threads.rs:1446 — codex_state::runtime::threads::push_thread_filters_with_preview has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • codex_state::runtime::reclamation::reclaim_pages (cyclomatic 18) codex-rs/state/src/runtime/reclamation.rs:278 — codex_state::runtime::reclamation::reclaim_pages has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ThreadEventStore · ×2
  • ThreadEventStore::snapshot (cyclomatic 24) codex-rs/tui/src/app/thread_events.rs:370 — ThreadEventStore::snapshot has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ThreadEventStore::push_notification_inner (cyclomatic 23) codex-rs/tui/src/app/thread_events.rs:189 — ThreadEventStore::push_notification_inner has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · codex_apply_patch · ×2
  • codex_apply_patch::seek_sequence::seek_sequence (cyclomatic 23) codex-rs/apply-patch/src/seek_sequence.rs:12 — codex_apply_patch::seek_sequence::seek_sequence has cyclomatic complexity 23 (threshold 15). Of this number, 19 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_apply_patch::file_update::compute_replacements (cyclomatic 16) codex-rs/apply-patch/src/file_update.rs:60 — codex_apply_patch::file_update::compute_replacements has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AppLinkView · ×2
  • AppLinkView::activate_selected_action (cyclomatic 22) codex-rs/tui/src/bottom_pane/app_link_view.rs:413 — AppLinkView::activate_selected_action has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • AppLinkView::link_content_lines (cyclomatic 16) codex-rs/tui/src/bottom_pane/app_link_view.rs:481 — AppLinkView::link_content_lines has cyclomatic complexity 16 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · Renderer · ×2
  • Renderer::frame (cyclomatic 21) codex-rs/tui/src/empty_state_animation/renderer.rs:52 — Renderer::frame has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Renderer::annotate_selection (cyclomatic 19) codex-rs/tui/src/analytics/plot/annotations.rs:45 — Renderer::annotate_selection has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TranscriptOverlay · ×2
  • TranscriptOverlay::handle_key (cyclomatic 21) codex-rs/tui/src/pager_overlay/transcript.rs:455 — TranscriptOverlay::handle_key has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • TranscriptOverlay::handle_event (cyclomatic 18) codex-rs/tui/src/pager_overlay/transcript.rs:194 — TranscriptOverlay::handle_event has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_app_server_transport · ×2
  • codex_app_server_transport::transport::stdio::start_stdio_connection (cyclomatic 20) codex-rs/app-server-transport/src/transport/stdio.rs:28 — codex_app_server_transport::transport::stdio::start_stdio_connection has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_app_server_transport::transport::websocket::run_websocket_inbound_loop (cyclomatic 16) codex-rs/app-server-transport/src/transport/websocket.rs:403 — codex_app_server_transport::transport::websocket::run_websocket_inbound_loop has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · McpRequestProcessor · ×2
  • McpRequestProcessor::mcp_server_oauth_login_response (cyclomatic 19) codex-rs/app-server/src/request_processors/mcp_processor.rs:132 — McpRequestProcessor::mcp_server_oauth_login_response has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • McpRequestProcessor::list_mcp_server_status_response (cyclomatic 18) codex-rs/app-server/src/request_processors/mcp_processor.rs:398 — McpRequestProcessor::list_mcp_server_status_response has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_windows_sandbox_service · ×2
  • codex_windows_sandbox_service::package_lifecycle::cleanup::clean_up (cyclomatic 19) codex-rs/windows-sandbox-service/src/package_lifecycle/cleanup.rs:23 — codex_windows_sandbox_service::package_lifecycle::cleanup::clean_up has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • codex_windows_sandbox_service::machine_policy::validate_requirements (cyclomatic 17) codex-rs/windows-sandbox-service/src/machine_policy.rs:106 — codex_windows_sandbox_service::machine_policy::validate_requirements has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ReviewRequest · ×2
  • ReviewRequest::review (cyclomatic 18) codex-rs/ext/guardian-reviewer/src/review.rs:96 — ReviewRequest::review has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ReviewRequest::decide (cyclomatic 17) codex-rs/ext/guardian-reviewer/src/routing.rs:67 — ReviewRequest::decide has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · codex_skills_extension · ×2
  • codex_skills_extension::loader::discovery::discover_skills (cyclomatic 17) codex-rs/ext/skills/src/loader/discovery.rs:54 — codex_skills_extension::loader::discovery::discover_skills has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • codex_skills_extension::loader::host::load_skills_under_root (cyclomatic 17) codex-rs/ext/skills/src/loader/host.rs:146 — codex_skills_extension::loader::host::load_skills_under_root has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Daemon · ×2
  • Daemon::try_restart_if_running (cyclomatic 16) codex-rs/app-server-daemon/src/lib.rs:542 — Daemon::try_restart_if_running has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Daemon::bootstrap_locked (cyclomatic 16) codex-rs/app-server-daemon/src/lib.rs:860 — Daemon::bootstrap_locked has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RealtimeWebsocketEvents · ×2
  • RealtimeWebsocketEvents::next_event (cyclomatic 16) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:573 — RealtimeWebsocketEvents::next_event has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • RealtimeWebsocketEvents::update_active_transcript (cyclomatic 16) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:673 — RealtimeWebsocketEvents::update_active_transcript has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D10 · Test Quality · No assertions · ×2
  • No assertions: does not introduce shipping, intermediate, or modern official conformance regressions sdk/typescript/tests/mcpConformance.test.ts:39 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: does not introduce production reviewer or catalog-boundary regressions sdk/typescript/tests/mcpConformance.test.ts:102 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
D2 · Cognitive Complexity · ExecutedToolCalls · ×2
  • ExecutedToolCalls::attach_pending_to_prompt_with_state (cognitive 132) codex-rs/core/src/tools/executed_tool_calls/request_metadata.rs:63 — ExecutedToolCalls::attach_pending_to_prompt_with_state has cognitive complexity 132 (threshold 15). Drivers by points: if/else 37 (82 pts), boolean chains 28, loops 10 (17 pts), match/switch 2 (5 pts) (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExecutedToolCalls::record_nested_tool_call (cognitive 21) codex-rs/core/src/tools/executed_tool_calls.rs:510 — ExecutedToolCalls::record_nested_tool_call has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · codex_guardian_context · ×2
  • codex_guardian_context::transcript::collect_transcript_for_target (cognitive 84) codex-rs/guardian-context/src/transcript.rs:137 — codex_guardian_context::transcript::collect_transcript_for_target has cognitive complexity 84 (threshold 15). Drivers by points: if/else 21 (56 pts), match/switch 9 (25 pts), boolean chains 2, loops 1 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_guardian_context::retained_instructions::render_retained_instructions (cognitive 17) codex-rs/guardian-context/src/retained_instructions.rs:95 — codex_guardian_context::retained_instructions::render_retained_instructions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExecServerClient · ×2
  • ExecServerClient::spawn_rpc_reader (cognitive 69) codex-rs/exec-server/src/client_recovery.rs:604 — ExecServerClient::spawn_rpc_reader has cognitive complexity 69 (threshold 15). Drivers by points: if/else 12 (38 pts), match/switch 8 (25 pts), boolean chains 5, loops 1 (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExecServerClient::start_process (cognitive 22) codex-rs/exec-server/src/client.rs:1127 — ExecServerClient::start_process has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AccountRequestProcessor · ×2
  • AccountRequestProcessor::read_account (cognitive 62) codex-rs/app-server/src/request_processors/account_processor/workspace_routing.rs:281 — AccountRequestProcessor::read_account has cognitive complexity 62 (threshold 15). Drivers by points: if/else 19 (44 pts), match/switch 5 (9 pts), boolean chains 6, loops 1 (3 pts) (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • AccountRequestProcessor::get_auth_status_response (cognitive 23) codex-rs/app-server/src/request_processors/account_processor.rs:1071 — AccountRequestProcessor::get_auth_status_response has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 2 (6 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_connectors · ×2
  • codex_connectors::merge_directory_app (cognitive 61) codex-rs/connectors/src/lib.rs:306 — codex_connectors::merge_directory_app has cognitive complexity 61 (threshold 15). Drivers by points: if/else 31 (37 pts), boolean chains 24 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_connectors::merge::merge_connectors (cognitive 23) codex-rs/connectors/src/merge.rs:8 — codex_connectors::merge::merge_connectors has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 7, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileSystemSandboxPolicy · ×2
  • FileSystemSandboxPolicy::to_legacy_sandbox_policy (cognitive 61) codex-rs/protocol/src/permissions.rs:1854 — FileSystemSandboxPolicy::to_legacy_sandbox_policy has cognitive complexity 61 (threshold 15). Drivers by points: if/else 17 (42 pts), match/switch 4 (13 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 35). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • FileSystemSandboxPolicy::get_writable_roots_with_cwd_impl (cognitive 23) codex-rs/protocol/src/permissions.rs:1549 — FileSystemSandboxPolicy::get_writable_roots_with_cwd_impl has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 4, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · McpManager · ×2
  • McpManager::runtime_config_with_context (cognitive 58) codex-rs/core/src/mcp.rs:271 — McpManager::runtime_config_with_context has cognitive complexity 58 (threshold 15). Drivers by points: if/else 14 (36 pts), loops 6 (11 pts), boolean chains 6, match/switch 2 (5 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • McpManager::selected_plugins_for_step (cognitive 20) codex-rs/core/src/mcp.rs:217 — McpManager::selected_plugins_for_step has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JsonSchemaTypeRenderer · ×2
  • JsonSchemaTypeRenderer::render_map (cognitive 54) codex-rs/code-mode-protocol/src/json_schema_types.rs:82 — JsonSchemaTypeRenderer::render_map has cognitive complexity 54 (threshold 15). Drivers by points: if/else 20 (41 pts), loops 5 (11 pts), boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • JsonSchemaTypeRenderer::render_object (cognitive 31) codex-rs/code-mode-protocol/src/json_schema_types.rs:325 — JsonSchemaTypeRenderer::render_object has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 3 (7 pts), boolean chains 4 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncQuestions · ×2
  • AsyncQuestions::handle_key_event (cognitive 52) codex-rs/tui/src/bottom_pane/async_questions/input.rs:155 — AsyncQuestions::handle_key_event has cognitive complexity 52 (threshold 15). Drivers by points: if/else 25 (39 pts), boolean chains 10, match/switch 1 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AsyncQuestions::footer_lines (cognitive 24) codex-rs/tui/src/bottom_pane/async_questions/render.rs:168 — AsyncQuestions::footer_lines has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 4, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WsStream · ×2
  • WsStream::new (cognitive 44) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:84 — WsStream::new has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (31 pts), match/switch 4 (12 pts), loops 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • WsStream::new (cognitive 31) codex-rs/codex-api/src/endpoint/responses_websocket.rs:66 — WsStream::new has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (22 pts), match/switch 3 (8 pts), loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CredentialProviderEdits · ×2
  • CredentialProviderEdits::validate_remapping (cognitive 42) codex-rs/app-server/src/config_manager_service_credential_edits.rs:174 — CredentialProviderEdits::validate_remapping has cognitive complexity 42 (threshold 15). Drivers by points: if/else 9 (29 pts), loops 4 (8 pts), boolean chains 5 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CredentialProviderEdits::apply_provider_merge (cognitive 22) codex-rs/app-server/src/config_manager_service_credential_edits.rs:83 — CredentialProviderEdits::apply_provider_merge has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PluginContributor · ×2
  • PluginContributor::selected_plugins (cognitive 41) codex-rs/ext/mcp/src/plugin.rs:247 — PluginContributor::selected_plugins has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 5 (11 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PluginContributor::refresh_cloud_catalog (cognitive 17) codex-rs/ext/mcp/src/cloud_plugin.rs:38 — PluginContributor::refresh_cloud_catalog has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, match/switch 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ConfigDocument · ×2
  • ConfigDocument::set_skill_config (cognitive 38) codex-rs/core/src/config/edit.rs:499 — ConfigDocument::set_skill_config has cognitive complexity 38 (threshold 15). Drivers by points: if/else 19 (33 pts), match/switch 3, loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ConfigDocument::apply (cognitive 19) codex-rs/core/src/config/edit.rs:218 — ConfigDocument::apply has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, loops 1 (3 pts), match/switch 2 (3 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · RolloutRecorder · ×2
  • RolloutRecorder::list_threads_with_db_fallback (cognitive 38) codex-rs/rollout/src/recorder.rs:544 — RolloutRecorder::list_threads_with_db_fallback has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 3 (7 pts), boolean chains 3, match/switch 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RolloutRecorder::find_latest_thread_path (cognitive 18) codex-rs/rollout/src/recorder.rs:816 — RolloutRecorder::find_latest_thread_path has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PickerState · ×2
  • PickerState::handle_key (cognitive 38) codex-rs/tui/src/resume_picker.rs:1357 — PickerState::handle_key has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 12, match/switch 2 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PickerState::handle_background_event (cognitive 22) codex-rs/tui/src/resume_picker.rs:1611 — PickerState::handle_background_event has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 4 (7 pts), boolean chains 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ConnectionDriver · ×2
  • ConnectionDriver::complete_request (cognitive 36) codex-rs/code-mode/src/remote_session/connection/driver/responses.rs:149 — ConnectionDriver::complete_request has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (19 pts), match/switch 7 (14 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ConnectionDriver::run (cognitive 20) codex-rs/code-mode/src/remote_session/connection/driver.rs:83 — ConnectionDriver::run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (15 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JsonRpcConnection · ×2
  • JsonRpcConnection::from_stdio_with_max_message_len (cognitive 36) codex-rs/exec-server/src/connection.rs:313 — JsonRpcConnection::from_stdio_with_max_message_len has cognitive complexity 36 (threshold 15). Drivers by points: if/else 8 (23 pts), match/switch 3 (9 pts), boolean chains 2, loops 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • JsonRpcConnection::from_websocket_stream (cognitive 26) codex-rs/exec-server/src/connection.rs:509 — JsonRpcConnection::from_websocket_stream has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (14 pts), match/switch 4 (11 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StatusHistoryCell · ×2
  • StatusHistoryCell::content_lines (cognitive 36) codex-rs/tui/src/status/card.rs:735 — StatusHistoryCell::content_lines has cognitive complexity 36 (threshold 15). Drivers by points: if/else 29 (31 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • StatusHistoryCell::rate_limit_row_lines (cognitive 19) codex-rs/tui/src/status/card.rs:492 — StatusHistoryCell::rate_limit_row_lines has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpRequestProcessor · ×2
  • McpRequestProcessor::list_mcp_server_status_response (cognitive 33) codex-rs/app-server/src/request_processors/mcp_processor.rs:398 — McpRequestProcessor::list_mcp_server_status_response has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 8 (10 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • McpRequestProcessor::mcp_server_oauth_login_response (cognitive 28) codex-rs/app-server/src/request_processors/mcp_processor.rs:132 — McpRequestProcessor::mcp_server_oauth_login_response has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (15 pts), match/switch 6 (11 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_cloud_tasks_client · ×2
  • codex_cloud_tasks_client::http::api::extract_assistant_messages_from_body (cognitive 31) codex-rs/cloud-tasks-client/src/http.rs:587 — codex_cloud_tasks_client::http::api::extract_assistant_messages_from_body has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (23 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • codex_cloud_tasks_client::http::api::extract_assistant_messages_from_turn (cognitive 19) codex-rs/cloud-tasks-client/src/http.rs:689 — codex_cloud_tasks_client::http::api::extract_assistant_messages_from_turn has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AppsRequestProcessor · ×2
  • AppsRequestProcessor::apps_list_response (cognitive 30) codex-rs/app-server/src/request_processors/apps_processor.rs:168 — AppsRequestProcessor::apps_list_response has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 8, match/switch 4 (7 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AppsRequestProcessor::apps_installed (cognitive 19) codex-rs/app-server/src/request_processors/apps_processor/installed.rs:35 — AppsRequestProcessor::apps_installed has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ShellSnapshotFile · ×2
  • ShellSnapshotFile::restore_credentials (cognitive 30) codex-rs/core/src/shell_snapshot.rs:367 — ShellSnapshotFile::restore_credentials has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 6, loops 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ShellSnapshotFile::restore_fail_open_aliases (cognitive 27) codex-rs/core/src/shell_snapshot.rs:466 — ShellSnapshotFile::restore_fail_open_aliases has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReviewRequest · ×2
  • ReviewRequest::review (cognitive 29) codex-rs/ext/guardian-reviewer/src/review.rs:96 — ReviewRequest::review has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ReviewRequest::decide (cognitive 16) codex-rs/ext/guardian-reviewer/src/routing.rs:67 — ReviewRequest::decide has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, match/switch 3 (5 pts), boolean chains 4 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RollbackPlanner · ×2
  • RollbackPlanner::apply_rollback (cognitive 29) codex-rs/thread-store/src/local/rollout_migration/rollback_plan.rs:437 — RollbackPlanner::apply_rollback has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RollbackPlanner::observe (cognitive 28) codex-rs/thread-store/src/local/rollout_migration/rollback_plan.rs:137 — RollbackPlanner::observe has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 5, match/switch 3 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · codex_guardian_v2 · ×2
  • codex_guardian_v2::async_scorer::approval::cached_evidence (cognitive 28) codex-rs/ext/guardian-v2/src/async_scorer/approval.rs:182 — codex_guardian_v2::async_scorer::approval::cached_evidence has cognitive complexity 28 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 4, match/switch 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • codex_guardian_v2::async_scorer::decisions::request_body (cognitive 18) codex-rs/ext/guardian-v2/src/async_scorer/decisions.rs:221 — codex_guardian_v2::async_scorer::decisions::request_body has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EventProcessorWithJsonOutput · ×2
  • EventProcessorWithJsonOutput::collect_thread_events (cognitive 27) codex-rs/exec/src/event_processor_with_jsonl_output.rs:423 — EventProcessorWithJsonOutput::collect_thread_events has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 6 (12 pts) (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • EventProcessorWithJsonOutput::map_item_with_id (cognitive 19) codex-rs/exec/src/event_processor_with_jsonl_output.rs:143 — EventProcessorWithJsonOutput::map_item_with_id has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 9 (17 pts), if/else 1 (2 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · OnboardingScreen · ×2
  • OnboardingScreen::render_ref (cognitive 27) codex-rs/tui/src/onboarding/onboarding_screen.rs:425 — OnboardingScreen::render_ref has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 5, loops 4 (5 pts), match/switch 1 (2 pts) (nesting depth added 8). Of this number, 15 points are the body's own statements and 12 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • OnboardingScreen::handle_key_event (cognitive 17) codex-rs/tui/src/onboarding/onboarding_screen.rs:351 — OnboardingScreen::handle_key_event has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_websocket_client · ×2
  • codex_websocket_client::dialer::connect_happy_eyeballs (cognitive 26) codex-rs/websocket-client/src/dialer.rs:279 — codex_websocket_client::dialer::connect_happy_eyeballs has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 3 (8 pts), loops 3, boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_websocket_client::dialer::connect (cognitive 16) codex-rs/websocket-client/src/dialer.rs:42 — codex_websocket_client::dialer::connect has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 5 (9 pts), if/else 4 (6 pts), boolean chains 1 (nesting depth added 6). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AuthModeWidget · ×2
  • AuthModeWidget::handle_api_key_entry_key_event (cognitive 25) codex-rs/tui/src/onboarding/auth.rs:760 — AuthModeWidget::handle_api_key_entry_key_event has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (21 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AuthModeWidget::render_pick_mode (cognitive 19) codex-rs/tui/src/onboarding/auth.rs:439 — AuthModeWidget::render_pick_mode has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (16 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ChatComposerHistory · ×2
  • ChatComposerHistory::advance_search_from (cognitive 24) codex-rs/tui/src/bottom_pane/chat_composer_history.rs:714 — ChatComposerHistory::advance_search_from has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ChatComposerHistory::on_entry_response (cognitive 19) codex-rs/tui/src/bottom_pane/chat_composer_history.rs:484 — ChatComposerHistory::on_entry_response has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_prompts · ×2
  • codex_prompts::update_plan_instructions::without_update_plan_instructions (cognitive 23) codex-rs/prompts/src/update_plan_instructions.rs:4 — codex_prompts::update_plan_instructions::without_update_plan_instructions has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 7, loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • codex_prompts::permissions_instructions::approval_text (cognitive 22) codex-rs/prompts/src/permissions_instructions.rs:291 — codex_prompts::permissions_instructions::approval_text has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 4 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalProcess · ×2
  • LocalProcess::start_process (cognitive 22) codex-rs/exec-server/src/local_process.rs:278 — LocalProcess::start_process has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 5, match/switch 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • LocalProcess::exec_read (cognitive 20) codex-rs/exec-server/src/local_process.rs:554 — LocalProcess::exec_read has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EventProcessorWithHumanOutput · ×2
  • EventProcessorWithHumanOutput::process_server_notification (cognitive 21) codex-rs/exec/src/event_processor_with_human_output.rs:229 — EventProcessorWithHumanOutput::process_server_notification has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 3 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • EventProcessorWithHumanOutput::render_item_completed (cognitive 17) codex-rs/exec/src/event_processor_with_human_output.rs:100 — EventProcessorWithHumanOutput::render_item_completed has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 4 (7 pts), if/else 3 (6 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · StateRuntime · ×2
  • StateRuntime::prune_logs_after_insert (cognitive 21) codex-rs/state/src/runtime/logs.rs:55 — StateRuntime::prune_logs_after_insert has cognitive complexity 21 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 6 (9 pts), boolean chains 2 (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • StateRuntime::start_periodic_logs_maintenance (cognitive 21) codex-rs/state/src/runtime/logs_maintenance.rs:14 — StateRuntime::start_periodic_logs_maintenance has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HooksBrowserView · ×2
  • HooksBrowserView::event_table_lines (cognitive 21) codex-rs/tui/src/bottom_pane/hooks_browser_view.rs:303 — HooksBrowserView::event_table_lines has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • HooksBrowserView::render_footer (cognitive 18) codex-rs/tui/src/bottom_pane/hooks_browser_view.rs:519 — HooksBrowserView::render_footer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ConnectionPool · ×2
  • ConnectionPool::lease (cognitive 20) codex-rs/ext/guardian-v2/src/async_scorer/sampler/connection_pool.rs:211 — ConnectionPool::lease has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 3 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ConnectionPool::start_refill (cognitive 18) codex-rs/ext/guardian-v2/src/async_scorer/sampler/connection_pool.rs:150 — ConnectionPool::start_refill has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ThreadEventStore · ×2
  • ThreadEventStore::snapshot (cognitive 20) codex-rs/tui/src/app/thread_events.rs:370 — ThreadEventStore::snapshot has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (8 pts), match/switch 5 (6 pts), boolean chains 5, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ThreadEventStore::push_notification_inner (cognitive 18) codex-rs/tui/src/app/thread_events.rs:189 — ThreadEventStore::push_notification_inner has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, match/switch 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · InlineDirectives · ×2
  • InlineDirectives::events (cognitive 20) codex-rs/tui/src/markdown_render/inline_directives.rs:152 — InlineDirectives::events has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 1 (3 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InlineDirectives::new (cognitive 18) codex-rs/tui/src/markdown_render/inline_directives.rs:56 — InlineDirectives::new has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D3 · God Classes · TooManyFunctions · ×2
  • TooManyFunctions: codex_tui::multi_agents codex-rs/tui/src/multi_agents.rs:76 — TooManyFunctions — 35 free functions. The bar is 30 free functions; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: codex_tui::render::highlight codex-rs/tui/src/render/highlight.rs:84 — TooManyFunctions — 34 free functions. The bar is 30 free functions; this is 4 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Duplicated block (26–27 lines × 2) · ×2
  • Duplicated block (26–27 lines × 2) codex-rs/app-server/src/bin/exec_server.rs:16 — codex-rs/app-server/src/bin/exec_server.rs:16-42 | codex-rs/exec-server/testing/exec_server.rs:15-40 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (26–27 lines × 2) sdk/python/src/openai_codex/_run.py:73 — sdk/python/src/openai_codex/_run.py:73-99 | sdk/python/src/openai_codex/_run.py:110-135 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×2
  • Duplicated block (24 lines × 2) codex-rs/code-mode-runtime/src/cell_actor/mod.rs:324 — codex-rs/code-mode-runtime/src/cell_actor/mod.rs:324-347 | codex-rs/code-mode-runtime/src/cell_actor/mod.rs:480-503 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (24 lines × 2) codex-rs/rollout-trace/src/protocol_event.rs:186 — codex-rs/rollout-trace/src/protocol_event.rs:186-209 | codex-rs/rollout-trace/src/protocol_event.rs:248-271 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (20–21 lines × 2) · ×2
  • Duplicated block (20–21 lines × 2) codex-rs/tui/src/lib.rs:1585 — codex-rs/tui/src/lib.rs:1585-1605 | codex-rs/tui/src/lib.rs:1683-1702 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20–21 lines × 2) scripts/mcp_conformance/review_regressions.py:1202 — scripts/mcp_conformance/review_regressions.py:1202-1221 | scripts/mcp_conformance/run_codex_compliance.py:2129-2149 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/mcp_conformance/run_codex_compliance.py:2129` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (18–20 lines × 2) · ×2
  • Duplicated block (18–20 lines × 2) codex-rs/app-server/src/request_processors/plugins.rs:1559 — codex-rs/app-server/src/request_processors/plugins.rs:1559-1578 | codex-rs/app-server/src/request_processors/plugins.rs:1700-1717 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18–20 lines × 2) codex-rs/hooks/src/events/stop.rs:281 — codex-rs/hooks/src/events/stop.rs:281-298 | codex-rs/hooks/src/events/user_prompt_submit.rs:180-199 — before extracting anything, compare `codex-rs/hooks/src/events/stop.rs` and `codex-rs/hooks/src/events/user_prompt_submit.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×2
  • Duplicated block (18–19 lines × 2) codex-rs/external-agent-migration/src/hooks_cla.rs:179 — codex-rs/external-agent-migration/src/hooks_cla.rs:179-197 | codex-rs/external-agent-migration/src/hooks_cur.rs:110-127 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (18–19 lines × 2) codex-rs/tui/src/bottom_pane/textarea.rs:1477 — codex-rs/tui/src/bottom_pane/textarea.rs:1477-1495 | codex-rs/tui/src/bottom_pane/textarea.rs:1548-1565 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×2
  • Duplicated block (14–16 lines × 2) codex-rs/app-server-transport/src/transport/remote_control/mod.rs:524 — codex-rs/app-server-transport/src/transport/remote_control/mod.rs:524-537 | codex-rs/app-server-transport/src/transport/remote_control/mod.rs:751-766 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–16 lines × 2) codex-rs/exec/src/lib.rs:966 — codex-rs/exec/src/lib.rs:966-979 | codex-rs/exec/src/lib.rs:994-1009 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×2
  • Duplicated block (15–16 lines × 2) codex-rs/core/src/mcp_tool_call.rs:247 — codex-rs/core/src/mcp_tool_call.rs:247-261 | codex-rs/core/src/mcp_tool_call.rs:381-396 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15–16 lines × 2) codex-rs/thread-store/src/local/thread_history.rs:529 — codex-rs/thread-store/src/local/thread_history.rs:529-543 | codex-rs/thread-store/src/local/thread_history/search.rs:341-356 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×2
  • Duplicated block (11–13 lines × 2) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1694 — codex-rs/app-server-protocol/src/protocol/thread_history.rs:1694-1704 | codex-rs/thread-store/src/local/rollout_migration/legacy_event.rs:53-65 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11–13 lines × 2) codex-rs/cloud-tasks/src/lib.rs:1641 — codex-rs/cloud-tasks/src/lib.rs:1641-1651 | codex-rs/cloud-tasks/src/lib.rs:1978-1990 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12 lines × 5) · ×2
  • Duplicated block (12 lines × 5) codex-rs/shell-command/src/parse_command.rs:2518 — codex-rs/shell-command/src/parse_command.rs:2518-2529 | codex-rs/shell-command/src/parse_command.rs:2547-2558 | codex-rs/shell-command/src/parse_command.rs:2561-2572 | codex-rs/shell-command/src/parse_command.rs:2679-2690 | codex-rs/shell-command/src/parse_command.rs:2696-2707 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 5) codex-rs/shell-command/src/parse_command.rs:2517 — codex-rs/shell-command/src/parse_command.rs:2517-2529 | codex-rs/shell-command/src/parse_command.rs:2546-2558 | codex-rs/shell-command/src/parse_command.rs:2561-2572 | codex-rs/shell-command/src/parse_command.rs:2679-2690 | codex-rs/shell-command/src/parse_command.rs:2710-2721 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (11–12 lines × 3) · ×2
  • Duplicated block (11–12 lines × 3) codex-rs/app-server/src/command_exec.rs:395 — codex-rs/app-server/src/command_exec.rs:395-405 | codex-rs/app-server/src/outgoing_message.rs:627-638 | codex-rs/app-server/src/request_processors/process_exec_processor.rs:434-444 — before extracting anything, compare `codex-rs/app-server/src/command_exec.rs` and `codex-rs/app-server/src/request_processors/process_exec_processor.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (11–12 lines × 3) codex-rs/tui/src/app/startup.rs:611 — codex-rs/tui/src/app/startup.rs:611-621 | codex-rs/tui/src/app/startup.rs:761-772 | codex-rs/tui/src/app/startup.rs:874-885 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×2
  • Duplicated block (11 lines × 4) codex-rs/app-server/src/request_processors/apps_processor.rs:335 — codex-rs/app-server/src/request_processors/apps_processor.rs:335-345 | codex-rs/app-server/src/request_processors/mcp_processor.rs:120-130 | codex-rs/app-server/src/request_processors/thread_processor.rs:1046-1056 | codex-rs/app-server/src/request_processors/turn_processor.rs:378-388 — before extracting anything, compare `codex-rs/app-server/src/request_processors/thread_processor.rs` and `codex-rs/app-server/src/request_processors/turn_processor.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 4) codex-rs/core-plugins/src/remote.rs:2265 — codex-rs/core-plugins/src/remote.rs:2265-2275 | codex-rs/core-plugins/src/remote.rs:2287-2297 | codex-rs/core-plugins/src/remote.rs:2324-2334 | codex-rs/core-plugins/src/remote/share.rs:396-406 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (9–11 lines × 2) · ×2
  • Duplicated block (9–11 lines × 2) codex-rs/exec/src/lib.rs:1056 — codex-rs/exec/src/lib.rs:1056-1066 | codex-rs/exec/src/lib.rs:1152-1160 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–11 lines × 2) codex-rs/external-agent-migration/src/hooks_cla.rs:205 — codex-rs/external-agent-migration/src/hooks_cla.rs:205-213 | codex-rs/external-agent-migration/src/hooks_cur.rs:129-139 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×2
  • Duplicated block (7–9 lines × 2) codex-rs/external-agent-migration/src/hooks_common.rs:257 — codex-rs/external-agent-migration/src/hooks_common.rs:257-263 | codex-rs/external-agent-migration/src/utils.rs:49-57 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7–9 lines × 2) codex-rs/message-board/src/in_memory.rs:414 — codex-rs/message-board/src/in_memory.rs:414-420 | codex-rs/message-board/src/local.rs:325-333 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×2
  • Duplicated block (7–8 lines × 2) codex-rs/tui/src/app_server_session.rs:918 — codex-rs/tui/src/app_server_session.rs:918-925 | codex-rs/tui/src/app_server_session.rs:1125-1131 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7–8 lines × 2) codex-rs/app-server-test-client/src/lib.rs:672 — codex-rs/app-server-test-client/src/lib.rs:672-679 | codex-rs/app-server-test-client/src/lib.rs:705-711 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×2
  • Duplicated block (6–7 lines × 2) codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:1005 — codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:1005-1010 | codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:1098-1104 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6–7 lines × 2) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:589 — codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:589-594 | codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:635-641 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×2
  • Swallowed exception (caught, then discarded) sdk/python/src/openai_codex/async_client.py:273 — `except BaseException` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) sdk/python/src/openai_codex/async_client.py:320 — `except BaseException` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
AC6 · Visual & motion safety · Focus outline removed in CSS without a · ×1
  • Focus outline removed in CSS without a :focus replacement codex-rs/tui/assets/inline_visualization/visualize.css:771 — `.form-range` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
AC6 · Visual & motion safety · Animation without a prefers-reduced-motion guard · ×1
  • Animation without a prefers-reduced-motion guard codex-rs/tui/assets/inline_visualization/visualize.css:748 — `.form-switch .form-check-input::before` moves (`transition: transform 200ms cubic-bezier(0, 0, 0.2, 1)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
AC7 · A11y enforcement · Accessibility enforcement below the top rung · ×1
  • Accessibility enforcement below the top rung — No accessibility enforcement found — no a11y linter (an accessibility check that can read your UI — no component framework was detected and your pages are rendered by server-side templates, which neither the JSX/Vue ESLint plugins nor the HTML-template linters can parse; run axe/pa11y over the rendered pages, or assert the accessibility invariants over that rendered HTML in the test suite you already have) and no axe/pa11y/Lighthouse in tests or CI. Start by running that check over your rendered pages in CI. What was searched, so you can tell an absence from a miss: the 4 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
D1 · Cyclomatic Complexity · MessageProcessor · ×1
  • MessageProcessor::handle_initialized_client_request (cyclomatic 184) codex-rs/app-server/src/message_processor.rs:1098 — MessageProcessor::handle_initialized_client_request has cyclomatic complexity 184 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ConfigRequirementsWithSources · ×1
  • ConfigRequirementsWithSources::merge_unset_fields (cyclomatic 98) codex-rs/config/src/config_requirements.rs:1211 — ConfigRequirementsWithSources::merge_unset_fields has cyclomatic complexity 98 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MathMarkdown · ×1
  • MathMarkdown::new (cyclomatic 60) codex-rs/tui/src/markdown_render/math.rs:27 — MathMarkdown::new has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · run_codex_compliance._required_regression_checks (cyclomatic 56) · ×1
  • run_codex_compliance._required_regression_checks (cyclomatic 56) scripts/mcp_conformance/run_codex_compliance.py:1459 — run_codex_compliance._required_regression_checks has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NetworkApprovalService · ×1
  • NetworkApprovalService::handle_inline_policy_request (cyclomatic 48) codex-rs/core/src/tools/network_approval.rs:629 — NetworkApprovalService::handle_inline_policy_request has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ToolOrchestrator · ×1
  • ToolOrchestrator::run (cyclomatic 48) codex-rs/core/src/tools/orchestrator.rs:125 — ToolOrchestrator::run has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UnifiedExecRuntime · ×1
  • UnifiedExecRuntime::run (cyclomatic 48) codex-rs/core/src/tools/runtimes/unified_exec.rs:261 — UnifiedExecRuntime::run has cyclomatic complexity 48 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · codex_guardian_context · ×1
  • codex_guardian_context::transcript::collect_transcript_for_target (cyclomatic 47) codex-rs/guardian-context/src/transcript.rs:137 — codex_guardian_context::transcript::collect_transcript_for_target has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LinkPreview · ×1
  • LinkPreview::scan (cyclomatic 46) codex-rs/tui/src/streaming/prose_preview.rs:155 — LinkPreview::scan has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StreamingPatchParser · ×1
  • StreamingPatchParser::process_line (cyclomatic 45) codex-rs/apply-patch/src/streaming_parser.rs:175 — StreamingPatchParser::process_line has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StartupDraftPump · ×1
  • StartupDraftPump::handle_event (cyclomatic 45) codex-rs/tui/src/startup_draft_input.rs:24 — StartupDraftPump::handle_event has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · review_regressions._required_review_checks (cyclomatic 45) · ×1
  • review_regressions._required_review_checks (cyclomatic 45) scripts/mcp_conformance/review_regressions.py:859 — review_regressions._required_review_checks has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ThreadManagerState · ×1
  • ThreadManagerState::spawn_thread (cyclomatic 43) codex-rs/core/src/thread_manager.rs:2118 — ThreadManagerState::spawn_thread has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sandbox_smoketests.main (cyclomatic 43) · ×1
  • sandbox_smoketests.main (cyclomatic 43) codex-rs/windows-sandbox-rs/sandbox_smoketests.py:262 — sandbox_smoketests.main has cyclomatic complexity 43 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexExec.run (cyclomatic 41) · ×1
  • CodexExec.run (cyclomatic 41) sdk/typescript/src/exec.ts:94 — CodexExec.run has cyclomatic complexity 41 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ShellSnapshotCache · ×1
  • ShellSnapshotCache::prepare (cyclomatic 39) codex-rs/exec-server/src/shell_snapshot.rs:107 — ShellSnapshotCache::prepare has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Classification · ×1
  • Classification::run (cyclomatic 39) codex-rs/ext/guardian-v2/src/async_scorer/classification.rs:114 — Classification::run has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CollectedContext · ×1
  • CollectedContext::compose (cyclomatic 39) codex-rs/guardian-context/src/composition.rs:157 — CollectedContext::compose has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StreamableHttpClientAdapter · ×1
  • StreamableHttpClientAdapter::post_message (cyclomatic 38) codex-rs/rmcp-client/src/http_client_adapter.rs:145 — StreamableHttpClientAdapter::post_message has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · run_codex_compliance.main (cyclomatic 37) · ×1
  • run_codex_compliance.main (cyclomatic 37) scripts/mcp_conformance/run_codex_compliance.py:2108 — run_codex_compliance.main has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SamplingExecution · ×1
  • SamplingExecution::run (cyclomatic 36) codex-rs/ext/guardian-v2/src/async_scorer/sampler/execution.rs:179 — SamplingExecution::run has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_voice_host · ×1
  • codex_voice_host::run (cyclomatic 36) codex-rs/voice-host/src/main.rs:70 — codex_voice_host::run has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FeedbackRequestProcessor · ×1
  • FeedbackRequestProcessor::feedback_response (cyclomatic 35) codex-rs/app-server/src/request_processors/feedback_processor.rs:94 — FeedbackRequestProcessor::feedback_response has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ToolRegistry · ×1
  • ToolRegistry::dispatch_any_with_state (cyclomatic 35) codex-rs/core/src/tools/registry.rs:705 — ToolRegistry::dispatch_any_with_state has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GuardianV2Extension · ×1
  • GuardianV2Extension::score_tool (cyclomatic 35) codex-rs/ext/guardian-v2/src/async_scorer/observation.rs:53 — GuardianV2Extension::score_tool has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RollbackPlanner · ×1
  • RollbackPlanner::observe (cyclomatic 35) codex-rs/thread-store/src/local/rollout_migration/rollback_plan.rs:137 — RollbackPlanner::observe has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · NativeChild · ×1
  • NativeChild::spawn (cyclomatic 35) codex-rs/utils/pty/src/posix_child.rs:61 — NativeChild::spawn has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConfigManager · ×1
  • ConfigManager::apply_edits (cyclomatic 34) codex-rs/app-server/src/config_manager_service.rs:219 — ConfigManager::apply_edits has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConfigRequirements · ×1
  • ConfigRequirements::try_from (cyclomatic 34) codex-rs/config/src/config_requirements.rs:1784 — ConfigRequirements::try_from has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ComposedContext · ×1
  • ComposedContext::enforce_budget (cyclomatic 34) codex-rs/guardian-context/src/enforcement.rs:181 — ComposedContext::enforce_budget has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · run_codex_compliance._print_human_report (cyclomatic 34) · ×1
  • run_codex_compliance._print_human_report (cyclomatic 34) scripts/mcp_conformance/run_codex_compliance.py:1840 — run_codex_compliance._print_human_report has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExecServerClient · ×1
  • ExecServerClient::spawn_rpc_reader (cyclomatic 33) codex-rs/exec-server/src/client_recovery.rs:604 — ExecServerClient::spawn_rpc_reader has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DirectFileSystem · ×1
  • DirectFileSystem::sync_walk (cyclomatic 33) codex-rs/exec-server/src/local_file_system.rs:740 — DirectFileSystem::sync_walk has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ThreadMetadata · ×1
  • ThreadMetadata::diff_fields (cyclomatic 33) codex-rs/state/src/model/thread_metadata.rs:401 — ThreadMetadata::diff_fields has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StatusHistoryCell · ×1
  • StatusHistoryCell::content_lines (cyclomatic 32) codex-rs/tui/src/status/card.rs:735 — StatusHistoryCell::content_lines has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ContextProfile · ×1
  • ContextProfile::prepare_transcript (cyclomatic 31) codex-rs/guardian-context/src/profile.rs:116 — ContextProfile::prepare_transcript has cyclomatic complexity 31 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · run_codex_compliance._exercise_app_server (cyclomatic 31) · ×1
  • run_codex_compliance._exercise_app_server (cyclomatic 31) scripts/mcp_conformance/run_codex_compliance.py:742 — run_codex_compliance._exercise_app_server has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AccountRequestProcessor · ×1
  • AccountRequestProcessor::read_account (cyclomatic 30) codex-rs/app-server/src/request_processors/account_processor/workspace_routing.rs:281 — AccountRequestProcessor::read_account has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ElicitationRequestManager · ×1
  • ElicitationRequestManager::make_sender (cyclomatic 30) codex-rs/codex-mcp/src/elicitation.rs:428 — ElicitationRequestManager::make_sender has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · McpManager · ×1
  • McpManager::runtime_config_with_context (cyclomatic 29) codex-rs/core/src/mcp.rs:271 — McpManager::runtime_config_with_context has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RealtimeHistoryState · ×1
  • RealtimeHistoryState::observe (cyclomatic 29) codex-rs/core/src/realtime_history.rs:159 — RealtimeHistoryState::observe has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UnifiedExecProcess · ×1
  • UnifiedExecProcess::spawn_exec_server_output_task (cyclomatic 29) codex-rs/core/src/unified_exec/process.rs:452 — UnifiedExecProcess::spawn_exec_server_output_task has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ReadTool · ×1
  • ReadTool::handle (cyclomatic 29) codex-rs/ext/skills/src/tools/read.rs:114 — ReadTool::handle has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LegacyRolloutCanonicalizer · ×1
  • LegacyRolloutCanonicalizer::process_line (cyclomatic 29) codex-rs/thread-store/src/local/rollout_migration/canonicalizer.rs:104 — LegacyRolloutCanonicalizer::process_line has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ThreadMetadataPatch · ×1
  • ThreadMetadataPatch::merge (cyclomatic 29) codex-rs/thread-store/src/types.rs:846 — ThreadMetadataPatch::merge has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · codex_conformance_adapter.run_adapter (cyclomatic 29) · ×1
  • codex_conformance_adapter.run_adapter (cyclomatic 29) scripts/mcp_conformance/codex_conformance_adapter.py:702 — codex_conformance_adapter.run_adapter has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RemoteAppServerClient · ×1
  • RemoteAppServerClient::connect_with_stream (cyclomatic 28) codex-rs/app-server-client/src/remote.rs:241 — RemoteAppServerClient::connect_with_stream has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ThreadMetadataSync · ×1
  • ThreadMetadataSync::observe_items_with_update (cyclomatic 28) codex-rs/thread-store/src/thread_metadata_sync.rs:238 — ThreadMetadataSync::observe_items_with_update has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_tools · ×1
  • codex_tools::json_schema::sanitize_json_schema (cyclomatic 28) codex-rs/tools/src/json_schema.rs:91 — codex_tools::json_schema::sanitize_json_schema has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · McpServerElicitationOverlay · ×1
  • McpServerElicitationOverlay::handle_key_event (cyclomatic 28) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1536 — McpServerElicitationOverlay::handle_key_event has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · server.validate_modern_http_headers (cyclomatic 28) · ×1
  • server.validate_modern_http_headers (cyclomatic 28) scripts/mcp_conformance/server.py:1253 — server.validate_modern_http_headers has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CommandExecRequestProcessor · ×1
  • CommandExecRequestProcessor::exec_one_off_command_inner (cyclomatic 27) codex-rs/app-server/src/request_processors/command_exec_processor.rs:102 — CommandExecRequestProcessor::exec_one_off_command_inner has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ConnectionDriver · ×1
  • ConnectionDriver::complete_request (cyclomatic 27) codex-rs/code-mode/src/remote_session/connection/driver/responses.rs:149 — ConnectionDriver::complete_request has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · RequestPluginInstallHandler · ×1
  • RequestPluginInstallHandler::handle_call (cyclomatic 27) codex-rs/core/src/tools/handlers/request_plugin_install.rs:94 — RequestPluginInstallHandler::handle_call has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · QueuedItemService · ×1
  • QueuedItemService::watch_external_messages (cyclomatic 27) codex-rs/ext/queue/src/service.rs:92 — QueuedItemService::watch_external_messages has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OAuthHttpClientAdapter · ×1
  • OAuthHttpClientAdapter::execute_request (cyclomatic 27) codex-rs/rmcp-client/src/oauth_http_client.rs:213 — OAuthHttpClientAdapter::execute_request has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · review_regressions.main (cyclomatic 27) · ×1
  • review_regressions.main (cyclomatic 27) scripts/mcp_conformance/review_regressions.py:1193 — review_regressions.main has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · codex_guardian_v2 · ×1
  • codex_guardian_v2::async_scorer::approval::cached_evidence (cyclomatic 26) codex-rs/ext/guardian-v2/src/async_scorer/approval.rs:182 — codex_guardian_v2::async_scorer::approval::cached_evidence has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Features · ×1
  • Features::apply_map (cyclomatic 26) codex-rs/features/src/lib.rs:671 — Features::apply_map has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · review_regressions._run_catalog_boundary_checks (cyclomatic 26) · ×1
  • review_regressions._run_catalog_boundary_checks (cyclomatic 26) scripts/mcp_conformance/review_regressions.py:524 — review_regressions._run_catalog_boundary_checks has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ModelClientSession · ×1
  • ModelClientSession::stream_responses_websocket (cyclomatic 25) codex-rs/core/src/client.rs:2091 — ModelClientSession::stream_responses_websocket has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RemotePluginMeasurementCache · ×1
  • RemotePluginMeasurementCache::prepare (cyclomatic 25) codex-rs/core-plugins/src/plugin_measurement_references.rs:82 — RemotePluginMeasurementCache::prepare has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LocalProcess · ×1
  • LocalProcess::start_process (cyclomatic 25) codex-rs/exec-server/src/local_process.rs:278 — LocalProcess::start_process has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ProtocolServer._call_tool (cyclomatic 25) · ×1
  • ProtocolServer._call_tool (cyclomatic 25) scripts/mcp_conformance/server.py:625 — ProtocolServer._call_tool has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AppsRequestProcessor · ×1
  • AppsRequestProcessor::apps_list_response (cyclomatic 24) codex-rs/app-server/src/request_processors/apps_processor.rs:168 — AppsRequestProcessor::apps_list_response has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · GuardianApprovalReviewer · ×1
  • GuardianApprovalReviewer::decide_request (cyclomatic 24) codex-rs/ext/guardian-v2/src/async_scorer/approval.rs:53 — GuardianApprovalReviewer::decide_request has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SkillsExtension · ×1
  • SkillsExtension::contribute (cyclomatic 24) codex-rs/ext/skills/src/extension.rs:331 — SkillsExtension::contribute has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModelProviderInfo · ×1
  • ModelProviderInfo::validate (cyclomatic 24) codex-rs/model-provider-info/src/lib.rs:325 — ModelProviderInfo::validate has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CaptureWorker · ×1
  • CaptureWorker::service (cyclomatic 24) codex-rs/voice-host/src/capture_worker.rs:40 — CaptureWorker::service has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_conformance_adapter._exercise_auth_scenario (cyclomatic 24) · ×1
  • codex_conformance_adapter._exercise_auth_scenario (cyclomatic 24) scripts/mcp_conformance/codex_conformance_adapter.py:461 — codex_conformance_adapter._exercise_auth_scenario has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ScanState · ×1
  • ScanState::observe (cyclomatic 23) codex-rs/app-server-protocol/src/export.rs:933 — ScanState::observe has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExecCommandHandler · ×1
  • ExecCommandHandler::handle_call (cyclomatic 23) codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs:154 — ExecCommandHandler::handle_call has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · SessionState · ×1
  • SessionState::recover_events (cyclomatic 23) codex-rs/exec-server/src/client_recovery.rs:94 — SessionState::recover_events has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CapturedSnapshot · ×1
  • CapturedSnapshot::parse (cyclomatic 23) codex-rs/shell-command/src/shell_snapshot_capture.rs:303 — CapturedSnapshot::parse has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ManagedWorktreeTools · ×1
  • ManagedWorktreeTools::execute_inner (cyclomatic 23) codex-rs/tui/src/managed_worktree_tools.rs:120 — ManagedWorktreeTools::execute_inner has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · review_regressions._run_normal_review_checks (cyclomatic 23) · ×1
  • review_regressions._run_normal_review_checks (cyclomatic 23) scripts/mcp_conformance/review_regressions.py:296 — review_regressions._run_normal_review_checks has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · resolve_python_cli_release.resolve_release (cyclomatic 23) · ×1
  • resolve_python_cli_release.resolve_release (cyclomatic 23) .github/scripts/resolve_python_cli_release.py:26 — resolve_python_cli_release.resolve_release has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · verify_cargo_workspace_manifests.manifest_errors (cyclomatic 23) · ×1
  • verify_cargo_workspace_manifests.manifest_errors (cyclomatic 23) .github/scripts/verify_cargo_workspace_manifests.py:105 — verify_cargo_workspace_manifests.manifest_errors has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExternalAgentSessionImporter · ×1
  • ExternalAgentSessionImporter::persist_session (cyclomatic 22) codex-rs/app-server/src/external_agent_migration/session_importer.rs:391 — ExternalAgentSessionImporter::persist_session has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · SampleTask · ×1
  • SampleTask::run (cyclomatic 22) codex-rs/app-server/src/thread_sample.rs:106 — SampleTask::run has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · ClientSegmentReassembler · ×1
  • ClientSegmentReassembler::observe (cyclomatic 22) codex-rs/app-server-transport/src/transport/remote_control/segment.rs:53 — ClientSegmentReassembler::observe has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ModelClient · ×1
  • ModelClient::build_responses_request (cyclomatic 22) codex-rs/core/src/client.rs:1034 — ModelClient::build_responses_request has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ToolCallRuntime · ×1
  • ToolCallRuntime::handle_tool_call_with_source (cyclomatic 22) codex-rs/core/src/tools/parallel.rs:155 — ToolCallRuntime::handle_tool_call_with_source has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Discovery · ×1
  • Discovery::handle_reply (cyclomatic 22) codex-rs/rmcp-client/src/local_stdio_transport.rs:65 — Discovery::handle_reply has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · _GoalStreamCursor.process (cyclomatic 22) · ×1
  • _GoalStreamCursor.process (cyclomatic 22) sdk/python/src/openai_codex/_goal.py:260 — _GoalStreamCursor.process has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InitializeRequestProcessor · ×1
  • InitializeRequestProcessor::initialize (cyclomatic 21) codex-rs/app-server/src/request_processors/initialize_processor.rs:53 — InitializeRequestProcessor::initialize has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ThreadEnvironments · ×1
  • ThreadEnvironments::update_selections_with_bindings (cyclomatic 21) codex-rs/core/src/environment_selection.rs:478 — ThreadEnvironments::update_selections_with_bindings has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ReviewerPool · ×1
  • ReviewerPool::review (cyclomatic 21) codex-rs/ext/guardian-reviewer/src/pool.rs:184 — ReviewerPool::review has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_guardian_reviewer · ×1
  • codex_guardian_reviewer::completion::complete_review (cyclomatic 21) codex-rs/ext/guardian-reviewer/src/completion.rs:38 — codex_guardian_reviewer::completion::complete_review has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · RolloutRecorder · ×1
  • RolloutRecorder::list_threads_with_db_fallback (cyclomatic 21) codex-rs/rollout/src/recorder.rs:544 — RolloutRecorder::list_threads_with_db_fallback has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_skills · ×1
  • codex_skills::parser::repair_frontmatter_scalar_fields (cyclomatic 21) codex-rs/skills/src/parser.rs:98 — codex_skills::parser::repair_frontmatter_scalar_fields has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · McpToolCallCell · ×1
  • McpToolCallCell::compact_mcp_lines (cyclomatic 21) codex-rs/tui/src/history_cell/mcp_preview.rs:20 — McpToolCallCell::compact_mcp_lines has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_utils_sandbox_summary · ×1
  • codex_utils_sandbox_summary::sandbox_summary::summarize_permission_profile (cyclomatic 21) codex-rs/utils/sandbox-summary/src/sandbox_summary.rs:58 — codex_utils_sandbox_summary::sandbox_summary::summarize_permission_profile has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · stage_npm_packages.main (cyclomatic 21) · ×1
  • stage_npm_packages.main (cyclomatic 21) scripts/stage_npm_packages.py:497 — stage_npm_packages.main has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · wrapper_common.parse_wrapper_args (cyclomatic 21) · ×1
  • wrapper_common.parse_wrapper_args (cyclomatic 21) tools/argument-comment-lint/wrapper_common.py:53 — wrapper_common.parse_wrapper_args has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WsStream · ×1
  • WsStream::new (cyclomatic 20) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:84 — WsStream::new has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · McpServerConfig · ×1
  • McpServerConfig::try_from (cyclomatic 20) codex-rs/config/src/mcp_types.rs:464 — McpServerConfig::try_from has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ShellSnapshotFile · ×1
  • ShellSnapshotFile::restore_credentials (cyclomatic 20) codex-rs/core/src/shell_snapshot.rs:367 — ShellSnapshotFile::restore_credentials has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexAuth · ×1
  • CodexAuth::from_auth_dot_json (cyclomatic 20) codex-rs/login/src/auth/manager.rs:343 — CodexAuth::from_auth_dot_json has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BoardTool · ×1
  • BoardTool::execute (cyclomatic 20) codex-rs/message-board/src/tools.rs:149 — BoardTool::execute has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · codex_rollout_trace · ×1
  • codex_rollout_trace::protocol_event::tool_runtime_trace_event (cyclomatic 20) codex-rs/rollout-trace/src/protocol_event.rs:280 — codex_rollout_trace::protocol_event::tool_runtime_trace_event has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · VoiceStrip · ×1
  • VoiceStrip::render (cyclomatic 20) codex-rs/tui/src/bottom_pane/voice_strip.rs:73 — VoiceStrip::render has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WarningsView · ×1
  • WarningsView::handle_key (cyclomatic 20) codex-rs/tui/src/bottom_pane/warnings_view.rs:92 — WarningsView::handle_key has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ClipboardWorker · ×1
  • ClipboardWorker::poll (cyclomatic 20) codex-rs/tui/src/clipboard_copy/worker.rs:448 — ClipboardWorker::poll has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OnboardingScreen · ×1
  • OnboardingScreen::render_ref (cyclomatic 20) codex-rs/tui/src/onboarding/onboarding_screen.rs:425 — OnboardingScreen::render_ref has cyclomatic complexity 20 (threshold 15). Of this number, 12 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NotarizationConfiguration.from_environment (cyclomatic 20) · ×1
  • NotarizationConfiguration.from_environment (cyclomatic 20) .github/scripts/macos-signing/notarize_with_akv.py:45 — NotarizationConfiguration.from_environment has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · sign_macos_cli_package.main (cyclomatic 20) · ×1
  • sign_macos_cli_package.main (cyclomatic 20) .github/scripts/macos-signing/sign_macos_cli_package.py:12 — sign_macos_cli_package.main has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · publish_r2_release.main (cyclomatic 20) · ×1
  • publish_r2_release.main (cyclomatic 20) .github/scripts/publish_r2_release.py:414 — publish_r2_release.main has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ClientTracker · ×1
  • ClientTracker::handle_message (cyclomatic 19) codex-rs/app-server-transport/src/transport/remote_control/client_tracker.rs:96 — ClientTracker::handle_message has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Client · ×1
  • Client::get_account_analytics (cyclomatic 19) codex-rs/backend-client/src/client/analytics.rs:35 — Client::get_account_analytics has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · McpCatalogBuilder · ×1
  • McpCatalogBuilder::build (cyclomatic 19) codex-rs/codex-mcp/src/catalog.rs:477 — McpCatalogBuilder::build has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TopLevelToolsState · ×1
  • TopLevelToolsState::render_diff (cyclomatic 19) codex-rs/core/src/context/world_state/top_level_tools.rs:134 — TopLevelToolsState::render_diff has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · JsonRpcConnection · ×1
  • JsonRpcConnection::from_stdio_with_max_message_len (cyclomatic 19) codex-rs/exec-server/src/connection.rs:313 — JsonRpcConnection::from_stdio_with_max_message_len has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PluginContributor · ×1
  • PluginContributor::selected_plugins (cyclomatic 19) codex-rs/ext/mcp/src/plugin.rs:247 — PluginContributor::selected_plugins has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TranscriptImages · ×1
  • TranscriptImages::collect (cyclomatic 19) codex-rs/guardian-context/src/images.rs:90 — TranscriptImages::collect has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · RouteAwareClientPool · ×1
  • RouteAwareClientPool::send_authorized (cyclomatic 19) codex-rs/http-client/src/route_aware_client_pool/execution.rs:75 — RouteAwareClientPool::send_authorized has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LocalStdioServerLauncher · ×1
  • LocalStdioServerLauncher::launch_server (cyclomatic 19) codex-rs/rmcp-client/src/stdio_server_launcher.rs:451 — LocalStdioServerLauncher::launch_server has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · BackendBanner · ×1
  • BackendBanner::resolve_action (cyclomatic 19) codex-rs/tui/src/backend_banners/actions.rs:17 — BackendBanner::resolve_action has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · SplitFlapTranscriptCell · ×1
  • SplitFlapTranscriptCell::animate_lines (cyclomatic 19) codex-rs/tui/src/chatwidget/realtime_split_flap.rs:136 — SplitFlapTranscriptCell::animate_lines has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LinuxSleepInhibitor · ×1
  • LinuxSleepInhibitor::acquire (cyclomatic 19) codex-rs/utils/sleep-inhibitor/src/linux_inhibitor.rs:43 — LinuxSleepInhibitor::acquire has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorktreeManager · ×1
  • WorktreeManager::list (cyclomatic 19) codex-rs/worktree/src/lib.rs:168 — WorktreeManager::list has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · run_codex_compliance._evaluate_regression_gate (cyclomatic 19) · ×1
  • run_codex_compliance._evaluate_regression_gate (cyclomatic 19) scripts/mcp_conformance/run_codex_compliance.py:1744 — run_codex_compliance._evaluate_regression_gate has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · update_sdk_artifacts._annotate_schema (cyclomatic 19) · ×1
  • update_sdk_artifacts._annotate_schema (cyclomatic 19) sdk/python/scripts/update_sdk_artifacts.py:438 — update_sdk_artifacts._annotate_schema has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RemoteAgentMessageBoard · ×1
  • RemoteAgentMessageBoard::notifications (cyclomatic 18) codex-rs/agent-message-board-client/src/client.rs:156 — RemoteAgentMessageBoard::notifications has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CommandExecManager · ×1
  • CommandExecManager::start (cyclomatic 18) codex-rs/app-server/src/command_exec.rs:143 — CommandExecManager::start has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CredentialProviderEdits · ×1
  • CredentialProviderEdits::validate_remapping (cyclomatic 18) codex-rs/app-server/src/config_manager_service_credential_edits.rs:174 — CredentialProviderEdits::validate_remapping has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Handler · ×1
  • Handler::handle_call (cyclomatic 18) codex-rs/core/src/tools/handlers/multi_agents/wait.rs:56 — Handler::handle_call has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · Forwarder · ×1
  • Forwarder::run_connection (cyclomatic 18) codex-rs/exec-server/src/forward.rs:84 — Forwarder::run_connection has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · GoalRuntimeHandle · ×1
  • GoalRuntimeHandle::stop_active_goal_for_turn (cyclomatic 18) codex-rs/ext/goal/src/runtime.rs:277 — GoalRuntimeHandle::stop_active_goal_for_turn has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · codex_memories_extension · ×1
  • codex_memories_extension::local::search::search_file (cyclomatic 18) codex-rs/ext/memories/src/local/search.rs:130 — codex_memories_extension::local::search::search_file has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · SkillsThreadState · ×1
  • SkillsThreadState::refresh_cloud_catalog (cyclomatic 18) codex-rs/ext/skills/src/state.rs:299 — SkillsThreadState::refresh_cloud_catalog has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · ListTool · ×1
  • ListTool::handle (cyclomatic 18) codex-rs/ext/skills/src/tools/list.rs:82 — ListTool::handle has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_login · ×1
  • codex_login::server::process_request (cyclomatic 18) codex-rs/login/src/server.rs:345 — codex_login::server::process_request has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · InMemoryAgentMessageBoard · ×1
  • InMemoryAgentMessageBoard::post_inner (cyclomatic 18) codex-rs/message-board/src/in_memory.rs:289 — InMemoryAgentMessageBoard::post_inner has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LocalAgentMessageBoard · ×1
  • LocalAgentMessageBoard::post_inner (cyclomatic 18) codex-rs/message-board/src/local.rs:176 — LocalAgentMessageBoard::post_inner has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AwsSigV4Signer · ×1
  • AwsSigV4Signer::sign (cyclomatic 18) codex-rs/network-proxy/src/aws_sigv4.rs:468 — AwsSigV4Signer::sign has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SanitizedGitUrl · ×1
  • SanitizedGitUrl::try_from (cyclomatic 18) codex-rs/protocol/src/sanitized_git_url.rs:29 — SanitizedGitUrl::try_from has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SameOriginRedirectHttpClient · ×1
  • SameOriginRedirectHttpClient::execute (cyclomatic 18) codex-rs/rmcp-client/src/http_client_redirect.rs:40 — SameOriginRedirectHttpClient::execute has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModelReplayPlanner · ×1
  • ModelReplayPlanner::finish (cyclomatic 18) codex-rs/thread-store/src/local/rollout_migration/rollback_replay.rs:87 — ModelReplayPlanner::finish has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AppServerSession · ×1
  • AppServerSession::fork_thread_at_with_presentation (cyclomatic 18) codex-rs/tui/src/app_server_session.rs:1058 — AppServerSession::fork_thread_at_with_presentation has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · ExperimentalFeaturesView · ×1
  • ExperimentalFeaturesView::pre_draw_tick (cyclomatic 18) codex-rs/tui/src/bottom_pane/experimental_features_view.rs:232 — ExperimentalFeaturesView::pre_draw_tick has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModifierDiff · ×1
  • ModifierDiff::queue (cyclomatic 18) codex-rs/tui/src/custom_terminal.rs:782 — ModifierDiff::queue has cyclomatic complexity 18 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D1 · Cyclomatic Complexity · EmptyStateAnimation · ×1
  • EmptyStateAnimation::render_in_at (cyclomatic 18) codex-rs/tui/src/empty_state_animation.rs:129 — EmptyStateAnimation::render_in_at has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ComputerActivityCell · ×1
  • ComputerActivityCell::display_lines (cyclomatic 18) codex-rs/tui/src/history_cell/computer_activity.rs:146 — ComputerActivityCell::display_lines has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · UnifiedExecProcessesCell · ×1
  • UnifiedExecProcessesCell::display_lines (cyclomatic 18) codex-rs/tui/src/history_cell/exec.rs:135 — UnifiedExecProcessesCell::display_lines has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PathUri · ×1
  • PathUri::join (cyclomatic 18) codex-rs/utils/path-uri/src/lib.rs:448 — PathUri::join has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · run_codex_compliance._run_official_case (cyclomatic 18) · ×1
  • run_codex_compliance._run_official_case (cyclomatic 18) scripts/mcp_conformance/run_codex_compliance.py:1142 — run_codex_compliance._run_official_case has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EnterpriseLoginState · ×1
  • EnterpriseLoginState::start (cyclomatic 17) codex-rs/app-server/src/request_processors/account_processor/enterprise_login.rs:161 — EnterpriseLoginState::start has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Apply · ×1
  • Apply::run (cyclomatic 17) codex-rs/cloud-tasks-client/src/http.rs:443 — Apply::run has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · HostState · ×1
  • HostState::handle_request (cyclomatic 17) codex-rs/code-mode-host/src/lib.rs:363 — HostState::handle_request has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · NetworkToml · ×1
  • NetworkToml::apply_to_network_proxy_config (cyclomatic 17) codex-rs/config/src/permissions_toml.rs:539 — NetworkToml::apply_to_network_proxy_config has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · NetworkMitmToml · ×1
  • NetworkMitmToml::validate_action_definitions (cyclomatic 17) codex-rs/config/src/permissions_toml.rs:438 — NetworkMitmToml::validate_action_definitions has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NodeReplReviewEvidence · ×1
  • NodeReplReviewEvidence::record (cyclomatic 17) codex-rs/core/src/context/node_repl_review_evidence.rs:140 — NodeReplReviewEvidence::record has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionConfiguration · ×1
  • SessionConfiguration::apply (cyclomatic 17) codex-rs/core/src/session/session.rs:411 — SessionConfiguration::apply has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FeaturesToml · ×1
  • FeaturesToml::entries (cyclomatic 17) codex-rs/features/src/lib.rs:949 — FeaturesToml::entries has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TranscriptHistory · ×1
  • TranscriptHistory::record (cyclomatic 17) codex-rs/guardian-context/src/history.rs:61 — TranscriptHistory::record has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OauthLoginFlow · ×1
  • OauthLoginFlow::new (cyclomatic 17) codex-rs/rmcp-client/src/perform_oauth_login.rs:544 — OauthLoginFlow::new has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RmcpClient · ×1
  • RmcpClient::call_tool_inner (cyclomatic 17) codex-rs/rmcp-client/src/rmcp_client.rs:1026 — RmcpClient::call_tool_inner has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · CustomPromptView · ×1
  • CustomPromptView::handle_key_event_at (cyclomatic 17) codex-rs/tui/src/bottom_pane/custom_prompt_view.rs:135 — CustomPromptView::handle_key_event_at has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConfigEditor · ×1
  • ConfigEditor::value (cyclomatic 17) codex-rs/tui/src/config_panel/mod.rs:139 — ConfigEditor::value has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · HookCell · ×1
  • HookCell::output_lines (cyclomatic 17) codex-rs/tui/src/history_cell/hook_cell.rs:272 — HookCell::output_lines has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_utils_pty · ×1
  • codex_utils_pty::pipe::spawn_process_with_stdin_mode (cyclomatic 17) codex-rs/utils/pty/src/pipe.rs:133 — codex_utils_pty::pipe::spawn_process_with_stdin_mode has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ArgumentCommentLint · ×1
  • ArgumentCommentLint::check_call (cyclomatic 17) tools/argument-comment-lint/src/lib.rs:167 — ArgumentCommentLint::check_call has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · official_conformance._run_scenario (cyclomatic 17) · ×1
  • official_conformance._run_scenario (cyclomatic 17) scripts/mcp_conformance/official_conformance.py:370 — official_conformance._run_scenario has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · review_regressions._print_report (cyclomatic 17) · ×1
  • review_regressions._print_report (cyclomatic 17) scripts/mcp_conformance/review_regressions.py:1151 — review_regressions._print_report has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · run_codex_compliance._run_case (cyclomatic 17) · ×1
  • run_codex_compliance._run_case (cyclomatic 17) scripts/mcp_conformance/run_codex_compliance.py:976 — run_codex_compliance._run_case has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ProtocolServer._handle_modern (cyclomatic 17) · ×1
  • ProtocolServer._handle_modern (cyclomatic 17) scripts/mcp_conformance/server.py:364 — ProtocolServer._handle_modern has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _initialize_metadata.validate_initialize_metadata (cyclomatic 17) · ×1
  • _initialize_metadata.validate_initialize_metadata (cyclomatic 17) sdk/python/src/openai_codex/_initialize_metadata.py:19 — _initialize_metadata.validate_initialize_metadata has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · OutgoingMessageSender · ×1
  • OutgoingMessageSender::send_request_to_connections (cyclomatic 16) codex-rs/app-server/src/outgoing_message.rs:347 — OutgoingMessageSender::send_request_to_connections has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TurnRequestProcessor · ×1
  • TurnRequestProcessor::turn_start_inner (cyclomatic 16) codex-rs/app-server/src/request_processors/turn_processor.rs:521 — TurnRequestProcessor::turn_start_inner has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RequestSerializationQueues · ×1
  • RequestSerializationQueues::drain (cyclomatic 16) codex-rs/app-server/src/request_serialization.rs:233 — RequestSerializationQueues::drain has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_feedback · ×1
  • codex_feedback::upload::send_envelope (cyclomatic 16) codex-rs/feedback/src/upload.rs:54 — codex_feedback::upload::send_envelope has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_keyring_store · ×1
  • codex_keyring_store::error_kind::classify (cyclomatic 16) codex-rs/keyring-store/src/error_kind.rs:8 — codex_keyring_store::error_kind::classify has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · BodySecretSubstitution · ×1
  • BodySecretSubstitution::apply (cyclomatic 16) codex-rs/network-proxy/src/secret_substitution.rs:164 — BodySecretSubstitution::apply has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_prompts · ×1
  • codex_prompts::permissions_instructions::approval_text (cyclomatic 16) codex-rs/prompts/src/permissions_instructions.rs:291 — codex_prompts::permissions_instructions::approval_text has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RolloutReferenceIndex · ×1
  • RolloutReferenceIndex::scan_paths (cyclomatic 16) codex-rs/rollout/src/rollout_reference_index.rs:91 — RolloutReferenceIndex::scan_paths has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SandboxManager · ×1
  • SandboxManager::transform (cyclomatic 16) codex-rs/sandboxing/src/manager.rs:355 — SandboxManager::transform has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_terminal_detection · ×1
  • codex_terminal_detection::detect_terminal_info_from_env (cyclomatic 16) codex-rs/terminal-detection/src/lib.rs:254 — codex_terminal_detection::detect_terminal_info_from_env has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: TerminalInfo::user_agent_token (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · PendingInputPreview · ×1
  • PendingInputPreview::as_renderable (cyclomatic 16) codex-rs/tui/src/bottom_pane/pending_input_preview.rs:85 — PendingInputPreview::as_renderable has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CwdPromptScreen · ×1
  • CwdPromptScreen::handle_key (cyclomatic 16) codex-rs/tui/src/cwd_prompt.rs:220 — CwdPromptScreen::handle_key has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · RequestUserInputResultCell · ×1
  • RequestUserInputResultCell::display_hyperlink_lines (cyclomatic 16) codex-rs/tui/src/history_cell/request_user_input.rs:19 — RequestUserInputResultCell::display_hyperlink_lines has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RuntimeChordKeymap · ×1
  • RuntimeChordKeymap::from_config (cyclomatic 16) codex-rs/tui/src/keymap/chords.rs:267 — RuntimeChordKeymap::from_config has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · KeyChordMatcher · ×1
  • KeyChordMatcher::advance (cyclomatic 16) codex-rs/tui/src/keymap/chords.rs:574 — KeyChordMatcher::advance has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CopyLine · ×1
  • CopyLine::render (cyclomatic 16) codex-rs/tui/src/markdown_copy.rs:165 — CopyLine::render has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ProsePreview · ×1
  • ProsePreview::update (cyclomatic 16) codex-rs/tui/src/streaming/prose_preview.rs:36 — ProsePreview::update has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Tui · ×1
  • Tui::with_restored (cyclomatic 16) codex-rs/tui/src/tui.rs:940 — Tui::with_restored has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · codex_websocket_client · ×1
  • codex_websocket_client::dialer::connect_happy_eyeballs (cyclomatic 16) codex-rs/websocket-client/src/dialer.rs:279 — codex_websocket_client::dialer::connect_happy_eyeballs has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex_utils_output_truncation · ×1
  • codex_utils_output_truncation::truncate_function_output_items_with_policy (cyclomatic 16) codex-rs/utils/output-truncation/src/lib.rs:164 — codex_utils_output_truncation::truncate_function_output_items_with_policy has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AppServerClient.wait_for_notification (cyclomatic 16) · ×1
  • AppServerClient.wait_for_notification (cyclomatic 16) scripts/mcp_conformance/run_codex_compliance.py:278 — AppServerClient.wait_for_notification has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · run_codex_compliance._validate_registration (cyclomatic 16) · ×1
  • run_codex_compliance._validate_registration (cyclomatic 16) scripts/mcp_conformance/run_codex_compliance.py:513 — run_codex_compliance._validate_registration has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · update_sdk_artifacts._annotation_to_source (cyclomatic 16) · ×1
  • update_sdk_artifacts._annotation_to_source (cyclomatic 16) sdk/python/scripts/update_sdk_artifacts.py:991 — update_sdk_artifacts._annotation_to_source has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · build_npm_package.stage_sources (cyclomatic 16) · ×1
  • build_npm_package.stage_sources (cyclomatic 16) codex-cli/scripts/build_npm_package.py:232 — build_npm_package.stage_sources has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · exec.findCodexPath (cyclomatic 16) · ×1
  • exec.findCodexPath (cyclomatic 16) sdk/typescript/src/exec.ts:356 — exec.findCodexPath has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D17 · Explicit Debt · FixmeComment · ×1
  • FixmeComment codex-rs/core-plugins/src/executor_hooks.rs:121 — // FIXME: Remove this temporary filter once executor plugin hooks can be trusted. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D2 · Cognitive Complexity · run_codex_compliance._required_regression_checks (cognitive 122) · ×1
  • run_codex_compliance._required_regression_checks (cognitive 122) scripts/mcp_conformance/run_codex_compliance.py:1459 — run_codex_compliance._required_regression_checks has cognitive complexity 122 (threshold 15). Drivers by points: if/else 38 (94 pts), loops 8 (17 pts), boolean chains 11 (nesting depth added 65). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigRequirementsWithSources · ×1
  • ConfigRequirementsWithSources::merge_unset_fields (cognitive 114) codex-rs/config/src/config_requirements.rs:1211 — ConfigRequirementsWithSources::merge_unset_fields has cognitive complexity 114 (threshold 15). Drivers by points: if/else 54 (66 pts), boolean chains 44, loops 1 (4 pts) (nesting depth added 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · StreamingPatchParser · ×1
  • StreamingPatchParser::process_line (cognitive 107) codex-rs/apply-patch/src/streaming_parser.rs:175 — StreamingPatchParser::process_line has cognitive complexity 107 (threshold 15). Drivers by points: if/else 32 (98 pts), boolean chains 8, match/switch 1 (nesting depth added 66). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · MathMarkdown · ×1
  • MathMarkdown::new (cognitive 103) codex-rs/tui/src/markdown_render/math.rs:27 — MathMarkdown::new has cognitive complexity 103 (threshold 15). Drivers by points: if/else 35 (72 pts), boolean chains 23, loops 4 (8 pts) (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · review_regressions._required_review_checks (cognitive 92) · ×1
  • review_regressions._required_review_checks (cognitive 92) scripts/mcp_conformance/review_regressions.py:859 — review_regressions._required_review_checks has cognitive complexity 92 (threshold 15). Drivers by points: if/else 27 (67 pts), loops 7 (14 pts), boolean chains 10, ternaries 1 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SamplingExecution · ×1
  • SamplingExecution::run (cognitive 85) codex-rs/ext/guardian-v2/src/async_scorer/sampler/execution.rs:179 — SamplingExecution::run has cognitive complexity 85 (threshold 15). Drivers by points: if/else 19 (52 pts), match/switch 9 (22 pts), loops 4 (9 pts), boolean chains 2 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DirectFileSystem · ×1
  • DirectFileSystem::sync_walk (cognitive 81) codex-rs/exec-server/src/local_file_system.rs:740 — DirectFileSystem::sync_walk has cognitive complexity 81 (threshold 15). Drivers by points: if/else 22 (57 pts), match/switch 4 (13 pts), boolean chains 8, loops 2 (3 pts) (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LinkPreview · ×1
  • LinkPreview::scan (cognitive 81) codex-rs/tui/src/streaming/prose_preview.rs:155 — LinkPreview::scan has cognitive complexity 81 (threshold 15). Drivers by points: if/else 26 (63 pts), boolean chains 10, match/switch 2 (7 pts), loops 1 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolOrchestrator · ×1
  • ToolOrchestrator::run (cognitive 79) codex-rs/core/src/tools/orchestrator.rs:125 — ToolOrchestrator::run has cognitive complexity 79 (threshold 15). Drivers by points: if/else 34 (55 pts), boolean chains 16, match/switch 5 (8 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NetworkApprovalService · ×1
  • NetworkApprovalService::handle_inline_policy_request (cognitive 78) codex-rs/core/src/tools/network_approval.rs:629 — NetworkApprovalService::handle_inline_policy_request has cognitive complexity 78 (threshold 15). Drivers by points: if/else 39 (62 pts), match/switch 7 (13 pts), boolean chains 3 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CollectedContext · ×1
  • CollectedContext::compose (cognitive 70) codex-rs/guardian-context/src/composition.rs:157 — CollectedContext::compose has cognitive complexity 70 (threshold 15). Drivers by points: if/else 18 (50 pts), match/switch 5 (13 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · run_codex_compliance._print_human_report (cognitive 70) · ×1
  • run_codex_compliance._print_human_report (cognitive 70) scripts/mcp_conformance/run_codex_compliance.py:1840 — run_codex_compliance._print_human_report has cognitive complexity 70 (threshold 15). Drivers by points: if/else 16 (36 pts), loops 8 (21 pts), ternaries 4 (8 pts), boolean chains 5 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RemoteAppServerClient · ×1
  • RemoteAppServerClient::connect_with_stream (cognitive 68) codex-rs/app-server-client/src/remote.rs:241 — RemoteAppServerClient::connect_with_stream has cognitive complexity 68 (threshold 15). Drivers by points: if/else 11 (48 pts), match/switch 5 (17 pts), loops 2, boolean chains 1 (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ComposedContext · ×1
  • ComposedContext::enforce_budget (cognitive 68) codex-rs/guardian-context/src/enforcement.rs:181 — ComposedContext::enforce_budget has cognitive complexity 68 (threshold 15). Drivers by points: if/else 19 (44 pts), loops 7 (15 pts), match/switch 2 (5 pts), boolean chains 4 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ThreadManagerState · ×1
  • ThreadManagerState::spawn_thread (cognitive 66) codex-rs/core/src/thread_manager.rs:2118 — ThreadManagerState::spawn_thread has cognitive complexity 66 (threshold 15). Drivers by points: if/else 31 (47 pts), boolean chains 10, match/switch 7 (9 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnifiedExecRuntime · ×1
  • UnifiedExecRuntime::run (cognitive 65) codex-rs/core/src/tools/runtimes/unified_exec.rs:261 — UnifiedExecRuntime::run has cognitive complexity 65 (threshold 15). Drivers by points: if/else 32 (39 pts), boolean chains 17, match/switch 3 (5 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · FeedbackRequestProcessor · ×1
  • FeedbackRequestProcessor::feedback_response (cognitive 63) codex-rs/app-server/src/request_processors/feedback_processor.rs:94 — FeedbackRequestProcessor::feedback_response has cognitive complexity 63 (threshold 15). Drivers by points: if/else 22 (37 pts), match/switch 7 (13 pts), loops 4 (9 pts), boolean chains 4 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QueuedItemService · ×1
  • QueuedItemService::watch_external_messages (cognitive 63) codex-rs/ext/queue/src/service.rs:92 — QueuedItemService::watch_external_messages has cognitive complexity 63 (threshold 15). Drivers by points: if/else 13 (39 pts), match/switch 5 (15 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StreamableHttpClientAdapter · ×1
  • StreamableHttpClientAdapter::post_message (cognitive 61) codex-rs/rmcp-client/src/http_client_adapter.rs:145 — StreamableHttpClientAdapter::post_message has cognitive complexity 61 (threshold 15). Drivers by points: if/else 25 (42 pts), boolean chains 11, match/switch 3 (5 pts), loops 1 (3 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StartupDraftPump · ×1
  • StartupDraftPump::handle_event (cognitive 58) codex-rs/tui/src/startup_draft_input.rs:24 — StartupDraftPump::handle_event has cognitive complexity 58 (threshold 15). Drivers by points: if/else 18 (38 pts), boolean chains 14, match/switch 3 (5 pts), loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigRequirements · ×1
  • ConfigRequirements::try_from (cognitive 56) codex-rs/config/src/config_requirements.rs:1784 — ConfigRequirements::try_from has cognitive complexity 56 (threshold 15). Drivers by points: if/else 27 (41 pts), match/switch 9 (11 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_voice_host · ×1
  • codex_voice_host::run (cognitive 56) codex-rs/voice-host/src/main.rs:70 — codex_voice_host::run has cognitive complexity 56 (threshold 15). Drivers by points: if/else 15 (40 pts), match/switch 3 (9 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · verify_cargo_workspace_manifests.manifest_errors (cognitive 56) · ×1
  • verify_cargo_workspace_manifests.manifest_errors (cognitive 56) .github/scripts/verify_cargo_workspace_manifests.py:105 — verify_cargo_workspace_manifests.manifest_errors has cognitive complexity 56 (threshold 15). Drivers by points: if/else 20 (49 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnifiedExecProcess · ×1
  • UnifiedExecProcess::spawn_exec_server_output_task (cognitive 54) codex-rs/core/src/unified_exec/process.rs:452 — UnifiedExecProcess::spawn_exec_server_output_task has cognitive complexity 54 (threshold 15). Drivers by points: if/else 13 (34 pts), match/switch 5 (11 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sandbox_smoketests.main (cognitive 54) · ×1
  • sandbox_smoketests.main (cognitive 54) codex-rs/windows-sandbox-rs/sandbox_smoketests.py:262 — sandbox_smoketests.main has cognitive complexity 54 (threshold 15). Drivers by points: boolean chains 27, if/else 26, error handling 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ShellSnapshotCache · ×1
  • ShellSnapshotCache::prepare (cognitive 53) codex-rs/exec-server/src/shell_snapshot.rs:107 — ShellSnapshotCache::prepare has cognitive complexity 53 (threshold 15). Drivers by points: if/else 26 (34 pts), match/switch 7 (9 pts), boolean chains 5, loops 2 (5 pts) (nesting depth added 13). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ModelClientSession · ×1
  • ModelClientSession::stream_responses_websocket (cognitive 52) codex-rs/core/src/client.rs:2091 — ModelClientSession::stream_responses_websocket has cognitive complexity 52 (threshold 15). Drivers by points: if/else 24 (41 pts), match/switch 3 (6 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SplitFlapTranscriptCell · ×1
  • SplitFlapTranscriptCell::animate_lines (cognitive 51) codex-rs/tui/src/chatwidget/realtime_split_flap.rs:136 — SplitFlapTranscriptCell::animate_lines has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (43 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CapturedSnapshot · ×1
  • CapturedSnapshot::parse (cognitive 50) codex-rs/shell-command/src/shell_snapshot_capture.rs:303 — CapturedSnapshot::parse has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (34 pts), loops 3 (7 pts), boolean chains 6, match/switch 1 (3 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigManager · ×1
  • ConfigManager::apply_edits (cognitive 49) codex-rs/app-server/src/config_manager_service.rs:219 — ConfigManager::apply_edits has cognitive complexity 49 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 13, loops 3 (6 pts), match/switch 3 (5 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexExec.run (cognitive 49) · ×1
  • CodexExec.run (cognitive 49) sdk/typescript/src/exec.ts:94 — CodexExec.run has cognitive complexity 49 (threshold 15). Drivers by points: if/else 31 (33 pts), loops 6 (11 pts), boolean chains 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · RequestSerializationQueues · ×1
  • RequestSerializationQueues::drain (cognitive 48) codex-rs/app-server/src/request_serialization.rs:233 — RequestSerializationQueues::drain has cognitive complexity 48 (threshold 15). Drivers by points: if/else 7 (25 pts), loops 6 (18 pts), match/switch 2 (5 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolRegistry · ×1
  • ToolRegistry::dispatch_any_with_state (cognitive 48) codex-rs/core/src/tools/registry.rs:705 — ToolRegistry::dispatch_any_with_state has cognitive complexity 48 (threshold 15). Drivers by points: if/else 20 (29 pts), match/switch 11 (17 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CaptureWorker · ×1
  • CaptureWorker::service (cognitive 48) codex-rs/voice-host/src/capture_worker.rs:40 — CaptureWorker::service has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (36 pts), loops 4 (7 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ThreadMetadataSync · ×1
  • ThreadMetadataSync::observe_items_with_update (cognitive 47) codex-rs/thread-store/src/thread_metadata_sync.rs:238 — ThreadMetadataSync::observe_items_with_update has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (39 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NativeChild · ×1
  • NativeChild::spawn (cognitive 46) codex-rs/utils/pty/src/posix_child.rs:61 — NativeChild::spawn has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 9, match/switch 5 (7 pts), loops 3 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · run_codex_compliance.main (cognitive 46) · ×1
  • run_codex_compliance.main (cognitive 46) scripts/mcp_conformance/run_codex_compliance.py:2108 — run_codex_compliance.main has cognitive complexity 46 (threshold 15). Drivers by points: if/else 22 (26 pts), boolean chains 7, error handling 4 (7 pts), ternaries 4 (5 pts), loops 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Classification · ×1
  • Classification::run (cognitive 43) codex-rs/ext/guardian-v2/src/async_scorer/classification.rs:114 — Classification::run has cognitive complexity 43 (threshold 15). Drivers by points: if/else 25 (28 pts), boolean chains 7, match/switch 7, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ReadTool · ×1
  • ReadTool::handle (cognitive 43) codex-rs/ext/skills/src/tools/read.rs:114 — ReadTool::handle has cognitive complexity 43 (threshold 15). Drivers by points: if/else 24 (32 pts), boolean chains 5, match/switch 4, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_conformance_adapter._exercise_auth_scenario (cognitive 42) · ×1
  • codex_conformance_adapter._exercise_auth_scenario (cognitive 42) scripts/mcp_conformance/codex_conformance_adapter.py:461 — codex_conformance_adapter._exercise_auth_scenario has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (22 pts), error handling 4 (10 pts), boolean chains 5, ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContextProfile · ×1
  • ContextProfile::prepare_transcript (cognitive 40) codex-rs/guardian-context/src/profile.rs:116 — ContextProfile::prepare_transcript has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 5 (8 pts), match/switch 7 (8 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OllamaClient · ×1
  • OllamaClient::pull_model_stream (cognitive 40) codex-rs/ollama/src/client.rs:185 — OllamaClient::pull_model_stream has cognitive complexity 40 (threshold 15). Drivers by points: if/else 6 (27 pts), loops 3 (10 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ThreadEnvironments · ×1
  • ThreadEnvironments::update_selections_with_bindings (cognitive 39) codex-rs/core/src/environment_selection.rs:478 — ThreadEnvironments::update_selections_with_bindings has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (26 pts), boolean chains 6, match/switch 1 (4 pts), loops 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_conformance_adapter.run_adapter (cognitive 39) · ×1
  • codex_conformance_adapter.run_adapter (cognitive 39) scripts/mcp_conformance/codex_conformance_adapter.py:702 — codex_conformance_adapter.run_adapter has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 8, ternaries 4 (7 pts), error handling 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_agent_roles · ×1
  • codex_agent_roles::loader::load_agent_roles (cognitive 38) codex-rs/agent-roles/src/loader.rs:23 — codex_agent_roles::loader::load_agent_roles has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 4 (9 pts), match/switch 2 (6 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelProviderInfo · ×1
  • ModelProviderInfo::validate (cognitive 38) codex-rs/model-provider-info/src/lib.rs:325 — ModelProviderInfo::validate has cognitive complexity 38 (threshold 15). Drivers by points: if/else 23 (37 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OAuthHttpClientAdapter · ×1
  • OAuthHttpClientAdapter::execute_request (cognitive 38) codex-rs/rmcp-client/src/oauth_http_client.rs:213 — OAuthHttpClientAdapter::execute_request has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 7, loops 4 (5 pts), match/switch 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommandExecRequestProcessor · ×1
  • CommandExecRequestProcessor::exec_one_off_command_inner (cognitive 37) codex-rs/app-server/src/request_processors/command_exec_processor.rs:102 — CommandExecRequestProcessor::exec_one_off_command_inner has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (19 pts), match/switch 7 (12 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · GuardianV2Extension · ×1
  • GuardianV2Extension::score_tool (cognitive 37) codex-rs/ext/guardian-v2/src/async_scorer/observation.rs:53 — GuardianV2Extension::score_tool has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20 (22 pts), match/switch 7 (9 pts), boolean chains 6 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · run_codex_compliance._exercise_app_server (cognitive 37) · ×1
  • run_codex_compliance._exercise_app_server (cognitive 37) scripts/mcp_conformance/run_codex_compliance.py:742 — run_codex_compliance._exercise_app_server has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 12 (15 pts), if/else 12 (14 pts), boolean chains 8 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · TranscriptImages · ×1
  • TranscriptImages::collect (cognitive 36) codex-rs/guardian-context/src/images.rs:90 — TranscriptImages::collect has cognitive complexity 36 (threshold 15). Drivers by points: match/switch 6 (16 pts), loops 5 (11 pts), if/else 5 (8 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnifiedExecProcessesCell · ×1
  • UnifiedExecProcessesCell::display_lines (cognitive 36) codex-rs/tui/src/history_cell/exec.rs:135 — UnifiedExecProcessesCell::display_lines has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (29 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ManagedWorktreeTools · ×1
  • ManagedWorktreeTools::execute_inner (cognitive 36) codex-rs/tui/src/managed_worktree_tools.rs:120 — ManagedWorktreeTools::execute_inner has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (22 pts), match/switch 4 (8 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · review_regressions._print_report (cognitive 36) · ×1
  • review_regressions._print_report (cognitive 36) scripts/mcp_conformance/review_regressions.py:1151 — review_regressions._print_report has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 7 (16 pts), if/else 6 (12 pts), loops 3 (8 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · server.validate_modern_http_headers (cognitive 36) · ×1
  • server.validate_modern_http_headers (cognitive 36) scripts/mcp_conformance/server.py:1253 — server.validate_modern_http_headers has cognitive complexity 36 (threshold 15). Drivers by points: if/else 19 (28 pts), boolean chains 4, ternaries 1 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sign_macos_cli_package.main (cognitive 36) · ×1
  • sign_macos_cli_package.main (cognitive 36) .github/scripts/macos-signing/sign_macos_cli_package.py:12 — sign_macos_cli_package.main has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (30 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelClient · ×1
  • ModelClient::build_responses_request (cognitive 35) codex-rs/core/src/client.rs:1034 — ModelClient::build_responses_request has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (24 pts), loops 3 (6 pts), boolean chains 5 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SkillsExtension · ×1
  • SkillsExtension::contribute (cognitive 35) codex-rs/ext/skills/src/extension.rs:331 — SkillsExtension::contribute has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 4 (7 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReverseJsonlScanner · ×1
  • ReverseJsonlScanner::scan_next (cognitive 35) codex-rs/rollout/src/reverse_jsonl_scanner.rs:75 — ReverseJsonlScanner::scan_next has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (34 pts), loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodeModeDispatchBroker · ×1
  • CodeModeDispatchBroker::start_turn_worker (cognitive 34) codex-rs/core/src/tools/code_mode/delegate.rs:118 — CodeModeDispatchBroker::start_turn_worker has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (25 pts), match/switch 3 (7 pts), boolean chains 1, loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GuardianApprovalReviewer · ×1
  • GuardianApprovalReviewer::decide_request (cognitive 34) codex-rs/ext/guardian-v2/src/async_scorer/approval.rs:53 — GuardianApprovalReviewer::decide_request has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 6, match/switch 3 (6 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ListTool · ×1
  • ListTool::handle (cognitive 34) codex-rs/ext/skills/src/tools/list.rs:82 — ListTool::handle has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (27 pts), match/switch 2 (3 pts), boolean chains 2, loops 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RolloutReferenceIndex · ×1
  • RolloutReferenceIndex::scan_paths (cognitive 34) codex-rs/rollout/src/rollout_reference_index.rs:91 — RolloutReferenceIndex::scan_paths has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 3 (4 pts), match/switch 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_utils_sandbox_summary · ×1
  • codex_utils_sandbox_summary::sandbox_summary::summarize_permission_profile (cognitive 34) codex-rs/utils/sandbox-summary/src/sandbox_summary.rs:58 — codex_utils_sandbox_summary::sandbox_summary::summarize_permission_profile has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (22 pts), match/switch 3 (8 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · review_regressions.main (cognitive 34) · ×1
  • review_regressions.main (cognitive 34) scripts/mcp_conformance/review_regressions.py:1193 — review_regressions.main has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (20 pts), error handling 3 (6 pts), boolean chains 4, ternaries 3 (4 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · TopLevelToolsState · ×1
  • TopLevelToolsState::render_diff (cognitive 33) codex-rs/core/src/context/world_state/top_level_tools.rs:134 — TopLevelToolsState::render_diff has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 3, loops 2 (3 pts), match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClipboardWorker · ×1
  • ClipboardWorker::poll (cognitive 33) codex-rs/tui/src/clipboard_copy/worker.rs:448 — ClipboardWorker::poll has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (26 pts), match/switch 2 (4 pts), boolean chains 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RequestUserInputResultCell · ×1
  • RequestUserInputResultCell::display_hyperlink_lines (cognitive 33) codex-rs/tui/src/history_cell/request_user_input.rs:19 — RequestUserInputResultCell::display_hyperlink_lines has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 3 (7 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorktreeManager · ×1
  • WorktreeManager::list (cognitive 33) codex-rs/worktree/src/lib.rs:168 — WorktreeManager::list has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (29 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EnterpriseTokenSource · ×1
  • EnterpriseTokenSource::acquire_token (cognitive 32) codex-rs/codex-mcp/src/ema_token_source.rs:303 — EnterpriseTokenSource::acquire_token has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (23 pts), match/switch 2 (4 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ThreadMetadata · ×1
  • ThreadMetadata::diff_fields (cognitive 32) codex-rs/state/src/model/thread_metadata.rs:401 — ThreadMetadata::diff_fields has cognitive complexity 32 (threshold 15). Drivers by points: if/else 32. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · HookCell · ×1
  • HookCell::output_lines (cognitive 32) codex-rs/tui/src/history_cell/hook_cell.rs:272 — HookCell::output_lines has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 3 (6 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ElicitationRequestManager · ×1
  • ElicitationRequestManager::make_sender (cognitive 31) codex-rs/codex-mcp/src/elicitation.rs:428 — ElicitationRequestManager::make_sender has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 6, match/switch 4 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RouteAwareClientPool · ×1
  • RouteAwareClientPool::send_authorized (cognitive 31) codex-rs/http-client/src/route_aware_client_pool/execution.rs:75 — RouteAwareClientPool::send_authorized has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 4, match/switch 2 (4 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SameOriginRedirectHttpClient · ×1
  • SameOriginRedirectHttpClient::execute (cognitive 31) codex-rs/rmcp-client/src/http_client_redirect.rs:40 — SameOriginRedirectHttpClient::execute has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_tcp_tunnel · ×1
  • codex_tcp_tunnel::serve (cognitive 31) codex-rs/tcp-tunnel/src/lib.rs:371 — codex_tcp_tunnel::serve has cognitive complexity 31 (threshold 15). Drivers by points: match/switch 6 (19 pts), loops 4 (8 pts), if/else 1 (4 pts) (nesting depth added 20). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · LegacyRolloutCanonicalizer · ×1
  • LegacyRolloutCanonicalizer::process_line (cognitive 31) codex-rs/thread-store/src/local/rollout_migration/canonicalizer.rs:104 — LegacyRolloutCanonicalizer::process_line has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (23 pts), match/switch 3 (6 pts), boolean chains 2 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · McpCatalogBuilder · ×1
  • McpCatalogBuilder::build (cognitive 30) codex-rs/codex-mcp/src/catalog.rs:477 — McpCatalogBuilder::build has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 5, match/switch 2 (4 pts), loops 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NodeReplReviewEvidence · ×1
  • NodeReplReviewEvidence::record (cognitive 30) codex-rs/core/src/context/node_repl_review_evidence.rs:140 — NodeReplReviewEvidence::record has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (24 pts), match/switch 2 (3 pts), loops 2, boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReviewerPool · ×1
  • ReviewerPool::review (cognitive 30) codex-rs/ext/guardian-reviewer/src/pool.rs:184 — ReviewerPool::review has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (17 pts), match/switch 4 (8 pts), boolean chains 5 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TranscriptHistory · ×1
  • TranscriptHistory::record (cognitive 30) codex-rs/guardian-context/src/history.rs:61 — TranscriptHistory::record has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 5, loops 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExperimentalFeaturesView · ×1
  • ExperimentalFeaturesView::pre_draw_tick (cognitive 30) codex-rs/tui/src/bottom_pane/experimental_features_view.rs:232 — ExperimentalFeaturesView::pre_draw_tick has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 4 (6 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpServerElicitationOverlay · ×1
  • McpServerElicitationOverlay::handle_key_event (cognitive 30) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1536 — McpServerElicitationOverlay::handle_key_event has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 4, match/switch 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CopyLine · ×1
  • CopyLine::render (cognitive 30) codex-rs/tui/src/markdown_copy.rs:165 — CopyLine::render has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 2 (5 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RealtimeHistoryState · ×1
  • RealtimeHistoryState::observe (cognitive 29) codex-rs/core/src/realtime_history.rs:159 — RealtimeHistoryState::observe has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (24 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RemotePluginMeasurementCache · ×1
  • RemotePluginMeasurementCache::prepare (cognitive 29) codex-rs/core-plugins/src/plugin_measurement_references.rs:82 — RemotePluginMeasurementCache::prepare has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 7, match/switch 4 (5 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Forwarder · ×1
  • Forwarder::run_connection (cognitive 29) codex-rs/exec-server/src/forward.rs:84 — Forwarder::run_connection has cognitive complexity 29 (threshold 15). Drivers by points: match/switch 6 (13 pts), if/else 6 (11 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfiguredCredentialProvider · ×1
  • ConfiguredCredentialProvider::translate_request_headers (cognitive 29) codex-rs/network-proxy/src/credential_broker/configured.rs:430 — ConfiguredCredentialProvider::translate_request_headers has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (21 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CustomPromptView · ×1
  • CustomPromptView::handle_key_event_at (cognitive 29) codex-rs/tui/src/bottom_pane/custom_prompt_view.rs:135 — CustomPromptView::handle_key_event_at has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 3, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ComputerActivityCell · ×1
  • ComputerActivityCell::display_lines (cognitive 29) codex-rs/tui/src/history_cell/computer_activity.rs:146 — ComputerActivityCell::display_lines has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 3, match/switch 1 (3 pts), loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · run_codex_compliance._run_case (cognitive 29) · ×1
  • run_codex_compliance._run_case (cognitive 29) scripts/mcp_conformance/run_codex_compliance.py:976 — run_codex_compliance._run_case has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (15 pts), error handling 4 (9 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · stage_npm_packages.main (cognitive 29) · ×1
  • stage_npm_packages.main (cognitive 29) scripts/stage_npm_packages.py:497 — stage_npm_packages.main has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 6 (9 pts), boolean chains 5 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update_sdk_artifacts._variant_definition_name (cognitive 29) · ×1
  • update_sdk_artifacts._variant_definition_name (cognitive 29) sdk/python/scripts/update_sdk_artifacts.py:337 — update_sdk_artifacts._variant_definition_name has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update_sdk_artifacts._annotate_schema (cognitive 29) · ×1
  • update_sdk_artifacts._annotate_schema (cognitive 29) sdk/python/scripts/update_sdk_artifacts.py:438 — update_sdk_artifacts._annotate_schema has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 5 (9 pts), ternaries 2 (6 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ScrollableDiff · ×1
  • ScrollableDiff::rewrap (cognitive 28) codex-rs/cloud-tasks/src/scrollable_diff.rs:114 — ScrollableDiff::rewrap has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RenderedEnvironments · ×1
  • RenderedEnvironments::body (cognitive 28) codex-rs/core/src/context/world_state/environment.rs:263 — RenderedEnvironments::body has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelCatalogState · ×1
  • ModelCatalogState::new (cognitive 28) codex-rs/core/src/context/world_state/model_catalog.rs:35 — ModelCatalogState::new has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 3 (7 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RequestPluginInstallHandler · ×1
  • RequestPluginInstallHandler::handle_call (cognitive 28) codex-rs/core/src/tools/handlers/request_plugin_install.rs:94 — RequestPluginInstallHandler::handle_call has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (13 pts), match/switch 8 (11 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · codex_model_provider_info · ×1
  • codex_model_provider_info::merge_configured_model_providers (cognitive 28) codex-rs/model-provider-info/src/lib.rs:772 — codex_model_provider_info::merge_configured_model_providers has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ThreadMetadataPatch · ×1
  • ThreadMetadataPatch::merge (cognitive 28) codex-rs/thread-store/src/types.rs:846 — ThreadMetadataPatch::merge has cognitive complexity 28 (threshold 15). Drivers by points: if/else 28. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · TextLayout · ×1
  • TextLayout::copy_block_ranges (cognitive 28) codex-rs/tui/src/transcript_view/text.rs:74 — TextLayout::copy_block_ranges has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_utils_output_truncation · ×1
  • codex_utils_output_truncation::truncate_function_output_items_with_policy (cognitive 28) codex-rs/utils/output-truncation/src/lib.rs:164 — codex_utils_output_truncation::truncate_function_output_items_with_policy has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (21 pts), match/switch 5 (6 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _GoalStreamCursor.process (cognitive 28) · ×1
  • _GoalStreamCursor.process (cognitive 28) sdk/python/src/openai_codex/_goal.py:260 — _GoalStreamCursor.process has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 8 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InitializeRequestProcessor · ×1
  • InitializeRequestProcessor::initialize (cognitive 27) codex-rs/app-server/src/request_processors/initialize_processor.rs:53 — InitializeRequestProcessor::initialize has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 4, match/switch 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClientTracker · ×1
  • ClientTracker::handle_message (cognitive 27) codex-rs/app-server-transport/src/transport/remote_control/client_tracker.rs:96 — ClientTracker::handle_message has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 2, match/switch 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExecServerCommand · ×1
  • ExecServerCommand::run (cognitive 27) codex-rs/cli/src/exec_server_command.rs:172 — ExecServerCommand::run has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalAgentRuntime · ×1
  • LocalAgentRuntime::capture_sender_user_messages (cognitive 27) codex-rs/core/src/agent/control/sender_context.rs:22 — LocalAgentRuntime::capture_sender_user_messages has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 4 (13 pts), if/else 6 (9 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 14). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ToolCallRuntime · ×1
  • ToolCallRuntime::handle_tool_call_with_source (cognitive 27) codex-rs/core/src/tools/parallel.rs:155 — ToolCallRuntime::handle_tool_call_with_source has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (14 pts), match/switch 4 (6 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SessionState · ×1
  • SessionState::recover_events (cognitive 27) codex-rs/exec-server/src/client_recovery.rs:94 — SessionState::recover_events has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 8, loops 1, match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · McpServerElicitationFormRequest · ×1
  • McpServerElicitationFormRequest::from_parts (cognitive 27) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:223 — McpServerElicitationFormRequest::from_parts has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LinuxSleepInhibitor · ×1
  • LinuxSleepInhibitor::acquire (cognitive 27) codex-rs/utils/sleep-inhibitor/src/linux_inhibitor.rs:43 — LinuxSleepInhibitor::acquire has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 4 (8 pts), boolean chains 3, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArgumentCommentLint · ×1
  • ArgumentCommentLint::check_call (cognitive 27) tools/argument-comment-lint/src/lib.rs:167 — ArgumentCommentLint::check_call has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WindowsSandboxRequestProcessor · ×1
  • WindowsSandboxRequestProcessor::windows_sandbox_setup_start_inner (cognitive 26) codex-rs/app-server/src/request_processors/windows_sandbox_processor.rs:101 — WindowsSandboxRequestProcessor::windows_sandbox_setup_start_inner has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (21 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · McpServerConfig · ×1
  • McpServerConfig::try_from (cognitive 26) codex-rs/config/src/mcp_types.rs:464 — McpServerConfig::try_from has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 4, loops 1 (2 pts), match/switch 1 (nesting depth added 7). Of this number, 25 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Handler · ×1
  • Handler::handle_call (cognitive 26) codex-rs/core/src/tools/handlers/multi_agents/wait.rs:56 — Handler::handle_call has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 4 (10 pts), loops 5 (9 pts), if/else 4 (7 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelReplayPlanner · ×1
  • ModelReplayPlanner::finish (cognitive 26) codex-rs/thread-store/src/local/rollout_migration/rollback_replay.rs:87 — ModelReplayPlanner::finish has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (21 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VoiceStrip · ×1
  • VoiceStrip::render (cognitive 26) codex-rs/tui/src/bottom_pane/voice_strip.rs:73 — VoiceStrip::render has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 9 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · RuntimeChordKeymap · ×1
  • RuntimeChordKeymap::from_config (cognitive 26) codex-rs/tui/src/keymap/chords.rs:267 — RuntimeChordKeymap::from_config has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 5 (7 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · review_regressions._run_catalog_boundary_checks (cognitive 26) · ×1
  • review_regressions._run_catalog_boundary_checks (cognitive 26) scripts/mcp_conformance/review_regressions.py:524 — review_regressions._run_catalog_boundary_checks has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 13 (14 pts), boolean chains 6, if/else 5, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · build_npm_package.copy_native_binaries (cognitive 26) · ×1
  • build_npm_package.copy_native_binaries (cognitive 26) codex-cli/scripts/build_npm_package.py:358 — build_npm_package.copy_native_binaries has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RemoteAgentMessageBoard · ×1
  • RemoteAgentMessageBoard::notifications (cognitive 25) codex-rs/agent-message-board-client/src/client.rs:156 — RemoteAgentMessageBoard::notifications has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClientSegmentReassembler · ×1
  • ClientSegmentReassembler::observe (cognitive 25) codex-rs/app-server-transport/src/transport/remote_control/segment.rs:53 — ClientSegmentReassembler::observe has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (16 pts), match/switch 4 (8 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · codex_code_mode_protocol · ×1
  • codex_code_mode_protocol::description::build_exec_tool_description (cognitive 25) codex-rs/code-mode-protocol/src/description.rs:279 — codex_code_mode_protocol::description::build_exec_tool_description has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 1 (2 pts), match/switch 2 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · RealtimeWebsocketEvents · ×1
  • RealtimeWebsocketEvents::next_event (cognitive 25) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:573 — RealtimeWebsocketEvents::next_event has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 3 (7 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LazyRemoteExecServerClient · ×1
  • LazyRemoteExecServerClient::refresh_connection (cognitive 25) codex-rs/exec-server/src/client_refresh.rs:100 — LazyRemoteExecServerClient::refresh_connection has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 3 (5 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExecutorSkillProvider · ×1
  • ExecutorSkillProvider::list_from_discovery_v2 (cognitive 25) codex-rs/ext/skills/src/provider/executor/discovery_v2.rs:18 — ExecutorSkillProvider::list_from_discovery_v2 has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 4 (8 pts), match/switch 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_http_client · ×1
  • codex_http_client::windows_proxy_auth::connect_windows_proxy (cognitive 25) codex-rs/http-client/src/windows_proxy_auth.rs:101 — codex_http_client::windows_proxy_auth::connect_windows_proxy has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 4 (9 pts), loops 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Tui · ×1
  • Tui::with_restored (cognitive 25) codex-rs/tui/src/tui.rs:940 — Tui::with_restored has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 2 (7 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · codex_experimental_api_macros · ×1
  • codex_experimental_api_macros::derive_for_struct (cognitive 25) codex-rs/codex-experimental-api-macros/src/lib.rs:30 — codex_experimental_api_macros::derive_for_struct has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · review_regressions._run_normal_review_checks (cognitive 25) · ×1
  • review_regressions._run_normal_review_checks (cognitive 25) scripts/mcp_conformance/review_regressions.py:296 — review_regressions._run_normal_review_checks has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 12 (15 pts), if/else 5, boolean chains 4, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · run_codex_compliance._run_official_case (cognitive 25) · ×1
  • run_codex_compliance._run_official_case (cognitive 25) scripts/mcp_conformance/run_codex_compliance.py:1142 — run_codex_compliance._run_official_case has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 5 (7 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProtocolServer._call_tool (cognitive 25) · ×1
  • ProtocolServer._call_tool (cognitive 25) scripts/mcp_conformance/server.py:625 — ProtocolServer._call_tool has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 6, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommandExecManager · ×1
  • CommandExecManager::start (cognitive 24) codex-rs/app-server/src/command_exec.rs:143 — CommandExecManager::start has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 5, match/switch 3 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InProcessAppServerClient · ×1
  • InProcessAppServerClient::start (cognitive 24) codex-rs/app-server-client/src/lib.rs:370 — InProcessAppServerClient::start has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 3 (9 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ThreadHistoryBuilder · ×1
  • ThreadHistoryBuilder::build_user_inputs (cognitive 24) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1676 — ThreadHistoryBuilder::build_user_inputs has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (7 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HostState · ×1
  • HostState::handle_request (cognitive 24) codex-rs/code-mode-host/src/lib.rs:363 — HostState::handle_request has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 9 (18 pts), if/else 4 (6 pts) (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · McpEventStreamManager · ×1
  • McpEventStreamManager::start (cognitive 24) codex-rs/ext/mcp/src/stream_manager.rs:84 — McpEventStreamManager::start has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (20 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RetainedContext · ×1
  • RetainedContext::record_user_message (cognitive 24) codex-rs/history/src/retained_context.rs:354 — RetainedContext::record_user_message has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAiModelsManager · ×1
  • OpenAiModelsManager::fetch_and_update_models (cognitive 24) codex-rs/models-manager/src/manager.rs:623 — OpenAiModelsManager::fetch_and_update_models has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 5, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OauthLoginFlow · ×1
  • OauthLoginFlow::new (cognitive 24) codex-rs/rmcp-client/src/perform_oauth_login.rs:544 — OauthLoginFlow::new has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 4, match/switch 2 (3 pts), loops 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · LiveCommandOutput · ×1
  • LiveCommandOutput::push_truncated_str (cognitive 24) codex-rs/tui/src/exec_cell/live_output.rs:56 — LiveCommandOutput::push_truncated_str has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 3, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · asciicheck.lint_utf8_ascii (cognitive 24) · ×1
  • asciicheck.lint_utf8_ascii (cognitive 24) scripts/asciicheck.py:72 — asciicheck.lint_utf8_ascii has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (7 pts), boolean chains 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OutgoingMessageSender · ×1
  • OutgoingMessageSender::send_request_to_connections (cognitive 23) codex-rs/app-server/src/outgoing_message.rs:347 — OutgoingMessageSender::send_request_to_connections has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · TurnRequestProcessor · ×1
  • TurnRequestProcessor::turn_start_inner (cognitive 23) codex-rs/app-server/src/request_processors/turn_processor.rs:521 — TurnRequestProcessor::turn_start_inner has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (17 pts), match/switch 4 (5 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NetworkMitmToml · ×1
  • NetworkMitmToml::validate_action_definitions (cognitive 23) codex-rs/config/src/permissions_toml.rs:438 — NetworkMitmToml::validate_action_definitions has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SanitizedGitUrl · ×1
  • SanitizedGitUrl::try_from (cognitive 23) codex-rs/protocol/src/sanitized_git_url.rs:29 — SanitizedGitUrl::try_from has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 8, loops 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Discovery · ×1
  • Discovery::handle_reply (cognitive 23) codex-rs/rmcp-client/src/local_stdio_transport.rs:65 — Discovery::handle_reply has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 9, match/switch 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AppServerClient.wait_for_notification (cognitive 23) · ×1
  • AppServerClient.wait_for_notification (cognitive 23) scripts/mcp_conformance/run_codex_compliance.py:278 — AppServerClient.wait_for_notification has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 5, error handling 1 (2 pts), loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · errors._is_server_overloaded (cognitive 23) · ×1
  • errors._is_server_overloaded (cognitive 23) sdk/python/src/openai_codex/errors.py:61 — errors._is_server_overloaded has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · resolve_python_cli_release.resolve_release (cognitive 23) · ×1
  • resolve_python_cli_release.resolve_release (cognitive 23) .github/scripts/resolve_python_cli_release.py:26 — resolve_python_cli_release.resolve_release has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 8, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · HttpResponseBodyStream · ×1
  • HttpResponseBodyStream::recv_inner (cognitive 22) codex-rs/exec-server/src/client/http_response_body_stream.rs:150 — HttpResponseBodyStream::recv_inner has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 3 (6 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ShadowTaskContext · ×1
  • ShadowTaskContext::begin_turn (cognitive 22) codex-rs/ext/skills/src/shadow_selection_experiment/task_context.rs:39 — ShadowTaskContext::begin_turn has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AwsSigV4Signer · ×1
  • AwsSigV4Signer::sign (cognitive 22) codex-rs/network-proxy/src/aws_sigv4.rs:468 — AwsSigV4Signer::sign has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (14 pts), loops 4, boolean chains 2, match/switch 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · BodySecretSubstitution · ×1
  • BodySecretSubstitution::apply (cognitive 22) codex-rs/network-proxy/src/secret_substitution.rs:164 — BodySecretSubstitution::apply has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalFileSystemPolicyMatcher · ×1
  • LocalFileSystemPolicyMatcher::can_write_path (cognitive 22) codex-rs/protocol/src/permissions/local_aliases.rs:116 — LocalFileSystemPolicyMatcher::can_write_path has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalStdioServerLauncher · ×1
  • LocalStdioServerLauncher::launch_server (cognitive 22) codex-rs/rmcp-client/src/stdio_server_launcher.rs:451 — LocalStdioServerLauncher::launch_server has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 7 (12 pts), if/else 6, boolean chains 3, loops 1 (nesting depth added 5). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · FeedbackNoteView · ×1
  • FeedbackNoteView::render (cognitive 22) codex-rs/tui/src/bottom_pane/feedback_note_view.rs:219 — FeedbackNoteView::render has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PathUri · ×1
  • PathUri::join (cognitive 22) codex-rs/utils/path-uri/src/lib.rs:448 — PathUri::join has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, loops 2 (3 pts), match/switch 2 (3 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · update_sdk_artifacts._annotation_to_source (cognitive 22) · ×1
  • update_sdk_artifacts._annotation_to_source (cognitive 22) sdk/python/scripts/update_sdk_artifacts.py:991 — update_sdk_artifacts._annotation_to_source has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 3 (6 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Apply · ×1
  • Apply::run (cognitive 21) codex-rs/cloud-tasks-client/src/http.rs:443 — Apply::run has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, match/switch 3 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · RealtimeConversationManager · ×1
  • RealtimeConversationManager::handoff_out (cognitive 21) codex-rs/core/src/realtime_conversation.rs:942 — RealtimeConversationManager::handoff_out has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExecCommandHandler · ×1
  • ExecCommandHandler::handle_call (cognitive 21) codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs:154 — ExecCommandHandler::handle_call has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (8 pts), match/switch 7, boolean chains 6 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExecutorCapabilityDiscoveryCache · ×1
  • ExecutorCapabilityDiscoveryCache::discover (cognitive 21) codex-rs/exec-server/src/capability_discovery_cache.rs:83 — ExecutorCapabilityDiscoveryCache::discover has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_feedback · ×1
  • codex_feedback::upload::send_envelope (cognitive 21) codex-rs/feedback/src/upload.rs:54 — codex_feedback::upload::send_envelope has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 8, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalAgentMessageBoard · ×1
  • LocalAgentMessageBoard::post_inner (cognitive 21) codex-rs/message-board/src/local.rs:176 — LocalAgentMessageBoard::post_inner has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), loops 2 (4 pts), match/switch 2, boolean chains 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · BoardTool · ×1
  • BoardTool::execute (cognitive 21) codex-rs/message-board/src/tools.rs:149 — BoardTool::execute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 4 (7 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_responses_api_proxy · ×1
  • codex_responses_api_proxy::forward_request (cognitive 21) codex-rs/responses-api-proxy/src/lib.rs:227 — codex_responses_api_proxy::forward_request has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 2 (3 pts), boolean chains 2, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EventNotificationTransport · ×1
  • EventNotificationTransport::receive (cognitive 21) codex-rs/rmcp-client/src/event_notification_transport.rs:177 — EventNotificationTransport::receive has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommandPopup · ×1
  • CommandPopup::filtered (cognitive 21) codex-rs/tui/src/bottom_pane/command_popup.rs:159 — CommandPopup::filtered has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PendingInputPreview · ×1
  • PendingInputPreview::as_renderable (cognitive 21) codex-rs/tui/src/bottom_pane/pending_input_preview.rs:85 — PendingInputPreview::as_renderable has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EmptyStateAnimation · ×1
  • EmptyStateAnimation::render_in_at (cognitive 21) codex-rs/tui/src/empty_state_animation.rs:129 — EmptyStateAnimation::render_in_at has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 8 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · StatusThreadUsage · ×1
  • StatusThreadUsage::lines (cognitive 21) codex-rs/tui/src/status/thread_usage.rs:96 — StatusThreadUsage::lines has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PreparedWindowsSandboxCleanup · ×1
  • PreparedWindowsSandboxCleanup::finish (cognitive 21) codex-rs/windows-sandbox-rs/src/uninstall_windows.rs:118 — PreparedWindowsSandboxCleanup::finish has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (10 pts), match/switch 3 (7 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · run_codex_compliance._evaluate_regression_gate (cognitive 21) · ×1
  • run_codex_compliance._evaluate_regression_gate (cognitive 21) scripts/mcp_conformance/run_codex_compliance.py:1744 — run_codex_compliance._evaluate_regression_gate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, loops 2, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SampleTask · ×1
  • SampleTask::run (cognitive 20) codex-rs/app-server/src/thread_sample.rs:106 — SampleTask::run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8, match/switch 4 (6 pts), boolean chains 5, loops 1 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ScanState · ×1
  • ScanState::observe (cognitive 20) codex-rs/app-server-protocol/src/export.rs:933 — ScanState::observe has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_arg0 · ×1
  • codex_arg0::arg0_dispatch (cognitive 20) REDACTED:61 — codex_arg0::arg0_dispatch has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 4 (11 pts), if/else 8, boolean chains 1 (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · SessionConfiguration · ×1
  • SessionConfiguration::apply (cognitive 20) codex-rs/core/src/session/session.rs:411 — SessionConfiguration::apply has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Inner · ×1
  • Inner::recover (cognitive 20) codex-rs/exec-server/src/client_recovery.rs:364 — Inner::recover has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_git_attribution · ×1
  • codex_git_attribution::policy::resolve_attribution_policy (cognitive 20) codex-rs/ext/git-attribution/src/policy.rs:52 — codex_git_attribution::policy::resolve_attribution_policy has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_keyring_store · ×1
  • codex_keyring_store::error_kind::classify (cognitive 20) codex-rs/keyring-store/src/error_kind.rs:8 — codex_keyring_store::error_kind::classify has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (9 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OAuthSessionManager · ×1
  • OAuthSessionManager::refresh (cognitive 20) codex-rs/login/src/oauth_session.rs:314 — OAuthSessionManager::refresh has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InMemoryAgentMessageBoard · ×1
  • InMemoryAgentMessageBoard::post_inner (cognitive 20) codex-rs/message-board/src/in_memory.rs:289 — InMemoryAgentMessageBoard::post_inner has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Live · ×1
  • Live::filtered_history (cognitive 20) codex-rs/tui/src/analytics/client.rs:136 — Live::filtered_history has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AppExitInfo · ×1
  • AppExitInfo::format_exit_messages (cognitive 20) codex-rs/tui/src/app/exit_summary.rs:82 — AppExitInfo::format_exit_messages has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (17 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RateLimitWarningState · ×1
  • RateLimitWarningState::take_warnings (cognitive 20) codex-rs/tui/src/chatwidget/rate_limits.rs:30 — RateLimitWarningState::take_warnings has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExternalAgentConfigMigrationScreen · ×1
  • ExternalAgentConfigMigrationScreen::render_items (cognitive 20) codex-rs/tui/src/external_agent_config_migration/render.rs:22 — ExternalAgentConfigMigrationScreen::render_items has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · publish_r2_release.main (cognitive 20) · ×1
  • publish_r2_release.main (cognitive 20) .github/scripts/publish_r2_release.py:414 — publish_r2_release.main has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 7, error handling 1, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · build_npm_package.stage_sources (cognitive 20) · ×1
  • build_npm_package.stage_sources (cognitive 20) codex-cli/scripts/build_npm_package.py:232 — build_npm_package.stage_sources has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (20 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Notifications · ×1
  • Notifications::on_turn_start (cognitive 19) codex-rs/agent-message-board-client/src/notifications.rs:35 — Notifications::on_turn_start has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 2 (6 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_code_mode_host · ×1
  • codex_code_mode_host::peer::drive_cell (cognitive 19) codex-rs/code-mode-host/src/peer.rs:418 — codex_code_mode_host::peer::drive_cell has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 4 (7 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ToolCatalogTransportIdentity · ×1
  • ToolCatalogTransportIdentity::new (cognitive 19) codex-rs/codex-mcp/src/tool_catalog_cache.rs:351 — ToolCatalogTransportIdentity::new has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NetworkToml · ×1
  • NetworkToml::apply_to_network_proxy_config (cognitive 19) codex-rs/config/src/permissions_toml.rs:539 — NetworkToml::apply_to_network_proxy_config has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, match/switch 1 (3 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SkillConfigRules · ×1
  • SkillConfigRules::resolve_disabled_paths (cognitive 19) codex-rs/config/src/skills_config.rs:103 — SkillConfigRules::resolve_disabled_paths has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnEnvironment · ×1
  • TurnEnvironment::shell_snapshot (cognitive 19) codex-rs/core/src/session/turn_context.rs:127 — TurnEnvironment::shell_snapshot has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FeedbackSnapshot · ×1
  • FeedbackSnapshot::upload_tags (cognitive 19) codex-rs/feedback/src/lib.rs:829 — FeedbackSnapshot::upload_tags has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexAuth · ×1
  • CodexAuth::from_auth_dot_json (cognitive 19) codex-rs/login/src/auth/manager.rs:343 — CodexAuth::from_auth_dot_json has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAiModelsEndpoint · ×1
  • OpenAiModelsEndpoint::list_models (cognitive 19) codex-rs/model-provider/src/models_endpoint.rs:93 — OpenAiModelsEndpoint::list_models has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · NetworkProxyState · ×1
  • NetworkProxyState::host_blocked_with_lookup (cognitive 19) codex-rs/network-proxy/src/runtime.rs:848 — NetworkProxyState::host_blocked_with_lookup has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SandboxPolicy · ×1
  • SandboxPolicy::get_writable_roots_with_cwd (cognitive 19) codex-rs/protocol/src/protocol.rs:1398 — SandboxPolicy::get_writable_roots_with_cwd has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 3 (8 pts), boolean chains 2 (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · WarningsView · ×1
  • WarningsView::handle_key (cognitive 19) codex-rs/tui/src/bottom_pane/warnings_view.rs:92 — WarningsView::handle_key has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KeyChordMatcher · ×1
  • KeyChordMatcher::advance (cognitive 19) codex-rs/tui/src/keymap/chords.rs:574 — KeyChordMatcher::advance has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 7 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FlexRenderable · ×1
  • FlexRenderable::allocate (cognitive 19) codex-rs/tui/src/render/renderable.rs:296 — FlexRenderable::allocate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 4, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InlineHiddenTagParser · ×1
  • InlineHiddenTagParser::push_str (cognitive 19) codex-rs/utils/stream-parser/src/inline_hidden_tag.rs:111 — InlineHiddenTagParser::push_str has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FixtureRequestHandler.do_POST (cognitive 19) · ×1
  • FixtureRequestHandler.do_POST (cognitive 19) scripts/mcp_conformance/server.py:1433 — FixtureRequestHandler.do_POST has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), error handling 3 (5 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · update_sdk_artifacts._annotate_variant_list (cognitive 19) · ×1
  • update_sdk_artifacts._annotate_variant_list (cognitive 19) sdk/python/scripts/update_sdk_artifacts.py:400 — update_sdk_artifacts._annotate_variant_list has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 6, ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _initialize_metadata.validate_initialize_metadata (cognitive 19) · ×1
  • _initialize_metadata.validate_initialize_metadata (cognitive 19) sdk/python/src/openai_codex/_initialize_metadata.py:19 — _initialize_metadata.validate_initialize_metadata has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (9 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · NotarizationConfiguration.from_environment (cognitive 19) · ×1
  • NotarizationConfiguration.from_environment (cognitive 19) .github/scripts/macos-signing/notarize_with_akv.py:45 — NotarizationConfiguration.from_environment has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, boolean chains 5, error handling 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · publish_r2_release.should_update_channel (cognitive 19) · ×1
  • publish_r2_release.should_update_channel (cognitive 19) .github/scripts/publish_r2_release.py:270 — publish_r2_release.should_update_channel has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, error handling 3, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · exec.toTomlValue (cognitive 19) · ×1
  • exec.toTomlValue (cognitive 19) sdk/typescript/src/exec.ts:314 — exec.toTomlValue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ThreadGoalRequestProcessor · ×1
  • ThreadGoalRequestProcessor::state_db_for_materialized_thread (cognitive 18) codex-rs/app-server/src/request_processors/thread_goal_processor.rs:323 — ThreadGoalRequestProcessor::state_db_for_materialized_thread has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (18 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PreparedReview · ×1
  • PreparedReview::run (cognitive 18) codex-rs/core/src/guardian/review_session_setup.rs:265 — PreparedReview::run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ApplyPatchRuntime · ×1
  • ApplyPatchRuntime::run (cognitive 18) codex-rs/core/src/tools/runtimes/apply_patch.rs:170 — ApplyPatchRuntime::run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 2 (3 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GoalRuntimeHandle · ×1
  • GoalRuntimeHandle::stop_active_goal_for_turn (cognitive 18) codex-rs/ext/goal/src/runtime.rs:277 — GoalRuntimeHandle::stop_active_goal_for_turn has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SkillsThreadState · ×1
  • SkillsThreadState::refresh_cloud_catalog (cognitive 18) codex-rs/ext/skills/src/state.rs:299 — SkillsThreadState::refresh_cloud_catalog has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 8, match/switch 2. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Features · ×1
  • Features::apply_map (cognitive 18) codex-rs/features/src/lib.rs:671 — Features::apply_map has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_features · ×1
  • codex_features::unstable_features_warning_event (cognitive 18) codex-rs/features/src/lib.rs:2226 — codex_features::unstable_features_warning_event has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileWatcher · ×1
  • FileWatcher::notify_subscribers (cognitive 18) codex-rs/file-watcher/src/lib.rs:707 — FileWatcher::notify_subscribers has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 5 (8 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NodeReplContext · ×1
  • NodeReplContext::render_inputs (cognitive 18) codex-rs/guardian-context/src/node_repl.rs:87 — NodeReplContext::render_inputs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), match/switch 2 (5 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResponseInputItem · ×1
  • ResponseInputItem::from_user_input (cognitive 18) codex-rs/protocol/src/models.rs:2155 — ResponseInputItem::from_user_input has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 4 (12 pts), if/else 1 (3 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · codex_rollout_trace · ×1
  • codex_rollout_trace::reducer::conversation::normalize::append_reasoning_parts (cognitive 18) codex-rs/rollout-trace/src/reducer/conversation/normalize.rs:314 — codex_rollout_trace::reducer::conversation::normalize::append_reasoning_parts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryStore · ×1
  • MemoryStore::get_phase2_input_selection (cognitive 18) codex-rs/state/src/runtime/memories.rs:456 — MemoryStore::get_phase2_input_selection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InMemoryThreadStore · ×1
  • InMemoryThreadStore::list_threads (cognitive 18) codex-rs/thread-store/src/in_memory.rs:1000 — InMemoryThreadStore::list_threads has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts), boolean chains 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModifierDiff · ×1
  • ModifierDiff::queue (cognitive 18) codex-rs/tui/src/custom_terminal.rs:782 — ModifierDiff::queue has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 1 (nesting depth added 1). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D2 · Cognitive Complexity · layout.validate_package_dir (cognitive 18) · ×1
  • layout.validate_package_dir (cognitive 18) scripts/codex_package/layout.py:89 — layout.validate_package_dir has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 4 (5 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_conformance_adapter._exercise_scenario (cognitive 18) · ×1
  • codex_conformance_adapter._exercise_scenario (cognitive 18) scripts/mcp_conformance/codex_conformance_adapter.py:596 — codex_conformance_adapter._exercise_scenario has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · run_codex_compliance._validate_registration (cognitive 18) · ×1
  • run_codex_compliance._validate_registration (cognitive 18) scripts/mcp_conformance/run_codex_compliance.py:513 — run_codex_compliance._validate_registration has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 7 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageRouter.route_notification (cognitive 18) · ×1
  • MessageRouter.route_notification (cognitive 18) sdk/python/src/openai_codex/_message_router.py:283 — MessageRouter.route_notification has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · notarize_with_akv.notarize (cognitive 18) · ×1
  • notarize_with_akv.notarize (cognitive 18) .github/scripts/macos-signing/notarize_with_akv.py:417 — notarize_with_akv.notarize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · build_npm_package.main (cognitive 18) · ×1
  • build_npm_package.main (cognitive 18) codex-cli/scripts/build_npm_package.py:137 — build_npm_package.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · codex.detectPackageManager (cognitive 18) · ×1
  • codex.detectPackageManager (cognitive 18) codex-cli/bin/codex.js:177 — codex.detectPackageManager has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · exec.flattenConfigOverrides (cognitive 18) · ×1
  • exec.flattenConfigOverrides (cognitive 18) sdk/typescript/src/exec.ts:274 — exec.flattenConfigOverrides has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 2, ternaries 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GrpcSession · ×1
  • GrpcSession::dispatch_tool (cognitive 17) codex-rs/code-mode-host/src/grpc/routing.rs:89 — GrpcSession::dispatch_tool has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStartup · ×1
  • SessionStartup::cleanup (cognitive 17) codex-rs/core/src/session/startup.rs:65 — SessionStartup::cleanup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GoalService · ×1
  • GoalService::set_thread_goal (cognitive 17) codex-rs/ext/goal/src/api.rs:147 — GoalService::set_thread_goal has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, match/switch 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · RolloutPersistenceTelemetry · ×1
  • RolloutPersistenceTelemetry::record_batch (cognitive 17) codex-rs/rollout/src/persistence_metrics.rs:378 — RolloutPersistenceTelemetry::record_batch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TerminalQueryResponder · ×1
  • TerminalQueryResponder::process (cognitive 17) codex-rs/sandboxing/src/terminal_queries.rs:24 — TerminalQueryResponder::process has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqliteConfig · ×1
  • SqliteConfig::open_read_write_pool_with_spec (cognitive 17) codex-rs/state/src/sqlite.rs:444 — SqliteConfig::open_read_write_pool_with_spec has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (12 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AppServerSession · ×1
  • AppServerSession::fork_thread_at_with_presentation (cognitive 17) codex-rs/tui/src/app_server_session.rs:1058 — AppServerSession::fork_thread_at_with_presentation has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 5, match/switch 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AttachmentState · ×1
  • AttachmentState::handle_remote_image_selection_key (cognitive 17) codex-rs/tui/src/bottom_pane/chat_composer/attachment_state.rs:159 — AttachmentState::handle_remote_image_selection_key has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Playback · ×1
  • Playback::next (cognitive 17) codex-rs/voice-host/src/device_buffers.rs:220 — Playback::next has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GlobWalker · ×1
  • GlobWalker::visit (cognitive 17) codex-rs/windows-sandbox-rs/src/deny_read_walker.rs:61 — GlobWalker::visit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · official_conformance._run_scenario (cognitive 17) · ×1
  • official_conformance._run_scenario (cognitive 17) scripts/mcp_conformance/official_conformance.py:370 — official_conformance._run_scenario has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, error handling 3 (4 pts), if/else 3, loops 1 (2 pts), ternaries 1 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · run_codex_compliance.run_compliance (cognitive 17) · ×1
  • run_codex_compliance.run_compliance (cognitive 17) scripts/mcp_conformance/run_codex_compliance.py:1306 — run_codex_compliance.run_compliance has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (3 pts), ternaries 3, boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update_sdk_artifacts._normalized_schema_bundle_text (cognitive 17) · ×1
  • update_sdk_artifacts._normalized_schema_bundle_text (cognitive 17) sdk/python/scripts/update_sdk_artifacts.py:525 — update_sdk_artifacts._normalized_schema_bundle_text has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · contract_releases.github_read (cognitive 17) · ×1
  • contract_releases.github_read (cognitive 17) .github/scripts/contract_releases.py:17 — contract_releases.github_read has cognitive complexity 17 (threshold 15). Drivers by points: if/else 2 (6 pts), boolean chains 4, ternaries 1 (4 pts), error handling 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · wrapper_common.parse_wrapper_args (cognitive 17) · ×1
  • wrapper_common.parse_wrapper_args (cognitive 17) tools/argument-comment-lint/wrapper_common.py:53 — wrapper_common.parse_wrapper_args has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExternalAgentSessionImporter · ×1
  • ExternalAgentSessionImporter::import_sessions (cognitive 16) codex-rs/app-server/src/external_agent_migration/session_importer.rs:101 — ExternalAgentSessionImporter::import_sessions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3, match/switch 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EnterpriseLoginState · ×1
  • EnterpriseLoginState::start (cognitive 16) codex-rs/app-server/src/request_processors/account_processor/enterprise_login.rs:161 — EnterpriseLoginState::start has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 6 (7 pts), if/else 5, boolean chains 4 (nesting depth added 1). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResourceOrigins · ×1
  • ResourceOrigins::observe (cognitive 16) codex-rs/codex-mcp/src/resource_origin.rs:105 — ResourceOrigins::observe has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ManagedClientStartup · ×1
  • ManagedClientStartup::start (cognitive 16) codex-rs/codex-mcp/src/rmcp_client.rs:299 — ManagedClientStartup::start has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), match/switch 3 (5 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodeModeWaitHandler · ×1
  • CodeModeWaitHandler::handle_call (cognitive 16) codex-rs/core/src/tools/code_mode/wait_handler.rs:94 — CodeModeWaitHandler::handle_call has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · SeenIds · ×1
  • SeenIds::from_history (cognitive 16) codex-rs/core/src/tools/executed_tool_calls/seen_ids.rs:42 — SeenIds::from_history has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RequestDispatcher · ×1
  • RequestDispatcher::dispatch_request (cognitive 16) codex-rs/exec-server/src/server/request_dispatcher.rs:173 — RequestDispatcher::dispatch_request has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SnapshotCapture · ×1
  • SnapshotCapture::wait_for_exit (cognitive 16) codex-rs/exec-server/src/shell_snapshot_process.rs:41 — SnapshotCapture::wait_for_exit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codex_image_generation_extension · ×1
  • codex_image_generation_extension::tool::save_image_generation_result (cognitive 16) codex-rs/ext/image-generation/src/tool.rs:347 — codex_image_generation_extension::tool::save_image_generation_result has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · FeaturesToml · ×1
  • FeaturesToml::entries (cognitive 16) codex-rs/features/src/lib.rs:949 — FeaturesToml::entries has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, boolean chains 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SessionTelemetry · ×1
  • SessionTelemetry::record_websocket_event (cognitive 16) codex-rs/otel/src/events/session_telemetry.rs:946 — SessionTelemetry::record_websocket_event has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageReader · ×1
  • MessageReader::next (cognitive 16) codex-rs/realtime-webrtc/src/message_reader.rs:29 — MessageReader::next has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EmaAuthenticatedHttpClient · ×1
  • EmaAuthenticatedHttpClient::authenticate (cognitive 16) codex-rs/rmcp-client/src/ema_http_client.rs:182 — EmaAuthenticatedHttpClient::authenticate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SandboxManager · ×1
  • SandboxManager::transform (cognitive 16) codex-rs/sandboxing/src/manager.rs:355 — SandboxManager::transform has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · UsageNoticeState · ×1
  • UsageNoticeState::update (cognitive 16) codex-rs/tui/src/chatwidget/usage_notice.rs:87 — UsageNoticeState::update has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Terminal · ×1
  • Terminal::draw_with_size (cognitive 16) codex-rs/tui/src/custom_terminal.rs:357 — Terminal::draw_with_size has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 3 (5 pts), if/else 4, loops 2 (4 pts), boolean chains 3 (nesting depth added 4). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D2 · Cognitive Complexity · ProsePreview · ×1
  • ProsePreview::update (cognitive 16) codex-rs/tui/src/streaming/prose_preview.rs:36 — ProsePreview::update has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 4, loops 1, match/switch 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · TaggedLineParser · ×1
  • TaggedLineParser::parse (cognitive 16) codex-rs/utils/stream-parser/src/tagged_line_parser.rs:46 — TaggedLineParser::parse has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PlaybackWriter · ×1
  • PlaybackWriter::write (cognitive 16) codex-rs/voice-host/src/playback.rs:60 — PlaybackWriter::write has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cargo.build_source_binaries (cognitive 16) · ×1
  • cargo.build_source_binaries (cognitive 16) scripts/codex_package/cargo.py:26 — cargo.build_source_binaries has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), boolean chains 4, ternaries 4, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · review_regressions.run_review_regressions (cognitive 16) · ×1
  • review_regressions.run_review_regressions (cognitive 16) scripts/mcp_conformance/review_regressions.py:774 — review_regressions.run_review_regressions has cognitive complexity 16 (threshold 15). Drivers by points: loops 5 (9 pts), if/else 3 (4 pts), boolean chains 2, ternaries 1 (nesting depth added 5). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · run_codex_compliance._validate_inventory (cognitive 16) · ×1
  • run_codex_compliance._validate_inventory (cognitive 16) scripts/mcp_conformance/run_codex_compliance.py:548 — run_codex_compliance._validate_inventory has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 3, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ProtocolServer._handle_modern (cognitive 16) · ×1
  • ProtocolServer._handle_modern (cognitive 16) scripts/mcp_conformance/server.py:364 — ProtocolServer._handle_modern has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D31 · IaC & Container Security · Medium IaC · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (6 members, 33 shared lines) · ×1
  • Near-duplicate member family (6 members, 33 shared lines) codex-rs/hooks/src/events/permission_request.rs:196 — codex-rs/hooks/src/events/permission_request.rs:196-302 | codex-rs/hooks/src/events/post_tool_use.rs:177-312 | codex-rs/hooks/src/events/pre_tool_use.rs:203-317 | codex-rs/hooks/src/events/session_start.rs:228-347 | codex-rs/hooks/src/events/stop.rs:241-399 | codex-rs/hooks/src/events/user_prompt_submit.rs:142-277 — These 6 members are variants of one another: a block of 33 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Near-duplicate member pair (62 shared lines) · ×1
  • Near-duplicate member pair (62 shared lines) codex-rs/app-server-transport/src/transport/remote_control/mod.rs:437 — codex-rs/app-server-transport/src/transport/remote_control/mod.rs:437-562 | codex-rs/app-server-transport/src/transport/remote_control/mod.rs:685-791 — These two members are variants of one another: 62 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (44 shared lines) · ×1
  • Near-duplicate member pair (44 shared lines) codex-rs/rollout-trace/src/protocol_event.rs:280 — codex-rs/rollout-trace/src/protocol_event.rs:280-455 | codex-rs/rollout-trace/src/protocol_event.rs:457-545 — These two members are variants of one another: 44 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (42 shared lines) · ×1
  • Near-duplicate member pair (42 shared lines) codex-rs/external-agent-migration/src/sessions/records_cla.rs:23 — codex-rs/external-agent-migration/src/sessions/records_cla.rs:23-104 | codex-rs/external-agent-migration/src/sessions/records_cur.rs:26-92 — These two members are variants of one another: 42 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×1
  • Edited copy of a member (24 corresponding lines) codex-rs/otel/src/events/session_telemetry.rs:769 — codex-rs/otel/src/events/session_telemetry.rs:769-815 | codex-rs/otel/src/events/session_telemetry.rs:835-872 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (25 corresponding lines) · ×1
  • Edited copy of a member (25 corresponding lines) codex-rs/tui/src/cwd_prompt.rs:121 — codex-rs/tui/src/cwd_prompt.rs:121-166 | codex-rs/tui/src/update_prompt.rs:54-102 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (66 corresponding lines) · ×1
  • Edited copy of a member (66 corresponding lines) scripts/mcp_conformance/server.py:800 — scripts/mcp_conformance/server.py:800-894 | scripts/mcp_conformance/server.py:949-1038 — These two members are one piece of code written twice and then edited apart: 66 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (17 corresponding lines) · ×1
  • Edited copy of a member (17 corresponding lines) codex-rs/tui/src/history_cell/approvals.rs:282 — codex-rs/tui/src/history_cell/approvals.rs:282-302 | codex-rs/tui/src/history_cell/approvals.rs:314-334 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (56 lines × 2) · ×1
  • Duplicated block (56 lines × 2) codex-rs/protocol/src/models.rs:1552 — codex-rs/protocol/src/models.rs:1552-1607 | codex-rs/protocol/src/models.rs:1619-1674 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (50 lines × 2) · ×1
  • Duplicated block (50 lines × 2) codex-rs/skills/src/mentions.rs:157 — codex-rs/skills/src/mentions.rs:157-206 | codex-rs/tui/src/mention_codec.rs:222-271 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (34 lines × 2) · ×1
  • Duplicated block (34 lines × 2) codex-rs/app-server-protocol/src/protocol/thread_history.rs:608 — codex-rs/app-server-protocol/src/protocol/thread_history.rs:608-641 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:648-681 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (31–32 lines × 2) · ×1
  • Duplicated block (31–32 lines × 2) codex-rs/app-server/src/command_exec.rs:527 — codex-rs/app-server/src/command_exec.rs:527-557 | codex-rs/app-server/src/request_processors/process_exec_processor.rs:564-595 — before extracting anything, compare `codex-rs/app-server/src/command_exec.rs` and `codex-rs/app-server/src/request_processors/process_exec_processor.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (29–30 lines × 2) · ×1
  • Duplicated block (29–30 lines × 2) codex-rs/core/src/codex_thread.rs:733 — codex-rs/core/src/codex_thread.rs:733-762 | codex-rs/core/src/session/thread_settings.rs:66-94 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×1
  • Duplicated block (30 lines × 2) codex-rs/core/src/session/mcp.rs:239 — codex-rs/core/src/session/mcp.rs:239-268 | codex-rs/core/src/session/mcp.rs:322-351 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (25–28 lines × 2) · ×1
  • Duplicated block (25–28 lines × 2) codex-rs/tui/src/bottom_pane/chat_composer.rs:2078 — codex-rs/tui/src/bottom_pane/chat_composer.rs:2078-2105 | codex-rs/tui/src/bottom_pane/chat_composer.rs:3685-3709 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (24–27 lines × 2) · ×1
  • Duplicated block (24–27 lines × 2) codex-rs/tui/src/chatwidget/plugin_catalog.rs:572 — codex-rs/tui/src/chatwidget/plugin_catalog.rs:572-595 | codex-rs/tui/src/chatwidget/plugin_catalog.rs:623-649 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×1
  • Duplicated block (26 lines × 2) codex-rs/ext/goal/src/runtime.rs:564 — codex-rs/ext/goal/src/runtime.rs:564-589 | codex-rs/ext/goal/src/runtime.rs:626-651 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (24–25 lines × 4) · ×1
  • Duplicated block (24–25 lines × 4) codex-rs/tui/src/bottom_pane/chat_composer.rs:2137 — codex-rs/tui/src/bottom_pane/chat_composer.rs:2137-2161 | codex-rs/tui/src/bottom_pane/chat_composer.rs:2220-2243 | codex-rs/tui/src/bottom_pane/chat_composer.rs:2307-2330 | codex-rs/tui/src/bottom_pane/chat_composer/slash_input.rs:258-282 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (21–24 lines × 6) · ×1
  • Duplicated block (21–24 lines × 6) codex-rs/hooks/src/events/permission_request.rs:275 — codex-rs/hooks/src/events/permission_request.rs:275-295 | codex-rs/hooks/src/events/post_tool_use.rs:281-301 | codex-rs/hooks/src/events/pre_tool_use.rs:285-305 | codex-rs/hooks/src/events/session_start.rs:313-336 | codex-rs/hooks/src/events/stop.rs:357-377 | codex-rs/hooks/src/events/user_prompt_submit.rs:246-266 — before extracting anything, compare `codex-rs/hooks/src/events/permission_request.rs` and `codex-rs/hooks/src/events/post_tool_use.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (23–24 lines × 2) · ×1
  • Duplicated block (23–24 lines × 2) codex-rs/otel/src/events/session_telemetry.rs:793 — codex-rs/otel/src/events/session_telemetry.rs:793-815 | codex-rs/otel/src/events/session_telemetry.rs:849-872 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×1
  • Duplicated block (23 lines × 2) codex-rs/app-server/src/command_exec.rs:457 — codex-rs/app-server/src/command_exec.rs:457-479 | codex-rs/app-server/src/request_processors/process_exec_processor.rs:489-511 — before extracting anything, compare `codex-rs/app-server/src/command_exec.rs` and `codex-rs/app-server/src/request_processors/process_exec_processor.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (20–22 lines × 2) · ×1
  • Duplicated block (20–22 lines × 2) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1707 — codex-rs/app-server-protocol/src/protocol/thread_history.rs:1707-1726 | codex-rs/thread-store/src/local/rollout_migration/legacy_event.rs:69-90 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (15–21 lines × 2) · ×1
  • Duplicated block (15–21 lines × 2) codex-rs/tui/src/streaming/controller.rs:310 — codex-rs/tui/src/streaming/controller.rs:310-330 | codex-rs/tui/src/streaming/controller.rs:359-373 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (17–20 lines × 2) · ×1
  • Duplicated block (17–20 lines × 2) codex-rs/core-plugins/src/marketplace_add/metadata.rs:56 — codex-rs/core-plugins/src/marketplace_add/metadata.rs:56-72 | codex-rs/core-plugins/src/marketplace_add/metadata.rs:99-118 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (19–20 lines × 2) · ×1
  • Duplicated block (19–20 lines × 2) codex-rs/core-plugins/src/marketplace_upgrade/git.rs:188 — codex-rs/core-plugins/src/marketplace_upgrade/git.rs:188-206 | codex-rs/core-plugins/src/startup_sync.rs:688-707 — before extracting anything, compare `codex-rs/core-plugins/src/marketplace_upgrade/git.rs` and `codex-rs/core-plugins/src/startup_sync.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (16–20 lines × 2) · ×1
  • Duplicated block (16–20 lines × 2) codex-rs/tui/src/app/managed_worktree_creation.rs:104 — codex-rs/tui/src/app/managed_worktree_creation.rs:104-123 | codex-rs/tui/src/app/working_directory.rs:198-213 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (18 lines × 3) · ×1
  • Duplicated block (18 lines × 3) codex-rs/hooks/src/events/pre_tool_use.rs:115 — codex-rs/hooks/src/events/pre_tool_use.rs:115-132 | codex-rs/hooks/src/events/session_start.rs:191-208 | codex-rs/hooks/src/events/user_prompt_submit.rs:111-128 — before extracting anything, compare `codex-rs/hooks/src/events/pre_tool_use.rs` and `codex-rs/hooks/src/events/session_start.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×1
  • Duplicated block (16–18 lines × 2) codex-rs/core-plugins/src/command_migration/render.rs:51 — codex-rs/core-plugins/src/command_migration/render.rs:51-66 | codex-rs/external-agent-migration/src/rewrite.rs:134-151 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (9–18 lines × 2) · ×1
  • Duplicated block (9–18 lines × 2) codex-rs/core/src/guardian/review_session.rs:165 — codex-rs/core/src/guardian/review_session.rs:165-173 | codex-rs/core/src/tasks/mod.rs:762-779 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×1
  • Duplicated block (16 lines × 3) codex-rs/code-mode-runtime/src/cell_actor/mod.rs:156 — codex-rs/code-mode-runtime/src/cell_actor/mod.rs:156-171 | codex-rs/code-mode-runtime/src/cell_actor/mod.rs:284-299 | codex-rs/code-mode-runtime/src/cell_actor/mod.rs:448-463 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (13–16 lines × 2) · ×1
  • Duplicated block (13–16 lines × 2) codex-rs/hooks/src/events/pre_tool_use.rs:268 — codex-rs/hooks/src/events/pre_tool_use.rs:268-280 | codex-rs/hooks/src/events/user_prompt_submit.rs:226-241 — before extracting anything, compare `codex-rs/hooks/src/events/pre_tool_use.rs` and `codex-rs/hooks/src/events/user_prompt_submit.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 89 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (11–16 lines × 2) · ×1
  • Duplicated block (11–16 lines × 2) codex-rs/tui/src/bottom_pane/selection_popup_common.rs:574 — codex-rs/tui/src/bottom_pane/selection_popup_common.rs:574-584 | codex-rs/tui/src/bottom_pane/selection_popup_common.rs:691-706 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14–15 lines × 4) · ×1
  • Duplicated block (14–15 lines × 4) codex-rs/analytics/src/events.rs:1520 — codex-rs/analytics/src/events.rs:1520-1534 | codex-rs/core/src/hook_runtime.rs:1007-1020 | codex-rs/hooks/src/engine/dispatcher.rs:298-312 | codex-rs/tui/src/bottom_pane/hooks_browser_view.rs:674-688 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
D4 · Code Duplication · Duplicated block (15 lines × 4) · ×1
  • Duplicated block (15 lines × 4) codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:79 — codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:79-93 | codex-rs/ext/skills/src/dynamic_skill_selector/fielded_bm25.rs:76-90 | codex-rs/ext/skills/src/dynamic_skill_selector/routing_card_lexical.rs:62-76 | codex-rs/ext/skills/src/dynamic_skill_selector/weighted_lexical.rs:60-74 — before extracting anything, compare `codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs` and `codex-rs/ext/skills/src/dynamic_skill_selector/fielded_bm25.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×1
  • Duplicated block (14 lines × 4) codex-rs/core/src/client_common.rs:91 — codex-rs/core/src/client_common.rs:91-104 | codex-rs/core/src/image_preparation.rs:196-209 | codex-rs/ext/image-generation/src/tool.rs:590-603 | codex-rs/utils/audio/src/lib.rs:73-86 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×1
  • Duplicated block (14 lines × 3) codex-rs/core/src/unified_exec/process_manager.rs:703 — codex-rs/core/src/unified_exec/process_manager.rs:703-716 | codex-rs/core/src/unified_exec/process_manager.rs:725-738 | codex-rs/core/src/unified_exec/process_manager.rs:813-826 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10–14 lines × 2) · ×1
  • Duplicated block (10–14 lines × 2) codex-rs/tui/src/app/managed_worktree_creation.rs:135 — codex-rs/tui/src/app/managed_worktree_creation.rs:135-144 | codex-rs/tui/src/app/working_directory.rs:231-244 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (11–14 lines × 2) · ×1
  • Duplicated block (11–14 lines × 2) codex-rs/tui/src/bottom_pane/selection_popup_common.rs:399 — codex-rs/tui/src/bottom_pane/selection_popup_common.rs:399-409 | codex-rs/tui/src/bottom_pane/selection_popup_common.rs:558-571 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12–13 lines × 6) · ×1
  • Duplicated block (12–13 lines × 6) codex-rs/hooks/src/events/permission_request.rs:201 — codex-rs/hooks/src/events/permission_request.rs:201-213 | codex-rs/hooks/src/events/post_tool_use.rs:184-195 | codex-rs/hooks/src/events/pre_tool_use.rs:211-222 | codex-rs/hooks/src/events/session_start.rs:235-246 | codex-rs/hooks/src/events/stop.rs:256-267 | codex-rs/hooks/src/events/user_prompt_submit.rs:149-161 — before extracting anything, compare `codex-rs/hooks/src/events/permission_request.rs` and `codex-rs/hooks/src/events/post_tool_use.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×1
  • Duplicated block (13 lines × 4) codex-rs/windows-sandbox-rs/src/acl.rs:165 — codex-rs/windows-sandbox-rs/src/acl.rs:165-177 | codex-rs/windows-sandbox-rs/src/acl.rs:362-374 | codex-rs/windows-sandbox-rs/src/acl.rs:403-415 | codex-rs/windows-sandbox-rs/src/acl.rs:461-473 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10–13 lines × 2) · ×1
  • Duplicated block (10–13 lines × 2) codex-rs/tui/src/bottom_pane/multi_select_picker.rs:583 — codex-rs/tui/src/bottom_pane/multi_select_picker.rs:583-592 | codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:285-297 — before extracting anything, compare `codex-rs/tui/src/bottom_pane/multi_select_picker.rs` and `codex-rs/tui/src/bottom_pane/skills_toggle_view.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 97 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×1
  • Duplicated block (12 lines × 3) codex-rs/windows-sandbox-rs/src/acl.rs:581 — codex-rs/windows-sandbox-rs/src/acl.rs:581-592 | codex-rs/windows-sandbox-rs/src/acl.rs:924-935 | codex-rs/windows-sandbox-rs/src/acl.rs:1031-1042 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×1
  • Duplicated block (10–12 lines × 2) codex-rs/rmcp-client/src/utils.rs:112 — codex-rs/rmcp-client/src/utils.rs:112-121 | codex-rs/rmcp-client/src/utils.rs:137-148 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (9–12 lines × 2) · ×1
  • Duplicated block (9–12 lines × 2) codex-rs/tui/src/app_server_session.rs:2472 — codex-rs/tui/src/app_server_session.rs:2472-2483 | codex-rs/tui/src/app_server_session.rs:2547-2555 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (8–11 lines × 5) · ×1
  • Duplicated block (8–11 lines × 5) codex-rs/tui/src/config_panel/render.rs:136 — codex-rs/tui/src/config_panel/render.rs:136-146 | codex-rs/tui/src/config_panel/render.rs:177-185 | codex-rs/tui/src/config_panel/render.rs:214-221 | codex-rs/tui/src/config_panel/render.rs:251-259 | codex-rs/tui/src/config_panel/render.rs:291-299 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10–11 lines × 4) · ×1
  • Duplicated block (10–11 lines × 4) codex-rs/app-server/src/bespoke_event_handling.rs:977 — codex-rs/app-server/src/bespoke_event_handling.rs:977-987 | codex-rs/core/src/session/turn.rs:2307-2316 | codex-rs/rollout-trace/src/protocol_event.rs:533-542 | codex-rs/thread-manager-sample/src/main.rs:445-455 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
D4 · Code Duplication · Duplicated block (8–11 lines × 3) · ×1
  • Duplicated block (8–11 lines × 3) codex-rs/core/src/config/mod.rs:2867 — codex-rs/core/src/config/mod.rs:2867-2877 | codex-rs/core/src/config/mod.rs:2880-2887 | codex-rs/core/src/config/mod.rs:2895-2905 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10 lines × 6) · ×1
  • Duplicated block (10 lines × 6) codex-rs/git-utils/src/apply.rs:466 — codex-rs/git-utils/src/apply.rs:466-475 | codex-rs/git-utils/src/apply.rs:478-487 | codex-rs/git-utils/src/apply.rs:490-499 | codex-rs/git-utils/src/apply.rs:504-513 | codex-rs/git-utils/src/apply.rs:557-566 | codex-rs/git-utils/src/apply.rs:571-580 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (9–10 lines × 3) · ×1
  • Duplicated block (9–10 lines × 3) codex-rs/hooks/src/events/session_start.rs:278 — codex-rs/hooks/src/events/session_start.rs:278-287 | codex-rs/hooks/src/events/stop.rs:284-292 | codex-rs/hooks/src/events/user_prompt_submit.rs:185-193 — before extracting anything, compare `codex-rs/hooks/src/events/session_start.rs` and `codex-rs/hooks/src/events/stop.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (4–10 lines × 3) · ×1
  • Duplicated block (4–10 lines × 3) codex-rs/app-server-protocol/src/schema_fixtures.rs:255 — codex-rs/app-server-protocol/src/schema_fixtures.rs:255-264 | codex-rs/config/src/schema.rs:292-295 | codex-rs/hooks/src/schema.rs:786-795 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D4 · Code Duplication · Duplicated block (7–10 lines × 2) · ×1
  • Duplicated block (7–10 lines × 2) codex-rs/tui/src/status/card.rs:537 — codex-rs/tui/src/status/card.rs:537-546 | codex-rs/tui/src/status/card.rs:556-562 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (7–9 lines × 4) · ×1
  • Duplicated block (7–9 lines × 4) codex-rs/apply-patch/src/streaming_parser.rs:314 — codex-rs/apply-patch/src/streaming_parser.rs:314-322 | codex-rs/apply-patch/src/streaming_parser.rs:325-333 | codex-rs/apply-patch/src/streaming_parser.rs:336-344 | codex-rs/apply-patch/src/streaming_parser.rs:345-351 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (4–9 lines × 3) · ×1
  • Duplicated block (4–9 lines × 3) codex-rs/app-server-transport/src/transport/remote_control/enroll.rs:70 — codex-rs/app-server-transport/src/transport/remote_control/enroll.rs:70-78 | codex-rs/app-server-transport/src/transport/remote_control/enroll.rs:178-186 | codex-rs/app-server-transport/src/transport/remote_control/server_api.rs:266-269 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (3–9 lines × 3) · ×1
  • Duplicated block (3–9 lines × 3) codex-rs/tui/src/external_agent_config_migration/mod.rs:102 — codex-rs/tui/src/external_agent_config_migration/mod.rs:102-110 | codex-rs/tui/src/external_agent_config_migration/source.rs:61-69 | codex-rs/tui/src/model_migration.rs:160-162 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D4 · Code Duplication · Duplicated block (7–8 lines × 3) · ×1
  • Duplicated block (7–8 lines × 3) codex-rs/otel/src/metrics/client.rs:654 — codex-rs/otel/src/metrics/client.rs:654-661 | codex-rs/otel/src/provider.rs:462-468 | codex-rs/otel/src/provider.rs:544-550 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (6–8 lines × 2) · ×1
  • Duplicated block (6–8 lines × 2) codex-rs/core/src/session/mod.rs:1729 — codex-rs/core/src/session/mod.rs:1729-1734 | codex-rs/core/src/session/mod.rs:1772-1779 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (6–7 lines × 3) · ×1
  • Duplicated block (6–7 lines × 3) codex-rs/cloud-tasks/src/lib.rs:1024 — codex-rs/cloud-tasks/src/lib.rs:1024-1029 | codex-rs/cloud-tasks/src/lib.rs:1791-1796 | codex-rs/cloud-tasks/src/lib.rs:1829-1835 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6 lines × 10) · ×1
  • Duplicated block (6 lines × 10) codex-rs/network-proxy/src/http_proxy.rs:816 — codex-rs/network-proxy/src/http_proxy.rs:816-821 | codex-rs/network-proxy/src/http_proxy.rs:867-872 | codex-rs/network-proxy/src/http_proxy.rs:909-914 | codex-rs/network-proxy/src/http_proxy.rs:980-985 | codex-rs/network-proxy/src/socks5.rs:252-257 | codex-rs/network-proxy/src/socks5.rs:310-315 | codex-rs/network-proxy/src/socks5.rs:355-360 | codex-rs/network-proxy/src/socks5.rs:420-425 | codex-rs/network-proxy/src/socks5.rs:713-718 | codex-rs/network-proxy/src/socks5.rs:802-807 — there are 10 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 10 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (5–6 lines × 2) · ×1
  • Duplicated block (5–6 lines × 2) codex-rs/cli/src/doctor/output.rs:311 — codex-rs/cli/src/doctor/output.rs:311-316 | codex-rs/cli/src/doctor/output.rs:423-427 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×1
  • Duplicated block (5 lines × 5) codex-rs/cloud-tasks/src/lib.rs:1025 — codex-rs/cloud-tasks/src/lib.rs:1025-1029 | codex-rs/cloud-tasks/src/lib.rs:1098-1102 | codex-rs/cloud-tasks/src/lib.rs:1320-1324 | codex-rs/cloud-tasks/src/lib.rs:1792-1796 | codex-rs/cloud-tasks/src/lib.rs:1831-1835 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×1
  • Duplicated block (5 lines × 4) codex-rs/cli/src/migrate_rollouts.rs:409 — codex-rs/cli/src/migrate_rollouts.rs:409-413 | codex-rs/rollout/src/list.rs:1464-1468 | codex-rs/rollout/src/search.rs:132-136 | codex-rs/rollout/src/search.rs:232-236 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×1
  • Duplicated block (7 lines × 6) codex-rs/tui/src/app/agents_overview_actions.rs:39 — codex-rs/tui/src/app/agents_overview_actions.rs:39-45 | codex-rs/tui/src/app/agents_overview_errors.rs:10-16 | codex-rs/tui/src/app/daemon_menu.rs:15-21 | codex-rs/tui/src/chatwidget/quick_dials.rs:14-20 | codex-rs/tui/src/chatwidget/safety_buffering.rs:18-24 | codex-rs/tui/src/config_panel/render.rs:326-332 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 6 times.
D4 · Code Duplication · Duplicated block (41 lines × 2) · ×1
  • Duplicated block (41 lines × 2) codex-rs/state/src/runtime/goals.rs:168 — codex-rs/state/src/runtime/goals.rs:168-208 | codex-rs/state/src/runtime/goals.rs:225-266 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (32 lines × 2) · ×1
  • Duplicated block (32 lines × 2) codex-rs/state/src/runtime/logs.rs:91 — codex-rs/state/src/runtime/logs.rs:91-122 | codex-rs/state/src/runtime/logs.rs:173-205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (15 lines × 3) · ×1
  • Duplicated block (15 lines × 3) scripts/mcp_conformance/server.py:800 — scripts/mcp_conformance/server.py:800-814 | scripts/mcp_conformance/server.py:901-915 | scripts/mcp_conformance/server.py:949-963 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (32–33 lines × 2) · ×1
  • Duplicated block (32–33 lines × 2) codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:38 — codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:38-70 | codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs:368-399 — before extracting anything, compare `codex-rs/rmcp-client/src/bin/rmcp_test_server.rs` and `codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (20–23 lines × 2) · ×1
  • Duplicated block (20–23 lines × 2) codex-rs/app-server-test-client/src/plugin_analytics_capture.rs:15 — codex-rs/app-server-test-client/src/plugin_analytics_capture.rs:15-37 | codex-rs/app-server-test-client/src/plugin_analytics_smoke.rs:383-402 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (12–13 lines × 3) · ×1
  • Duplicated block (12–13 lines × 3) codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:51 — codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:51-63 | codex-rs/rmcp-client/src/bin/test_stdio_server.rs:227-238 | codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs:381-393 — before extracting anything, compare `codex-rs/rmcp-client/src/bin/rmcp_test_server.rs` and `codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (14–17 lines × 2) · ×1
  • Duplicated block (14–17 lines × 2) sdk/python/examples/07_image_and_text/async.py:20 — sdk/python/examples/07_image_and_text/async.py:20-33 | sdk/python/examples/08_local_image_and_text/async.py:23-39 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (7–12 lines × 2) · ×1
  • Duplicated block (7–12 lines × 2) codex-rs/skills/src/assets/samples/imagegen/scripts/image_gen.py:603 — codex-rs/skills/src/assets/samples/imagegen/scripts/image_gen.py:603-614 | codex-rs/skills/src/assets/samples/imagegen/scripts/image_gen.py:662-668 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D5 · Coupling · Unstable project codex-app-server · ×1
  • Unstable project codex-app-server — codex-app-server has instability 0.97 with 2 dependents.
D5 · Coupling · Unstable project codex-app-server-client · ×1
  • Unstable project codex-app-server-client — codex-app-server-client has instability 0.86 with 2 dependents.
D5 · Coupling · Unstable project codex-app-server-transport · ×1
  • Unstable project codex-app-server-transport — codex-app-server-transport has instability 0.81 with 3 dependents.
D5 · Coupling · Unstable project codex-cloud-tasks · ×1
  • Unstable project codex-cloud-tasks — codex-cloud-tasks has instability 0.90 with 1 dependents.
D5 · Coupling · Unstable project codex-connectors-extension · ×1
  • Unstable project codex-connectors-extension — codex-connectors-extension has instability 0.83 with 1 dependents.
D5 · Coupling · Unstable project codex-exec · ×1
  • Unstable project codex-exec — codex-exec has instability 0.95 with 1 dependents.
D5 · Coupling · Unstable project codex-external-agent-migration · ×1
  • Unstable project codex-external-agent-migration — codex-external-agent-migration has instability 0.93 with 1 dependents.
D5 · Coupling · Unstable project codex-goal-extension · ×1
  • Unstable project codex-goal-extension — codex-goal-extension has instability 0.91 with 1 dependents.
D5 · Coupling · Unstable project codex-guardian-v2 · ×1
  • Unstable project codex-guardian-v2 — codex-guardian-v2 has instability 0.94 with 1 dependents.
D5 · Coupling · Unstable project codex-history-notes-extension · ×1
  • Unstable project codex-history-notes-extension — codex-history-notes-extension has instability 0.91 with 1 dependents.
D5 · Coupling · Unstable project codex-image-generation-extension · ×1
  • Unstable project codex-image-generation-extension — codex-image-generation-extension has instability 0.88 with 2 dependents.
D5 · Coupling · Unstable project codex-mcp-extension · ×1
  • Unstable project codex-mcp-extension — codex-mcp-extension has instability 0.93 with 1 dependents.
D5 · Coupling · Unstable project codex-memories-extension · ×1
  • Unstable project codex-memories-extension — codex-memories-extension has instability 0.90 with 1 dependents.
D5 · Coupling · Unstable project codex-memories-write · ×1
  • Unstable project codex-memories-write — codex-memories-write has instability 0.85 with 3 dependents.
D5 · Coupling · Unstable project codex-runtime-agent-instance · ×1
  • Unstable project codex-runtime-agent-instance — codex-runtime-agent-instance has instability 0.86 with 1 dependents.
D5 · Coupling · Unstable project codex-skills-extension · ×1
  • Unstable project codex-skills-extension — codex-skills-extension has instability 0.81 with 3 dependents.
D5 · Coupling · Unstable project codex-tui · ×1
  • Unstable project codex-tui — codex-tui has instability 0.96 with 2 dependents.
D5 · Coupling · Unstable project codex-web-search-extension · ×1
  • Unstable project codex-web-search-extension — codex-web-search-extension has instability 0.92 with 1 dependents.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×1
  • Sync-over-async blocking codex-rs/cli/src/marketplace_cmd.rs:367 — `run_upgrade` is async and calls block_on — a blocking call inside async code stalls the executor thread, and every task scheduled on it for as long as it runs.
R10 · Code Duplication · Duplicated block (50 lines × 2 locations) · ×1
  • Duplicated block (50 lines × 2 locations) codex-cli/bin/codex.js:25 — codex-cli/bin/codex.js:25 · sdk/typescript/src/exec.ts:357 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
R10 · Code Duplication · Duplicated block (19 lines × 2 locations) · ×1
  • Duplicated block (19 lines × 2 locations) codex-cli/bin/codex.js:267 — codex-cli/bin/codex.js:267 · codex-rs/responses-api-proxy/npm/bin/codex-responses-api-proxy.js:83 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R2 · Cyclomatic Complexity · Complex function run (cyclomatic 42, cognitive 50) · ×1
  • Complex function run (cyclomatic 42, cognitive 50) sdk/typescript/src/exec.ts:94 — run has cyclomatic complexity 42 and cognitive complexity 50; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function findCodexPath (cyclomatic 16, cognitive 12) · ×1
  • Complex function findCodexPath (cyclomatic 16, cognitive 12) sdk/typescript/src/exec.ts:356 — findCodexPath has cyclomatic complexity 16 and cognitive complexity 12; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function detectPackageManager (cyclomatic 13, cognitive 18) · ×1
  • Complex function detectPackageManager (cyclomatic 13, cognitive 18) codex-cli/bin/codex.js:177 — detectPackageManager has cyclomatic complexity 13 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function toTomlValue (cyclomatic 12, cognitive 19) · ×1
  • Complex function toTomlValue (cyclomatic 12, cognitive 19) sdk/typescript/src/exec.ts:314 — toTomlValue has cyclomatic complexity 12 and cognitive complexity 19; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function flattenConfigOverrides (cyclomatic 12, cognitive 18) · ×1
  • Complex function flattenConfigOverrides (cyclomatic 12, cognitive 18) sdk/typescript/src/exec.ts:274 — flattenConfigOverrides has cyclomatic complexity 12 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function determineTargetTriple (cyclomatic 11, cognitive 13) · ×1
  • Complex function determineTargetTriple (cyclomatic 11, cognitive 13) codex-rs/responses-api-proxy/npm/bin/codex-responses-api-proxy.js:12 — determineTargetTriple has cyclomatic complexity 11 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files · sdk/typescript/src/exec.ts · ×1
  • sdk/typescript/src/exec.ts: 444 lines of code sdk/typescript/src/exec.ts:1 — sdk/typescript/src/exec.ts has 444 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
S1 · Web-Security Posture · Third-party script without Subresource Integrity · ×1
  • Third-party script without Subresource Integrity codex-rs/tui/assets/inline_visualization/visualize.html:2 — `https://unpkg.com/@floating-ui/core@1.7.3/dist/floating-ui.core.umd.min.js` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. 3 such include(s) across the repository's markup.
X17 · Uncapped recursion over a caller-supplied document · Recursive walk over a caller-supplied document has no depth cap · ×1
  • Recursive walk over a caller-supplied document has no depth cap sdk/python/src/openai_codex/errors.py:77 — `map_jsonrpc_error` is public, takes a document from its caller (line 86) and hands it to `_is_server_overloaded`, which calls itself at line 77 (`_is_server_overloaded`) with a piece of `data` (and at line 81) — and nowhere in `_is_server_overloaded` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_is_server_overloaded` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Minor — 148 finding(s)
X4 · Structured logging · Interpolated log message defeats structured logging · ×40
  • Interpolated log message defeats structured logging codex-rs/tui/src/app_event_sender.rs:68 — `error!` at line 68 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/app_server_session.rs:1251 — `warn!` at line 1251 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/app_server_session.rs:1262 — `warn!` at line 1262 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/chatwidget.rs:1888 — `error!` at line 1888 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/clipboard_copy.rs:301 — `debug!` at line 301 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/clipboard_copy.rs:306 — `debug!` at line 306 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/clipboard_paste.rs:72 — `debug!` at line 72 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/clipboard_paste.rs:89 — `debug!` at line 89 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/clipboard_paste.rs:182 — `debug!` at line 182 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/clipboard_paste.rs:224 — `debug!` at line 224 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/clipboard_paste.rs:228 — `debug!` at line 228 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/clipboard_paste.rs:232 — `debug!` at line 232 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/custom_terminal.rs:195 — `warn!` at line 195 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/file_search.rs:95 — `warn!` at line 95 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/lib.rs:1218 — `error!` at line 1218 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/lib.rs:1477 — `error!` at line 1477 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/session_log.rs:59 — `warn!` at line 59 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/session_log.rs:63 — `warn!` at line 63 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/session_log.rs:67 — `warn!` at line 67 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/session_log.rs:70 — `warn!` at line 70 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/session_log.rs:105 — `error!` at line 105 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/session_start.rs:132 — `warn!` at line 132 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/startup_hooks_review.rs:59 — `warn!` at line 59 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/startup_orchestration.rs:944 — `warn!` at line 944 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging codex-rs/tui/src/tui.rs:441 — `warn!` at line 441 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • + 15 more in this group — see findings.md.
X7 · Silent fallback defaults · Silent fallback default on Err · ×34
  • Silent fallback default on Err codex-rs/cli/src/doctor.rs:893 — `generated_at` turns every `Err` into `"unknown".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/cli/src/doctor.rs:1095 — `codex_path_entries` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/cli/src/doctor/desktop.rs:153 — `discover_desktop_logs` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/cli/src/doctor/filesystem_paths.rs:227 — `source` turns every `Err` into `false` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/cli/src/doctor/git.rs:86 — `git_candidates` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/cloud-tasks/src/lib.rs:173 — `resolve_git_ref_with_git_info` turns every `Err` into `"main".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/code-mode-protocol/src/json_schema_types.rs:519 — `render_json_schema_literal` turns every `Err` into `"unknown".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/config/src/strict_config.rs:116 — `unknown_tui_toml_value_path` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/core/src/agent/control/runtime_context.rs:45 — `format_legacy_environment_context_subagents` turns every `Err` into `String::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/core/src/connectors.rs:434 — `cached_directory_connectors_for_tool_suggest_with_auth` turns every `Err` into `Arc::default()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/core-plugins/src/manager.rs:615 — `get` turns every `Err` into `false` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/core-plugins/src/script_attribution.rs:172 — `from_plugin_load_outcome` turns every `Err` into `Self::default()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/core-plugins/src/loader.rs:266 — `merge_configured_plugins_with_remote_installed` turns every `Err` into `true` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/core-plugins/src/loader.rs:1177 — `plugin_app_declarations_from_value` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/core-plugins/src/remote.rs:1174 — `cached_remote_plugin_catalog_scopes` turns every `Err` into `BTreeSet::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/exec-server/src/capability_discovery.rs:469 — `plugin_declaration_paths` turns every `Err` into `PluginDeclarationPaths::default()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/execpolicy/src/policy.rs:348 — `match_host_executable_rules` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/external-agent-migration/src/detect/sessions/connectors_cur.rs:129 — `session_connector_names` turns every `Err` into `BTreeMap::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/external-agent-migration/src/detect/sessions/connectors_cur.rs:224 — `child_directories` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/external-agent-migration/src/detect/sessions/connectors_cur.rs:282 — `mcp_server_names_from_file` turns every `Err` into `BTreeSet::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/login/src/oauth/diagnostics.rs:86 — `sanitize_url_for_logging` turns every `Err` into `"<invalid-url>".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/network-proxy/src/certs.rs:741 — `generated_managed_ca_artifact_paths` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/network-proxy/src/credential_broker/registry.rs:198 — `select_credentials` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/network-proxy/src/policy.rs:196 — `parse_domain_for_constraints` turns every `Err` into `String::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err codex-rs/protocol/src/permissions.rs:1462 — `get_readable_roots_with_cwd` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • + 9 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×25
  • Duplicated predicate sdk/typescript/src/exec.ts:353 — `typeof value === "object" && value !== null && !Array.isArray(value)` appears character-identically in 2 files — sdk/typescript/src/exec.ts, sdk/typescript/src/outputSchemaFile.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/mcp_conformance/review_regressions.py:1206 — `args.extract_baseline is not None and args.baseline_report is None` appears character-identically in 2 files — scripts/mcp_conformance/review_regressions.py, scripts/mcp_conformance/run_codex_compliance.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/mcp_conformance/review_regressions.py:1209 — `args.extract_baseline is not None and args.write_baseline is not None` appears character-identically in 2 files — scripts/mcp_conformance/review_regressions.py, scripts/mcp_conformance/run_codex_compliance.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/mcp_conformance/codex_conformance_adapter.py:102 — `isinstance(entry, dict) and entry.get("name") == TEST_SERVER_NAME` appears character-identically in 2 files — scripts/mcp_conformance/codex_conformance_adapter.py, scripts/mcp_conformance/review_regressions.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/mcp_conformance/review_regressions.py:1289 — `isinstance(gate, dict) and gate.get("success") is True` appears character-identically in 2 files — scripts/mcp_conformance/review_regressions.py, scripts/mcp_conformance/run_codex_compliance.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/mcp_conformance/review_regressions.py:1197 — `not codex_binary.is_file() or not os.access(codex_binary, os.X_OK)` appears character-identically in 2 files — scripts/mcp_conformance/review_regressions.py, scripts/mcp_conformance/run_codex_compliance.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/mcp_conformance/review_regressions.py:1102 — `not errors and not new_failures and not missing_checks` appears character-identically in 2 files — scripts/mcp_conformance/review_regressions.py, scripts/mcp_conformance/run_codex_compliance.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/mcp_conformance/review_regressions.py:896 — `not isinstance(mode, str) or not isinstance(transport, str)` appears character-identically in 2 files — scripts/mcp_conformance/review_regressions.py, scripts/mcp_conformance/run_codex_compliance.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate .github/scripts/publish_r2_release.py:290 — `not isinstance(tag, str) or not tag.startswith("rust-v")` appears character-identically in 2 files — .github/scripts/publish_r2_release.py, .github/scripts/resolve_python_cli_release.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate codex-rs/agent-identity/src/lib.rs:295 — `!h.is_empty() && !p.is_empty() && !s.is_empty()` appears character-identically in 2 files — codex-rs/agent-identity/src/lib.rs, codex-rs/login/src/token_data.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate codex-rs/tui/src/app.rs:1195 — `!had_active_modal && self.chat_widget.has_active_modal() && self.startup_protected_input_boundary` appears character-identically in 2 files — codex-rs/tui/src/app.rs, codex-rs/tui/src/app/thread_routing.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate codex-rs/tui/src/bottom_pane/multi_select_picker.rs:548 — `!modifiers.contains(KeyModifiers::CONTROL) && !modifiers.contains(KeyModifiers::ALT)` appears character-identically in 3 files — codex-rs/tui/src/bottom_pane/multi_select_picker.rs, codex-rs/tui/src/bottom_pane/skills_toggle_view.rs, codex-rs/tui/src/resume_picker.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate codex-rs/tui/src/app/owned_transcript.rs:429 — `!tui.is_owned_screen() || self.overlay.is_some()` appears character-identically in 2 files — codex-rs/tui/src/app/owned_transcript.rs, codex-rs/tui/src/app_backtrack/legacy_input.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate codex-rs/app-server/src/code_mode_host.rs:72 — `!url.username().is_empty() || url.password().is_some()` appears character-identically in 2 files — codex-rs/app-server/src/code_mode_host.rs, codex-rs/utils/path-uri/src/lib.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate codex-rs/tui/src/app/resume_config.rs:91 — `!uses_remote_workspace_or_environment || cwd_override.is_some()` appears character-identically in 2 files — codex-rs/tui/src/app/resume_config.rs, codex-rs/tui/src/lib.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate codex-rs/backend-client/src/client.rs:232 — `(base_url.starts_with("https://chatgpt.com") || base_url.starts_with("https://chat.openai.com")) && !base_url.contains("/backend-api")` appears character-identically in 3 files — codex-rs/backend-client/src/client.rs, codex-rs/cloud-tasks/src/util.rs, codex-rs/codex-mcp/src/mcp/mod.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:854 — `answer.answer_committed && answer.draft != draft` appears character-identically in 2 files — codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs, codex-rs/tui/src/bottom_pane/request_user_input/mod.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate codex-rs/cli/src/main.rs:2672 — `answer.eq_ignore_ascii_case("y") || answer.eq_ignore_ascii_case("yes")` appears character-identically in 2 files — codex-rs/cli/src/main.rs, codex-rs/tui/src/session_archive_commands.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate codex-rs/cloud-tasks/src/lib.rs:965 — `app.refresh_inflight || app.details_inflight || app.env_loading || app.apply_preflight_inflight || app.apply_inflight` appears character-identically in 2 files — codex-rs/cloud-tasks/src/lib.rs, codex-rs/cloud-tasks/src/ui.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate codex-rs/cli/src/exec_server_command.rs:445 — `auth.is_chatgpt_auth() || auth.is_api_key_auth()` appears character-identically in 2 files — codex-rs/cli/src/exec_server_command.rs, codex-rs/core/src/realtime_conversation.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate codex-rs/core-plugins/src/command_migration/render.rs:94 — `byte.is_ascii_alphanumeric() || byte == b'_'` appears character-identically in 2 files — codex-rs/core-plugins/src/command_migration/render.rs, codex-rs/external-agent-migration/src/rewrite.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate codex-rs/analytics/src/reducer.rs:197 — `character.is_ascii_lowercase() || character.is_ascii_digit() || character == '_'` appears character-identically in 2 files — codex-rs/analytics/src/reducer.rs, codex-rs/core-plugins/src/plugin_metrics.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate codex-rs/tui/src/lib.rs:1504 — `cli.fork_picker || cli.fork_last || cli.fork_session_id.is_some()` appears character-identically in 2 files — codex-rs/tui/src/lib.rs, codex-rs/tui/src/startup_orchestration.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate codex-rs/tui/src/session_archive_commands.rs:234 — `cli.no_daemon && explicit_remote_endpoint.is_some()` appears character-identically in 2 files — codex-rs/tui/src/session_archive_commands.rs, codex-rs/tui/src/startup_orchestration.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate codex-rs/tui/src/lib.rs:1465 — `cli.resume_picker || cli.fork_picker || cli.agents_overview` appears character-identically in 2 files — codex-rs/tui/src/lib.rs, codex-rs/tui/src/startup_orchestration.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
D16 · Bus Factor · Off-boarding risk · ×24
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 44 significant file(s) lose their only recent owner: codex-rs/tui/src/ide_context/ipc.rs, codex-rs/tui/src/markdown_render/math/render.rs, codex-rs/mermaid/src/tests.rs, codex-rs/tui/src/app/thread_goal_actions.rs, codex-rs/tui/src/bottom_pane/feedback_note_view.rs, codex-rs/cli/src/doctor/filesystem_paths.rs, codex-rs/tui/src/markdown_render/math.rs, codex-rs/cli/src/doctor/background.rs (+36 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 34 significant file(s) lose their only recent owner: codex-rs/message-board/src/local.rs, codex-rs/memories/write/src/rollout_input.rs, codex-rs/core/src/agent/control/api.rs, codex-rs/core/src/agent/api.rs, codex-rs/git-utils/src/branch.rs, codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs, codex-rs/ext/skills/src/dynamic_skill_selector/fielded_bm25.rs, codex-rs/rollout/src/seekable_reader.rs (+26 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 16 significant file(s) lose their only recent owner: codex-rs/voice-host/src/devices.rs, codex-rs/tui/src/chatwidget/worktree_picker.rs, codex-rs/worktree/src/lib.rs, codex-rs/realtime-webrtc/src/session.rs, codex-rs/realtime-webrtc/src/client.rs, codex-rs/voice-host/src/main.rs, codex-rs/voice-host/src/processing.rs, codex-rs/voice-host/src/transport.rs (+8 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 15 significant file(s) lose their only recent owner: codex-rs/tui/src/analytics/normalize.rs, codex-rs/tui/src/transcript_reflow.rs, codex-rs/tui/src/analytics/report_data.rs, codex-rs/tui/src/app/turn_tips.rs, codex-rs/tui/src/analytics/plot/annotations.rs, codex-rs/cli/src/doctor/system.rs, codex-rs/tui/src/app/recap_history.rs, codex-rs/tui/src/clipboard_copy/tmux.rs (+7 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 14 significant file(s) lose their only recent owner: codex-rs/mxc-sandbox/src/policy.rs, codex-rs/core/src/session/retained_context.rs, codex-rs/core/src/context_manager/history_user_authorization.rs, codex-rs/guardian-context/src/profile/window.rs, codex-rs/history/src/reconciled_retained_context.rs, codex-rs/skills/src/parser.rs, codex-rs/cli/src/sandbox_setup.rs, codex-rs/core/src/session/reasoning_effort.rs (+6 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #6 — If anonymized user #6 becomes unavailable, 11 significant file(s) lose their only recent owner: codex-rs/rollout-trace/src/reducer/code_cell.rs, codex-rs/rollout-trace/src/reducer/conversation.rs, codex-rs/rollout-trace/src/reducer/mod.rs, codex-rs/rollout-trace/src/thread.rs, codex-rs/rollout-trace/src/reducer/tool.rs, codex-rs/rollout-trace/src/model/runtime.rs, codex-rs/rollout-trace/src/raw_event.rs, codex-rs/rollout-trace/src/reducer/inference.rs (+3 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #7 — If anonymized user #7 becomes unavailable, 8 significant file(s) lose their only recent owner: codex-rs/external-agent-migration/src/service_tests/plugins/marketplaces.rs, codex-rs/app-server/src/external_agent_migration/protocol.rs, codex-rs/external-agent-migration/src/detect/sessions/connectors_cur.rs, codex-rs/external-agent-migration/src/migration_source.rs, codex-rs/external-agent-migration/src/detect/sessions/connectors_cla.rs, codex-rs/external-agent-migration/src/model.rs, codex-rs/external-agent-migration/src/reporting.rs, codex-rs/external-agent-migration/src/detect/sessions/common.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #8 — If anonymized user #8 becomes unavailable, 7 significant file(s) lose their only recent owner: codex-rs/message-history/src/batch.rs, codex-rs/tui/src/bottom_pane/chat_composer/completion_target.rs, codex-rs/rmcp-client/src/bounded_stdio_transport.rs, codex-rs/utils/pty/src/child.rs, codex-rs/tui/src/bottom_pane/textarea/hyperlinks.rs, codex-rs/tui/src/pets/catalog.rs, codex-rs/utils/pty/src/child_reaper.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #9 — If anonymized user #9 becomes unavailable, 6 significant file(s) lose their only recent owner: codex-rs/exec-server/src/discoverV2/capability_discoveries.rs, codex-rs/exec-server/src/discoverV2/capability_manager.rs, codex-rs/core-plugins/src/catalog.rs, codex-rs/exec-server/src/discoverV2/capability_manager/capability_watchers.rs, codex-rs/exec-server/src/discoverV2/capability_locations/candidates.rs, codex-rs/exec-server-protocol/src/capabilities.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #10 — If anonymized user #10 becomes unavailable, 5 significant file(s) lose their only recent owner: codex-rs/network-proxy/src/credential_broker/configured.rs, codex-rs/network-proxy/src/credential_broker/matching.rs, codex-rs/network-proxy/src/brokered_tunnel.rs, codex-rs/network-proxy/src/credential_broker/providers/github.rs, codex-rs/network-proxy/src/credential_broker/providers/openai.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #11 — If anonymized user #11 becomes unavailable, 5 significant file(s) lose their only recent owner: bazel/rules/testing/wine/src/lib.rs, codex-rs/file-system/src/environment_accessor.rs, codex-rs/exec-server/src/file_handle.rs, codex-rs/otel-trace-websocket/src/lib.rs, codex-rs/linux-sandbox/src/fd_mount.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #12 — If anonymized user #12 becomes unavailable, 5 significant file(s) lose their only recent owner: codex-rs/cli/src/doctor/desktop.rs, codex-rs/cli/src/doctor/desktop/macos_security.rs, codex-rs/feedback/src/upload.rs, codex-rs/cli/src/doctor/disk.rs, codex-rs/feedback/src/report_upload.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #13 — If anonymized user #13 becomes unavailable, 5 significant file(s) lose their only recent owner: codex-rs/exec-server/src/rpc_server_requests.rs, codex-rs/exec-server/src/network_policy_decisions.rs, codex-rs/utils/pty/src/unix_io.rs, codex-rs/core/src/network_policy_decision.rs, codex-rs/exec-server/src/client/network_policy_audit.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #14 — If anonymized user #14 becomes unavailable, 4 significant file(s) lose their only recent owner: sdk/python/src/openai_codex/_message_router.py, sdk/python/src/openai_codex/_goal.py, sdk/python/src/openai_codex/async_client.py, codex-rs/codex-api/src/endpoint/realtime_websocket/protocol_common.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #15 — If anonymized user #15 becomes unavailable, 4 significant file(s) lose their only recent owner: codex-rs/core-plugins/src/remote_mutations.rs, codex-rs/cli/src/mcp_login.rs, codex-rs/rmcp-client/src/oauth_callback_input.rs, codex-rs/core-plugins/src/marketplace_context.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #16 — If anonymized user #16 becomes unavailable, 4 significant file(s) lose their only recent owner: codex-rs/app-server/src/user_verification.rs, codex-rs/app-server-protocol/src/protocol/v2/user_verification.rs, codex-rs/user-verification/src/lib.rs, codex-rs/app-server/src/user_verification_auth.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #17 — If anonymized user #17 becomes unavailable, 4 significant file(s) lose their only recent owner: codex-rs/windows-sandbox-rs/src/app_package.rs, codex-rs/windows-sandbox-rs/src/provisioning_client/refresh_retry.rs, codex-rs/windows-sandbox-rs/src/installation_record.rs, codex-rs/windows-sandbox-rs/src/token_user.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #18 — If anonymized user #18 becomes unavailable, 4 significant file(s) lose their only recent owner: codex-rs/otel/src/auth_storage.rs, codex-rs/keyring-store/src/lib.rs, codex-rs/otel/src/metrics/buffered.rs, codex-rs/tools/src/json_schema/traversal.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #19 — If anonymized user #19 becomes unavailable, 4 significant file(s) lose their only recent owner: codex-rs/code-mode-protocol/src/host/types.rs, codex-rs/code-mode-protocol/src/host/codec.rs, codex-rs/code-mode-runtime/src/cell_actor/callbacks.rs, codex-rs/v8-poc/src/lib.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #20 — If anonymized user #20 becomes unavailable, 4 significant file(s) lose their only recent owner: codex-rs/http-client/src/network_policy.rs, codex-rs/model-provider/src/workspace_routing.rs, codex-rs/login/src/auth/manager/workspace_routing.rs, codex-rs/config/src/application_requirements.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #21 — If anonymized user #21 becomes unavailable, 4 significant file(s) lose their only recent owner: codex-rs/utils/path-uri/src/config_path.rs, codex-rs/config/src/project_trust.rs, codex-rs/protocol/src/permissions/deny_read_validator.rs, codex-rs/config/src/path_context.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #22 — If anonymized user #22 becomes unavailable, 3 significant file(s) lose their only recent owner: codex-rs/cli/src/migrate_rollouts.rs, codex-rs/thread-store/src/local/rollout_migration/telemetry.rs, codex-rs/thread-store/src/local/thread_history/turn_lookup.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #23 — If anonymized user #23 becomes unavailable, 3 significant file(s) lose their only recent owner: codex-rs/login/src/oauth/error.rs, codex-rs/login/src/oauth_session_callback.rs, codex-rs/app-server-protocol/src/protocol/v2/bedrock.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #24 — If anonymized user #24 becomes unavailable, 3 significant file(s) lose their only recent owner: codex-rs/app-server-protocol/src/protocol/v2/thread_attachment.rs, codex-rs/thread-store/src/local/thread_attachments.rs, codex-rs/state/src/model/thread_attachment.rs. Pair on, review, or document these before any departure.
D34 · Knowledge Freshness · Orphaned file · ×9
  • Orphaned file codex-rs/utils/stream-parser/src/tagged_line_parser.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file codex-rs/cloud-tasks/src/scrollable_diff.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file codex-rs/ollama/src/pull.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file codex-rs/utils/sleep-inhibitor/src/windows_inhibitor.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file codex-rs/utils/sleep-inhibitor/src/lib.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file codex-rs/utils/sleep-inhibitor/src/macos.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file codex-rs/execpolicy/src/execpolicycheck.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file codex-rs/ollama/src/parser.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file codex-rs/test-binary-support/lib.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
D29 · Static Analysis (SAST) · REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Low CVE · ×2
  • REDACTED
  • REDACTED
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 28 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (250 single-owned of 2511 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 2511 of the 3339 production source files in this repository met that bar). They are anonymized user #25 (2 file(s)), anonymized user #26 (2 file(s)), anonymized user #27 (2 file(s)), anonymized user #28 (2 file(s)), anonymized user #29 (2 file(s)), anonymized user #30 (2 file(s)) (+22 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: codex-rs/tcp-tunnel/src/lib.rs, codex-rs/tcp-tunnel/src/control.rs, codex-rs/tui/src/bottom_pane/async_questions/input.rs, codex-rs/tui/src/bottom_pane/chat_composer/history_search_draft.rs, scripts/codex_package/dotslash.py, codex-rs/http-client/src/route_aware_redirect.rs, codex-rs/core/src/context/world_state/test_support.rs, codex-rs/core/src/feedback_config.rs (+26 more).
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 10 of 169 project(s) overshoot their size bounds, lowering Project Cohesion to 8.8/10. The most over is `codex-rs/tui` (282673 LoC, 473 module-visible types across 47 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 9 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: codex-rs/utils/stream-parser/src/tagged_line_parser.rs, codex-rs/cloud-tasks/src/scrollable_diff.rs, codex-rs/ollama/src/pull.rs, codex-rs/utils/sleep-inhibitor/src/windows_inhibitor.rs, codex-rs/utils/sleep-inhibitor/src/lib.rs, codex-rs/utils/sleep-inhibitor/src/macos.rs, codex-rs/execpolicy/src/execpolicycheck.rs, codex-rs/ollama/src/parser.rs (and 1 more) (10 orphaned of 2511 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 2511 of the 3339 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 72/87 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `codex-cli`, `codex-rs/apply-patch`, `codex-rs/bwrap`, `codex-rs/config-schema` and 10 more.
R7 · Dead Code · Unused private field 'async' · ×1
  • Unused private field 'async' sdk/typescript/src/thread.ts:70 — Nothing in its class reads or assigns this private field (for a constructor parameter property: it is stored and never read), and no string key or test reaches it by name. Remove it, or use it where it was meant to take effect.
S1 · Web-Security Posture · No security response headers detected · ×1
  • No security response headers detected — None of the 11 security response headers the OWASP Secure Headers Project recommends (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options, …) is set on a response this repository's Rust server sends — defense in depth, even when a proxy could set them. (−2.0 on this card.) The server: `axum::serve(` (codex-rs/tui/src/dynamic_tools_mcp.rs:203).
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×1
  • Silent fallback default on parse failure scripts/mcp_conformance/official_conformance.py:312 — `_load_checks` returns `[]` when `(OSError, json.JSONDecodeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
X9 · Subsumed condition operand · Subsumed condition operand · ×1
  • Subsumed condition operand codex-rs/shell-command/src/shell_snapshot_tests.rs:199 — `stdout.contains("MULTILINE_CERT=")` can never decide this `||` — every value satisfying `stdout.contains("MULTILINE_CERT=")` also satisfies `stdout.contains("MULTILINE_CERT")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Minor — 93 finding(s)
D12 · Dependency Hygiene · Outdated · ×92
  • Outdated: anyhow — `anyhow` is locked at 1.0.103 but 1.0.104 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in codex-rs/agent-identity/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p anyhow` and commit the updated REDACTED.
  • Outdated: arboard — `arboard` is locked at 3.6.1 but 3.7.0 is the current stable release on crates.io, and it already satisfies the `"3"` requirement declared in codex-rs/tui/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p arboard` and commit the updated REDACTED.
  • Outdated: arc-swap — `arc-swap` is locked at 1.9.0 but 1.9.3 is the current stable release on crates.io, and it already satisfies the `"1.9.0"` requirement declared in codex-rs/codex-mcp/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p arc-swap` and commit the updated REDACTED.
  • Outdated: assert_cmd — `assert_cmd` is locked at 2.1.2 but 2.2.2 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in codex-rs/utils/cargo-bin/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p assert_cmd` and commit the updated REDACTED.
  • Outdated: aws-config — `aws-config` is locked at 1.8.12 but 1.13.0 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in codex-rs/aws-auth/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-config` and commit the updated REDACTED.
  • Outdated: aws-credential-types — `aws-credential-types` is locked at 1.2.11 but 1.3.1 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in codex-rs/aws-auth/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-credential-types` and commit the updated REDACTED.
  • Outdated: aws-sigv4 — `aws-sigv4` is locked at 1.3.7 but 1.6.3 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in codex-rs/aws-auth/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-sigv4` and commit the updated REDACTED.
  • Outdated: aws-smithy-runtime-api — `aws-smithy-runtime-api` is locked at 1.12.0 but 1.19.1 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in codex-rs/aws-auth/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-smithy-runtime-api` and commit the updated REDACTED.
  • Outdated: aws-smithy-types — `aws-smithy-types` is locked at 1.4.7 but 1.9.0 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in codex-rs/aws-auth/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-smithy-types` and commit the updated REDACTED.
  • Outdated: aws-types — `aws-types` is locked at 1.3.11 but 1.7.0 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in codex-rs/aws-auth/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p aws-types` and commit the updated REDACTED.
  • Outdated: axum — `axum` is locked at 0.8.8 but 0.8.9 is the current stable release on crates.io, and it already satisfies the `"0.8"` requirement declared in codex-rs/app-server-transport/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p axum` and commit the updated REDACTED.
  • Outdated: bitflags — `bitflags` is locked at 2.13.1 but 2.13.2 is the current stable release on crates.io, and it already satisfies the `"2.13.1"` requirement declared in codex-rs/tools/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bitflags` and commit the updated REDACTED.
  • Outdated: blake3 — `blake3` is locked at 1.8.2 but 1.8.7 is the current stable release on crates.io, and it already satisfies the `"1.8.2"` requirement declared in codex-rs/app-server-daemon/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p blake3` and commit the updated REDACTED.
  • Outdated: cc — `cc` is locked at 1.2.55 but 1.10.0 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in codex-rs/bwrap/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p cc` and commit the updated REDACTED.
  • Outdated: chrono — `chrono` is locked at 0.4.43 but 0.4.45 is the current stable release on crates.io, and it already satisfies the `"0.4.43"` requirement declared in codex-rs/agent-identity/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p chrono` and commit the updated REDACTED.
  • Outdated: clap — `clap` is locked at 4.5.58 but 4.6.7 is the current stable release on crates.io, and it already satisfies the `"4"` requirement declared in codex-rs/app-server-test-client/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clap` and commit the updated REDACTED.
  • Outdated: clap_complete — `clap_complete` is locked at 4.5.65 but 4.6.11 is the current stable release on crates.io, and it already satisfies the `"4"` requirement declared in codex-rs/cli/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clap_complete` and commit the updated REDACTED.
  • Outdated: clatter — `clatter` is locked at 2.2.0 but 2.3.0 is the current stable release on crates.io, and it already satisfies the `"2.2.0"` requirement declared in codex-rs/exec-server/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clatter` and commit the updated REDACTED.
  • Outdated: crossbeam-channel — `crossbeam-channel` is locked at 0.5.15 but 0.5.17 is the current stable release on crates.io, and it already satisfies the `"0.5.15"` requirement declared in codex-rs/file-search/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p crossbeam-channel` and commit the updated REDACTED.
  • Outdated: crossbeam-queue — `crossbeam-queue` is locked at 0.3.12 but 0.3.14 is the current stable release on crates.io, and it already satisfies the `"0.3.12"` requirement declared in codex-rs/voice-host/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p crossbeam-queue` and commit the updated REDACTED.
  • Outdated: curl — `curl` is locked at 0.4.50 but 0.4.51 is the current stable release on crates.io, and it already satisfies the `"0.4.50"` requirement declared in codex-rs/http-client/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p curl` and commit the updated REDACTED.
  • Outdated: encoding_rs — `encoding_rs` is locked at 0.8.35 but 0.8.42 is the current stable release on crates.io, and it already satisfies the `"0.8.35"` requirement declared in codex-rs/protocol/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p encoding_rs` and commit the updated REDACTED.
  • Outdated: flate2 — `flate2` is locked at 1.1.8 but 1.1.10 is the current stable release on crates.io, and it already satisfies the `"1.1.8"` requirement declared in codex-rs/core-plugins/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p flate2` and commit the updated REDACTED.
  • Outdated: gix-url — `gix-url` is locked at 0.40.0 but 0.40.1 is the current stable release on crates.io, and it already satisfies the `"0.40.0"` requirement declared in codex-rs/protocol/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p gix-url` and commit the updated REDACTED.
  • Outdated: glob — `glob` is locked at 0.3.3 but 0.3.4 is the current stable release on crates.io, and it already satisfies the `"0.3"` requirement declared in codex-rs/code-mode-protocol/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p glob` and commit the updated REDACTED.
  • + 67 more in this group — see findings.md.
D5 · Coupling · Off the main sequence · ×1
  • Off the main sequence: codex-core-plugin-common — codex-core-plugin-common: abstractness 0.00, instability 0.20, distance 0.80 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.

Appendix B — Reproduction & audit trail

Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-4dcc957ff62541fabadc8287a4ed3d32/history.json --exit-code 0 --source .5artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-4dcc957ff62541fabadc8287a4ed3d32/tree.json --exit-code 0 --source .1artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/watchdog-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude codex-rs/app-server-protocol/schema --exclude codex-rs/core/templates/collab --exclude codex-rs/hooks/schema .35artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update66artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .2artifacts/raw/trivy-config.json
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update0artifacts/raw/trivy-fs.json

Run 01a17a10-64b4-73b9-85d4-9e4d2d74e734 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.

⬇ Findings, MITRE CWE-tagged .sarif⬇ Health changelog .md