Public report of openai/codex, published 14 November 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 reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert 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, 14 November 2026, 13:42 UTC · Survey ID cd_a47fe7c3140c48179d6039eba84a7c45
openai/codex
Measured 14 November 2026, 13:40 UTC, at code version b1573f1
CAI scoreAt riskUp 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,189,610 lines of product code in 192 projects, tests not counted · Estimated rebuild effort: about 22.1 person-years · Weakest lens: Security and Compliance, 50
Findings by how serious they are
64 critical5226 serious279 minor
16 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look 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
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
14 November 2026, 13:40 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 the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer 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. We work 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 ▸
76of 76 dimensions measured by tools.
5375of 5569 findings point to an exact file and line, so you can open each one in the code. The other 194 concern the repository as a whole, such as missing documentation.
76dimensions across 9 lenses, read from 1,189,610 lines of product code in 192 projects.
openai/codex is rated At risk because critical security findings are open. Its score is held back in part because three of the dependencies have a known vulnerability. It scores 59 out of 100, which the At risk rating leaves unchanged.
Security and Compliance, at 50, 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 comes next, worth about 3 points. Raising Security and Compliance to 70 would lift the score to about 65.
Twenty-one 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. Correcting the flagged pipeline settings would fix the five weaknesses in the build pipeline's configuration, and setting a waiting period for automatic updates would deal with the automatic dependency update that takes a new release at once. 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,189,610 lines, about €3,200,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 forThe 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.
If Security and Compliance rose from 50 to 70, the lowest score rated Strong, the score would rise from 59 to about 65.
Code composition: what the lines of code are
Product code 52%Tests 48%
New since the last survey: 1317 findings
These 1317 critical or serious findings weren't in the previous survey, on 26 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
We compare 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: 452 findings
These 452 critical or serious findings were in the previous survey, on 26 October 2026, and are gone from this one. The first 100 are listed here.
God Classes · FunctionTooLong: codex_cloud_tasks::run_main codex-rs/cloud-tasks/src/lib.rs
God Classes · FunctionTooLong: codex_cli::cli_main codex-rs/cli/src/main.rs
Rebuild cost: about €3,200,000 · Estimate
Cost to rebuild
€1,100,000 to €5,400,000, for 17,800 to 56,468 hours of work, about 22.1 person-years for 13 to 42 engineers
Difficulty of the problem
High, 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 59. 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.
Size
Very large: 1,189,610 lines of product code
What it is not
Not 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: We price 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.
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 €3,200,000 to build again, about 22.1 person-years of work. Its weakest lens is Security and Compliance, at 50 (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.2 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 10% on every change. The history of the code shows how much it changes: about 1,717,072 lines over the last 90 days, which is about 6,963,681 lines a year. At that pace, the extra work comes to an estimated 802.2 to 4813.4 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 our 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.
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.
3518 modules, with 11383 dependencies between them. 58 loops run through 508 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 3478 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.
codex_tui.empty_state_animation.geometry uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_tui.empty_state_animation.geometry, while a change to codex_tui.empty_state_animation.geometry can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_tui.empty_state_animation.geometry uses a module listed above it, which is the healthy direction.
codex_utils_path_uri uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_utils_path_uri, while a change to codex_utils_path_uri can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_utils_path_uri uses a module listed above it, which is the healthy direction.
codex_protocol.models uses codex_protocol.models.item_metadata, so a change to codex_protocol.models.item_metadata can break codex_protocol.models, while a change to codex_protocol.models can't break codex_protocol.models.item_metadata.
Position
Below the diagonal: codex_protocol.models uses a module listed above it, which is the healthy direction.
codex_protocol.models uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_protocol.models, while a change to codex_protocol.models can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_protocol.models uses a module listed above it, which is the healthy direction.
codex_protocol.models uses codex_utils_path_uri, so a change to codex_utils_path_uri can break codex_protocol.models, while a change to codex_protocol.models can't break codex_utils_path_uri.
Position
Below the diagonal: codex_protocol.models uses a module listed above it, which is the healthy direction.
11→13 codex_protocol.models uses codex_protocol.protocolpart of a loop✕
Connections
2 pairs of types, where a type in codex_protocol.models uses a type in codex_protocol.protocol.
codex_protocol.models uses codex_protocol.protocol, so a change to codex_protocol.protocol can break codex_protocol.models, while a change to codex_protocol.models can't break codex_protocol.protocol.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
codex_context_fragments.fragment uses codex_protocol.models.item_metadata, so a change to codex_protocol.models.item_metadata can break codex_context_fragments.fragment, while a change to codex_context_fragments.fragment can't break codex_protocol.models.item_metadata.
Position
Below the diagonal: codex_context_fragments.fragment uses a module listed above it, which is the healthy direction.
codex_context_fragments.fragment uses codex_protocol.models, so a change to codex_protocol.models can break codex_context_fragments.fragment, while a change to codex_context_fragments.fragment can't break codex_protocol.models.
Position
Below the diagonal: codex_context_fragments.fragment uses a module listed above it, which is the healthy direction.
27 pairs of types, where a type in codex_protocol.protocol uses a type in codex_protocol.thread_id. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
codex_protocol.protocol uses codex_protocol.thread_id, so a change to codex_protocol.thread_id can break codex_protocol.protocol, while a change to codex_protocol.protocol can't break codex_protocol.thread_id.
Position
Below the diagonal: codex_protocol.protocol uses a module listed above it, which is the healthy direction.
codex_protocol.protocol uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_protocol.protocol, while a change to codex_protocol.protocol can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_protocol.protocol uses a module listed above it, which is the healthy direction.
codex_protocol.protocol uses codex_utils_path_uri, so a change to codex_utils_path_uri can break codex_protocol.protocol, while a change to codex_protocol.protocol can't break codex_utils_path_uri.
Position
Below the diagonal: codex_protocol.protocol uses a module listed above it, which is the healthy direction.
codex_protocol.protocol uses codex_protocol.models, so a change to codex_protocol.models can break codex_protocol.protocol, while a change to codex_protocol.protocol can't break codex_protocol.models.
Position
Below the diagonal: codex_protocol.protocol uses a module listed above it, which is the healthy direction.
13→16 codex_protocol.protocol uses codex_protocol.openai_modelspart of a loop✕
Connections
1 pair of types, where a type in codex_protocol.protocol uses a type in codex_protocol.openai_models.
codex_protocol.protocol uses codex_protocol.openai_models, so a change to codex_protocol.openai_models can break codex_protocol.protocol, while a change to codex_protocol.protocol can't break codex_protocol.openai_models.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
13→18 codex_protocol.protocol uses codex_protocol.config_typespart of a loop✕
Connections
12 pairs of types, where a type in codex_protocol.protocol uses a type in codex_protocol.config_types.
codex_protocol.protocol uses codex_protocol.config_types, so a change to codex_protocol.config_types can break codex_protocol.protocol, while a change to codex_protocol.protocol can't break codex_protocol.config_types.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
codex_app_server_protocol.rpc uses codex_shell_command.shell_snapshot_render, so a change to codex_shell_command.shell_snapshot_render can break codex_app_server_protocol.rpc, while a change to codex_app_server_protocol.rpc can't break codex_shell_command.shell_snapshot_render.
Position
Below the diagonal: codex_app_server_protocol.rpc uses a module listed above it, which is the healthy direction.
codex_app_server_protocol.rpc uses codex_protocol.protocol, so a change to codex_protocol.protocol can break codex_app_server_protocol.rpc, while a change to codex_app_server_protocol.rpc can't break codex_protocol.protocol.
Position
Below the diagonal: codex_app_server_protocol.rpc uses a module listed above it, which is the healthy direction.
codex_history uses codex_protocol.thread_id, so a change to codex_protocol.thread_id can break codex_history, while a change to codex_history can't break codex_protocol.thread_id.
Position
Below the diagonal: codex_history uses a module listed above it, which is the healthy direction.
codex_history uses codex_protocol.models, so a change to codex_protocol.models can break codex_history, while a change to codex_history can't break codex_protocol.models.
Position
Below the diagonal: codex_history uses a module listed above it, which is the healthy direction.
codex_history uses codex_protocol.protocol, so a change to codex_protocol.protocol can break codex_history, while a change to codex_history can't break codex_protocol.protocol.
Position
Below the diagonal: codex_history uses a module listed above it, which is the healthy direction.
codex_protocol.openai_models uses codex_protocol.protocol, so a change to codex_protocol.protocol can break codex_protocol.openai_models, while a change to codex_protocol.openai_models can't break codex_protocol.protocol.
Position
Below the diagonal: codex_protocol.openai_models uses a module listed above it, which is the healthy direction.
16→18 codex_protocol.openai_models uses codex_protocol.config_typespart of a loop✕
Connections
2 pairs of types, where a type in codex_protocol.openai_models uses a type in codex_protocol.config_types.
codex_protocol.openai_models uses codex_protocol.config_types, so a change to codex_protocol.config_types can break codex_protocol.openai_models, while a change to codex_protocol.openai_models can't break codex_protocol.config_types.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
codex_app_server_protocol.protocol.v2.thread_data uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_app_server_protocol.protocol.v2.thread_data, while a change to codex_app_server_protocol.protocol.v2.thread_data can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_app_server_protocol.protocol.v2.thread_data uses a module listed above it, which is the healthy direction.
codex_app_server_protocol.protocol.v2.thread_data uses codex_protocol.openai_models, so a change to codex_protocol.openai_models can break codex_app_server_protocol.protocol.v2.thread_data, while a change to codex_app_server_protocol.protocol.v2.thread_data can't break codex_protocol.openai_models.
Position
Below the diagonal: codex_app_server_protocol.protocol.v2.thread_data uses a module listed above it, which is the healthy direction.
codex_protocol.config_types uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_protocol.config_types, while a change to codex_protocol.config_types can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_protocol.config_types uses a module listed above it, which is the healthy direction.
codex_protocol.config_types uses codex_protocol.openai_models, so a change to codex_protocol.openai_models can break codex_protocol.config_types, while a change to codex_protocol.config_types can't break codex_protocol.openai_models.
Position
Below the diagonal: codex_protocol.config_types uses a module listed above it, which is the healthy direction.
codex_app_server_protocol.protocol.v2.config uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_app_server_protocol.protocol.v2.config, while a change to codex_app_server_protocol.protocol.v2.config can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_app_server_protocol.protocol.v2.config uses a module listed above it, which is the healthy direction.
codex_app_server_protocol.protocol.v2.config uses codex_utils_path_uri, so a change to codex_utils_path_uri can break codex_app_server_protocol.protocol.v2.config, while a change to codex_app_server_protocol.protocol.v2.config can't break codex_utils_path_uri.
Position
Below the diagonal: codex_app_server_protocol.protocol.v2.config uses a module listed above it, which is the healthy direction.
codex_app_server_protocol.protocol.v2.config uses codex_protocol.openai_models, so a change to codex_protocol.openai_models can break codex_app_server_protocol.protocol.v2.config, while a change to codex_app_server_protocol.protocol.v2.config can't break codex_protocol.openai_models.
Position
Below the diagonal: codex_app_server_protocol.protocol.v2.config uses a module listed above it, which is the healthy direction.
codex_app_server_protocol.protocol.v2.config uses codex_protocol.config_types, so a change to codex_protocol.config_types can break codex_app_server_protocol.protocol.v2.config, while a change to codex_app_server_protocol.protocol.v2.config can't break codex_protocol.config_types.
Position
Below the diagonal: codex_app_server_protocol.protocol.v2.config uses a module listed above it, which is the healthy direction.
codex_config.state uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_config.state, while a change to codex_config.state can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_config.state uses a module listed above it, which is the healthy direction.
codex_config.state uses codex_protocol.config_types, so a change to codex_protocol.config_types can break codex_config.state, while a change to codex_config.state can't break codex_protocol.config_types.
Position
Below the diagonal: codex_config.state uses a module listed above it, which is the healthy direction.
codex_config.types uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_config.types, while a change to codex_config.types can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_config.types uses a module listed above it, which is the healthy direction.
codex_config.types uses codex_protocol.config_types, so a change to codex_protocol.config_types can break codex_config.types, while a change to codex_config.types can't break codex_protocol.config_types.
Position
Below the diagonal: codex_config.types uses a module listed above it, which is the healthy direction.
codex_exec_server_protocol.protocol uses codex_protocol.thread_id, so a change to codex_protocol.thread_id can break codex_exec_server_protocol.protocol, while a change to codex_exec_server_protocol.protocol can't break codex_protocol.thread_id.
Position
Below the diagonal: codex_exec_server_protocol.protocol uses a module listed above it, which is the healthy direction.
29 pairs of types, where a type in codex_exec_server_protocol.protocol uses a type in codex_utils_path_uri. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
codex_exec_server_protocol.protocol uses codex_utils_path_uri, so a change to codex_utils_path_uri can break codex_exec_server_protocol.protocol, while a change to codex_exec_server_protocol.protocol can't break codex_utils_path_uri.
Position
Below the diagonal: codex_exec_server_protocol.protocol uses a module listed above it, which is the healthy direction.
codex_exec_server_protocol.protocol uses codex_protocol.config_types, so a change to codex_protocol.config_types can break codex_exec_server_protocol.protocol, while a change to codex_exec_server_protocol.protocol can't break codex_protocol.config_types.
Position
Below the diagonal: codex_exec_server_protocol.protocol uses a module listed above it, which is the healthy direction.
codex_tools.tool_spec uses codex_protocol.config_types, so a change to codex_protocol.config_types can break codex_tools.tool_spec, while a change to codex_tools.tool_spec can't break codex_protocol.config_types.
Position
Below the diagonal: codex_tools.tool_spec uses a module listed above it, which is the healthy direction.
codex_login.auth.manager uses codex_api.sse.responses_error, so a change to codex_api.sse.responses_error can break codex_login.auth.manager, while a change to codex_login.auth.manager can't break codex_api.sse.responses_error.
Position
Below the diagonal: codex_login.auth.manager uses a module listed above it, which is the healthy direction.
codex_login.auth.manager uses codex_http_client.outbound_proxy, so a change to codex_http_client.outbound_proxy can break codex_login.auth.manager, while a change to codex_login.auth.manager can't break codex_http_client.outbound_proxy.
Position
Below the diagonal: codex_login.auth.manager uses a module listed above it, which is the healthy direction.
codex_login.auth.manager uses codex_protocol.protocol, so a change to codex_protocol.protocol can break codex_login.auth.manager, while a change to codex_login.auth.manager can't break codex_protocol.protocol.
Position
Below the diagonal: codex_login.auth.manager uses a module listed above it, which is the healthy direction.
codex_login.auth.manager uses codex_protocol.config_types, so a change to codex_protocol.config_types can break codex_login.auth.manager, while a change to codex_login.auth.manager can't break codex_protocol.config_types.
Position
Below the diagonal: codex_login.auth.manager uses a module listed above it, which is the healthy direction.
codex_login.auth.manager uses codex_config.types, so a change to codex_config.types can break codex_login.auth.manager, while a change to codex_login.auth.manager can't break codex_config.types.
Position
Below the diagonal: codex_login.auth.manager uses a module listed above it, which is the healthy direction.
codex_core.config uses codex_http_client.outbound_proxy, so a change to codex_http_client.outbound_proxy can break codex_core.config, while a change to codex_core.config can't break codex_http_client.outbound_proxy.
Position
Below the diagonal: codex_core.config uses a module listed above it, which is the healthy direction.
codex_core.config uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_core.config, while a change to codex_core.config can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_core.config uses a module listed above it, which is the healthy direction.
codex_core.config uses codex_utils_path_uri, so a change to codex_utils_path_uri can break codex_core.config, while a change to codex_core.config can't break codex_utils_path_uri.
Position
Below the diagonal: codex_core.config uses a module listed above it, which is the healthy direction.
codex_core.config uses codex_protocol.models, so a change to codex_protocol.models can break codex_core.config, while a change to codex_core.config can't break codex_protocol.models.
Position
Below the diagonal: codex_core.config uses a module listed above it, which is the healthy direction.
codex_core.config uses codex_protocol.protocol, so a change to codex_protocol.protocol can break codex_core.config, while a change to codex_core.config can't break codex_protocol.protocol.
Position
Below the diagonal: codex_core.config uses a module listed above it, which is the healthy direction.
codex_core.config uses codex_protocol.openai_models, so a change to codex_protocol.openai_models can break codex_core.config, while a change to codex_core.config can't break codex_protocol.openai_models.
Position
Below the diagonal: codex_core.config uses a module listed above it, which is the healthy direction.
codex_core.config uses codex_protocol.config_types, so a change to codex_protocol.config_types can break codex_core.config, while a change to codex_core.config can't break codex_protocol.config_types.
Position
Below the diagonal: codex_core.config uses a module listed above it, which is the healthy direction.
codex_core.config uses codex_config.state, so a change to codex_config.state can break codex_core.config, while a change to codex_core.config can't break codex_config.state.
Position
Below the diagonal: codex_core.config uses a module listed above it, which is the healthy direction.
codex_core.config uses codex_config.types, so a change to codex_config.types can break codex_core.config, while a change to codex_core.config can't break codex_config.types.
Position
Below the diagonal: codex_core.config uses a module listed above it, which is the healthy direction.
codex_core.config uses codex_login.auth.manager, so a change to codex_login.auth.manager can break codex_core.config, while a change to codex_core.config can't break codex_login.auth.manager.
Position
Below the diagonal: codex_core.config uses a module listed above it, which is the healthy direction.
codex_app_server_client uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_app_server_client, while a change to codex_app_server_client can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_app_server_client uses a module listed above it, which is the healthy direction.
codex_app_server_client uses codex_protocol.protocol, so a change to codex_protocol.protocol can break codex_app_server_client, while a change to codex_app_server_client can't break codex_protocol.protocol.
Position
Below the diagonal: codex_app_server_client uses a module listed above it, which is the healthy direction.
codex_app_server_client uses codex_app_server_protocol.rpc, so a change to codex_app_server_protocol.rpc can break codex_app_server_client, while a change to codex_app_server_client can't break codex_app_server_protocol.rpc.
Position
Below the diagonal: codex_app_server_client uses a module listed above it, which is the healthy direction.
codex_app_server_client uses codex_app_server_protocol.protocol.v2.config, so a change to codex_app_server_protocol.protocol.v2.config can break codex_app_server_client, while a change to codex_app_server_client can't break codex_app_server_protocol.protocol.v2.config.
Position
Below the diagonal: codex_app_server_client uses a module listed above it, which is the healthy direction.
codex_app_server_client uses codex_config.state, so a change to codex_config.state can break codex_app_server_client, while a change to codex_app_server_client can't break codex_config.state.
Position
Below the diagonal: codex_app_server_client uses a module listed above it, which is the healthy direction.
codex_app_server_client uses codex_core.config, so a change to codex_core.config can break codex_app_server_client, while a change to codex_app_server_client can't break codex_core.config.
Position
Below the diagonal: codex_app_server_client uses a module listed above it, which is the healthy direction.
codex_core.session.turn_context uses codex_protocol.thread_id, so a change to codex_protocol.thread_id can break codex_core.session.turn_context, while a change to codex_core.session.turn_context can't break codex_protocol.thread_id.
Position
Below the diagonal: codex_core.session.turn_context uses a module listed above it, which is the healthy direction.
codex_core.session.turn_context uses codex_shell_command.shell_snapshot_render, so a change to codex_shell_command.shell_snapshot_render can break codex_core.session.turn_context, while a change to codex_core.session.turn_context can't break codex_shell_command.shell_snapshot_render.
Position
Below the diagonal: codex_core.session.turn_context uses a module listed above it, which is the healthy direction.
codex_core.session.turn_context uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_core.session.turn_context, while a change to codex_core.session.turn_context can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_core.session.turn_context uses a module listed above it, which is the healthy direction.
codex_core.session.turn_context uses codex_utils_path_uri, so a change to codex_utils_path_uri can break codex_core.session.turn_context, while a change to codex_core.session.turn_context can't break codex_utils_path_uri.
Position
Below the diagonal: codex_core.session.turn_context uses a module listed above it, which is the healthy direction.
codex_core.session.turn_context uses codex_protocol.models, so a change to codex_protocol.models can break codex_core.session.turn_context, while a change to codex_core.session.turn_context can't break codex_protocol.models.
Position
Below the diagonal: codex_core.session.turn_context uses a module listed above it, which is the healthy direction.
codex_core.session.turn_context uses codex_protocol.protocol, so a change to codex_protocol.protocol can break codex_core.session.turn_context, while a change to codex_core.session.turn_context can't break codex_protocol.protocol.
Position
Below the diagonal: codex_core.session.turn_context uses a module listed above it, which is the healthy direction.
codex_core.session.turn_context uses codex_protocol.openai_models, so a change to codex_protocol.openai_models can break codex_core.session.turn_context, while a change to codex_core.session.turn_context can't break codex_protocol.openai_models.
Position
Below the diagonal: codex_core.session.turn_context uses a module listed above it, which is the healthy direction.
codex_core.session.turn_context uses codex_app_server_protocol.protocol.v2.thread_data, so a change to codex_app_server_protocol.protocol.v2.thread_data can break codex_core.session.turn_context, while a change to codex_core.session.turn_context can't break codex_app_server_protocol.protocol.v2.thread_data.
Position
Below the diagonal: codex_core.session.turn_context uses a module listed above it, which is the healthy direction.
codex_core.session.turn_context uses codex_protocol.config_types, so a change to codex_protocol.config_types can break codex_core.session.turn_context, while a change to codex_core.session.turn_context can't break codex_protocol.config_types.
Position
Below the diagonal: codex_core.session.turn_context uses a module listed above it, which is the healthy direction.
codex_core.session.turn_context uses codex_login.auth.manager, so a change to codex_login.auth.manager can break codex_core.session.turn_context, while a change to codex_core.session.turn_context can't break codex_login.auth.manager.
Position
Below the diagonal: codex_core.session.turn_context uses a module listed above it, which is the healthy direction.
codex_core.session.turn_context uses codex_core.config, so a change to codex_core.config can break codex_core.session.turn_context, while a change to codex_core.session.turn_context can't break codex_core.config.
Position
Below the diagonal: codex_core.session.turn_context uses a module listed above it, which is the healthy direction.
codex_core.thread_manager uses codex_file_watcher, so a change to codex_file_watcher can break codex_core.thread_manager, while a change to codex_core.thread_manager can't break codex_file_watcher.
Position
Below the diagonal: codex_core.thread_manager uses a module listed above it, which is the healthy direction.
codex_core.thread_manager uses codex_http_client.outbound_proxy, so a change to codex_http_client.outbound_proxy can break codex_core.thread_manager, while a change to codex_core.thread_manager can't break codex_http_client.outbound_proxy.
Position
Below the diagonal: codex_core.thread_manager uses a module listed above it, which is the healthy direction.
codex_core.thread_manager uses codex_protocol.thread_id, so a change to codex_protocol.thread_id can break codex_core.thread_manager, while a change to codex_core.thread_manager can't break codex_protocol.thread_id.
Position
Below the diagonal: codex_core.thread_manager uses a module listed above it, which is the healthy direction.
codex_core.thread_manager uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_core.thread_manager, while a change to codex_core.thread_manager can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_core.thread_manager uses a module listed above it, which is the healthy direction.
codex_core.thread_manager uses codex_protocol.protocol, so a change to codex_protocol.protocol can break codex_core.thread_manager, while a change to codex_core.thread_manager can't break codex_protocol.protocol.
Position
Below the diagonal: codex_core.thread_manager uses a module listed above it, which is the healthy direction.
codex_core.thread_manager uses codex_history, so a change to codex_history can break codex_core.thread_manager, while a change to codex_core.thread_manager can't break codex_history.
Position
Below the diagonal: codex_core.thread_manager uses a module listed above it, which is the healthy direction.
codex_core.thread_manager uses codex_protocol.openai_models, so a change to codex_protocol.openai_models can break codex_core.thread_manager, while a change to codex_core.thread_manager can't break codex_protocol.openai_models.
Position
Below the diagonal: codex_core.thread_manager uses a module listed above it, which is the healthy direction.
codex_core.thread_manager uses codex_app_server_protocol.protocol.v2.thread_data, so a change to codex_app_server_protocol.protocol.v2.thread_data can break codex_core.thread_manager, while a change to codex_core.thread_manager can't break codex_app_server_protocol.protocol.v2.thread_data.
Position
Below the diagonal: codex_core.thread_manager uses a module listed above it, which is the healthy direction.
codex_core.thread_manager uses codex_protocol.config_types, so a change to codex_protocol.config_types can break codex_core.thread_manager, while a change to codex_core.thread_manager can't break codex_protocol.config_types.
Position
Below the diagonal: codex_core.thread_manager uses a module listed above it, which is the healthy direction.
codex_core.thread_manager uses codex_login.auth.manager, so a change to codex_login.auth.manager can break codex_core.thread_manager, while a change to codex_core.thread_manager can't break codex_login.auth.manager.
Position
Below the diagonal: codex_core.thread_manager uses a module listed above it, which is the healthy direction.
codex_core.thread_manager uses codex_core.config, so a change to codex_core.config can break codex_core.thread_manager, while a change to codex_core.thread_manager can't break codex_core.config.
Position
Below the diagonal: codex_core.thread_manager uses a module listed above it, which is the healthy direction.
28→29 codex_core.thread_manager uses codex_core.session.sessionpart of a loop✕
Connections
1 pair of types, where a type in codex_core.thread_manager uses a type in codex_core.session.session.
codex_core.thread_manager uses codex_core.session.session, so a change to codex_core.session.session can break codex_core.thread_manager, while a change to codex_core.thread_manager can't break codex_core.session.session.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
28→31 codex_core.thread_manager uses codex_core.codex_threadpart of a loop✕
Connections
3 pairs of types, where a type in codex_core.thread_manager uses a type in codex_core.codex_thread.
codex_core.thread_manager uses codex_core.codex_thread, so a change to codex_core.codex_thread can break codex_core.thread_manager, while a change to codex_core.thread_manager can't break codex_core.codex_thread.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
codex_core.session.session uses codex_file_watcher, so a change to codex_file_watcher can break codex_core.session.session, while a change to codex_core.session.session can't break codex_file_watcher.
Position
Below the diagonal: codex_core.session.session uses a module listed above it, which is the healthy direction.
codex_core.session.session uses codex_protocol.thread_id, so a change to codex_protocol.thread_id can break codex_core.session.session, while a change to codex_core.session.session can't break codex_protocol.thread_id.
Position
Below the diagonal: codex_core.session.session uses a module listed above it, which is the healthy direction.
codex_core.session.session uses codex_shell_command.shell_snapshot_render, so a change to codex_shell_command.shell_snapshot_render can break codex_core.session.session, while a change to codex_core.session.session can't break codex_shell_command.shell_snapshot_render.
Position
Below the diagonal: codex_core.session.session uses a module listed above it, which is the healthy direction.
codex_core.session.session uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_core.session.session, while a change to codex_core.session.session can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_core.session.session uses a module listed above it, which is the healthy direction.
codex_core.session.session uses codex_utils_path_uri, so a change to codex_utils_path_uri can break codex_core.session.session, while a change to codex_core.session.session can't break codex_utils_path_uri.
Position
Below the diagonal: codex_core.session.session uses a module listed above it, which is the healthy direction.
codex_core.session.session uses codex_protocol.models, so a change to codex_protocol.models can break codex_core.session.session, while a change to codex_core.session.session can't break codex_protocol.models.
Position
Below the diagonal: codex_core.session.session uses a module listed above it, which is the healthy direction.
codex_core.session.session uses codex_protocol.protocol, so a change to codex_protocol.protocol can break codex_core.session.session, while a change to codex_core.session.session can't break codex_protocol.protocol.
Position
Below the diagonal: codex_core.session.session uses a module listed above it, which is the healthy direction.
codex_core.session.session uses codex_app_server_protocol.rpc, so a change to codex_app_server_protocol.rpc can break codex_core.session.session, while a change to codex_core.session.session can't break codex_app_server_protocol.rpc.
Position
Below the diagonal: codex_core.session.session uses a module listed above it, which is the healthy direction.
codex_core.session.session uses codex_history, so a change to codex_history can break codex_core.session.session, while a change to codex_core.session.session can't break codex_history.
Position
Below the diagonal: codex_core.session.session uses a module listed above it, which is the healthy direction.
codex_core.session.session uses codex_protocol.openai_models, so a change to codex_protocol.openai_models can break codex_core.session.session, while a change to codex_core.session.session can't break codex_protocol.openai_models.
Position
Below the diagonal: codex_core.session.session uses a module listed above it, which is the healthy direction.
codex_core.session.session uses codex_app_server_protocol.protocol.v2.thread_data, so a change to codex_app_server_protocol.protocol.v2.thread_data can break codex_core.session.session, while a change to codex_core.session.session can't break codex_app_server_protocol.protocol.v2.thread_data.
Position
Below the diagonal: codex_core.session.session uses a module listed above it, which is the healthy direction.
codex_core.session.session uses codex_protocol.config_types, so a change to codex_protocol.config_types can break codex_core.session.session, while a change to codex_core.session.session can't break codex_protocol.config_types.
Position
Below the diagonal: codex_core.session.session uses a module listed above it, which is the healthy direction.
codex_core.session.session uses codex_login.auth.manager, so a change to codex_login.auth.manager can break codex_core.session.session, while a change to codex_core.session.session can't break codex_login.auth.manager.
Position
Below the diagonal: codex_core.session.session uses a module listed above it, which is the healthy direction.
codex_core.session.session uses codex_core.config, so a change to codex_core.config can break codex_core.session.session, while a change to codex_core.session.session can't break codex_core.config.
Position
Below the diagonal: codex_core.session.session uses a module listed above it, which is the healthy direction.
codex_core.session.session uses codex_core.session.turn_context, so a change to codex_core.session.turn_context can break codex_core.session.session, while a change to codex_core.session.session can't break codex_core.session.turn_context.
Position
Below the diagonal: codex_core.session.session uses a module listed above it, which is the healthy direction.
codex_core.session.session uses codex_core.thread_manager, so a change to codex_core.thread_manager can break codex_core.session.session, while a change to codex_core.session.session can't break codex_core.thread_manager.
Position
Below the diagonal: codex_core.session.session uses a module listed above it, which is the healthy direction.
29→31 codex_core.session.session uses codex_core.codex_threadpart of a loop✕
Connections
6 pairs of types, where a type in codex_core.session.session uses a type in codex_core.codex_thread.
codex_core.session.session uses codex_core.codex_thread, so a change to codex_core.codex_thread can break codex_core.session.session, while a change to codex_core.session.session can't break codex_core.codex_thread.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
codex_tui.app_server_session uses codex_protocol.thread_id, so a change to codex_protocol.thread_id can break codex_tui.app_server_session, while a change to codex_tui.app_server_session can't break codex_protocol.thread_id.
Position
Below the diagonal: codex_tui.app_server_session uses a module listed above it, which is the healthy direction.
codex_tui.app_server_session uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_tui.app_server_session, while a change to codex_tui.app_server_session can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_tui.app_server_session uses a module listed above it, which is the healthy direction.
codex_tui.app_server_session uses codex_tui.empty_state_animation.geometry, so a change to codex_tui.empty_state_animation.geometry can break codex_tui.app_server_session, while a change to codex_tui.app_server_session can't break codex_tui.empty_state_animation.geometry.
Position
Below the diagonal: codex_tui.app_server_session uses a module listed above it, which is the healthy direction.
codex_tui.app_server_session uses codex_utils_path_uri, so a change to codex_utils_path_uri can break codex_tui.app_server_session, while a change to codex_tui.app_server_session can't break codex_utils_path_uri.
Position
Below the diagonal: codex_tui.app_server_session uses a module listed above it, which is the healthy direction.
codex_tui.app_server_session uses codex_protocol.models, so a change to codex_protocol.models can break codex_tui.app_server_session, while a change to codex_tui.app_server_session can't break codex_protocol.models.
Position
Below the diagonal: codex_tui.app_server_session uses a module listed above it, which is the healthy direction.
codex_tui.app_server_session uses codex_protocol.protocol, so a change to codex_protocol.protocol can break codex_tui.app_server_session, while a change to codex_tui.app_server_session can't break codex_protocol.protocol.
Position
Below the diagonal: codex_tui.app_server_session uses a module listed above it, which is the healthy direction.
codex_tui.app_server_session uses codex_app_server_protocol.rpc, so a change to codex_app_server_protocol.rpc can break codex_tui.app_server_session, while a change to codex_tui.app_server_session can't break codex_app_server_protocol.rpc.
Position
Below the diagonal: codex_tui.app_server_session uses a module listed above it, which is the healthy direction.
codex_tui.app_server_session uses codex_protocol.openai_models, so a change to codex_protocol.openai_models can break codex_tui.app_server_session, while a change to codex_tui.app_server_session can't break codex_protocol.openai_models.
Position
Below the diagonal: codex_tui.app_server_session uses a module listed above it, which is the healthy direction.
codex_tui.app_server_session uses codex_app_server_protocol.protocol.v2.thread_data, so a change to codex_app_server_protocol.protocol.v2.thread_data can break codex_tui.app_server_session, while a change to codex_tui.app_server_session can't break codex_app_server_protocol.protocol.v2.thread_data.
Position
Below the diagonal: codex_tui.app_server_session uses a module listed above it, which is the healthy direction.
codex_tui.app_server_session uses codex_protocol.config_types, so a change to codex_protocol.config_types can break codex_tui.app_server_session, while a change to codex_tui.app_server_session can't break codex_protocol.config_types.
Position
Below the diagonal: codex_tui.app_server_session uses a module listed above it, which is the healthy direction.
codex_tui.app_server_session uses codex_app_server_protocol.protocol.v2.config, so a change to codex_app_server_protocol.protocol.v2.config can break codex_tui.app_server_session, while a change to codex_tui.app_server_session can't break codex_app_server_protocol.protocol.v2.config.
Position
Below the diagonal: codex_tui.app_server_session uses a module listed above it, which is the healthy direction.
codex_tui.app_server_session uses codex_core.config, so a change to codex_core.config can break codex_tui.app_server_session, while a change to codex_tui.app_server_session can't break codex_core.config.
Position
Below the diagonal: codex_tui.app_server_session uses a module listed above it, which is the healthy direction.
codex_tui.app_server_session uses codex_app_server_client, so a change to codex_app_server_client can break codex_tui.app_server_session, while a change to codex_tui.app_server_session can't break codex_app_server_client.
Position
Below the diagonal: codex_tui.app_server_session uses a module listed above it, which is the healthy direction.
codex_core.codex_thread uses codex_file_watcher, so a change to codex_file_watcher can break codex_core.codex_thread, while a change to codex_core.codex_thread can't break codex_file_watcher.
Position
Below the diagonal: codex_core.codex_thread uses a module listed above it, which is the healthy direction.
codex_core.codex_thread uses codex_protocol.thread_id, so a change to codex_protocol.thread_id can break codex_core.codex_thread, while a change to codex_core.codex_thread can't break codex_protocol.thread_id.
Position
Below the diagonal: codex_core.codex_thread uses a module listed above it, which is the healthy direction.
codex_core.codex_thread uses codex_shell_command.shell_snapshot_render, so a change to codex_shell_command.shell_snapshot_render can break codex_core.codex_thread, while a change to codex_core.codex_thread can't break codex_shell_command.shell_snapshot_render.
Position
Below the diagonal: codex_core.codex_thread uses a module listed above it, which is the healthy direction.
codex_core.codex_thread uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_core.codex_thread, while a change to codex_core.codex_thread can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_core.codex_thread uses a module listed above it, which is the healthy direction.
codex_core.codex_thread uses codex_utils_path_uri, so a change to codex_utils_path_uri can break codex_core.codex_thread, while a change to codex_core.codex_thread can't break codex_utils_path_uri.
Position
Below the diagonal: codex_core.codex_thread uses a module listed above it, which is the healthy direction.
codex_core.codex_thread uses codex_protocol.models, so a change to codex_protocol.models can break codex_core.codex_thread, while a change to codex_core.codex_thread can't break codex_protocol.models.
Position
Below the diagonal: codex_core.codex_thread uses a module listed above it, which is the healthy direction.
codex_core.codex_thread uses codex_protocol.protocol, so a change to codex_protocol.protocol can break codex_core.codex_thread, while a change to codex_core.codex_thread can't break codex_protocol.protocol.
Position
Below the diagonal: codex_core.codex_thread uses a module listed above it, which is the healthy direction.
codex_core.codex_thread uses codex_protocol.openai_models, so a change to codex_protocol.openai_models can break codex_core.codex_thread, while a change to codex_core.codex_thread can't break codex_protocol.openai_models.
Position
Below the diagonal: codex_core.codex_thread uses a module listed above it, which is the healthy direction.
codex_core.codex_thread uses codex_protocol.config_types, so a change to codex_protocol.config_types can break codex_core.codex_thread, while a change to codex_core.codex_thread can't break codex_protocol.config_types.
Position
Below the diagonal: codex_core.codex_thread uses a module listed above it, which is the healthy direction.
codex_core.codex_thread uses codex_core.config, so a change to codex_core.config can break codex_core.codex_thread, while a change to codex_core.codex_thread can't break codex_core.config.
Position
Below the diagonal: codex_core.codex_thread uses a module listed above it, which is the healthy direction.
codex_core.codex_thread uses codex_core.session.session, so a change to codex_core.session.session can break codex_core.codex_thread, while a change to codex_core.codex_thread can't break codex_core.session.session.
Position
Below the diagonal: codex_core.codex_thread uses a module listed above it, which is the healthy direction.
codex_core.tools.context uses codex_protocol.tool_name, so a change to codex_protocol.tool_name can break codex_core.tools.context, while a change to codex_core.tools.context can't break codex_protocol.tool_name.
Position
Below the diagonal: codex_core.tools.context uses a module listed above it, which is the healthy direction.
codex_core.tools.context uses codex_utils_path_uri, so a change to codex_utils_path_uri can break codex_core.tools.context, while a change to codex_core.tools.context can't break codex_utils_path_uri.
Position
Below the diagonal: codex_core.tools.context uses a module listed above it, which is the healthy direction.
codex_core.tools.context uses codex_protocol.models, so a change to codex_protocol.models can break codex_core.tools.context, while a change to codex_core.tools.context can't break codex_protocol.models.
Position
Below the diagonal: codex_core.tools.context uses a module listed above it, which is the healthy direction.
codex_core.tools.context uses codex_protocol.protocol, so a change to codex_protocol.protocol can break codex_core.tools.context, while a change to codex_core.tools.context can't break codex_protocol.protocol.
Position
Below the diagonal: codex_core.tools.context uses a module listed above it, which is the healthy direction.
codex_core.tools.context uses codex_core.session.turn_context, so a change to codex_core.session.turn_context can break codex_core.tools.context, while a change to codex_core.tools.context can't break codex_core.session.turn_context.
Position
Below the diagonal: codex_core.tools.context uses a module listed above it, which is the healthy direction.
codex_core.tools.context uses codex_core.session.session, so a change to codex_core.session.session can break codex_core.tools.context, while a change to codex_core.tools.context can't break codex_core.session.session.
Position
Below the diagonal: codex_core.tools.context uses a module listed above it, which is the healthy direction.
codex_core.unified_exec.async_watcher uses codex_utils_path_uri, so a change to codex_utils_path_uri can break codex_core.unified_exec.async_watcher, while a change to codex_core.unified_exec.async_watcher can't break codex_utils_path_uri.
Position
Below the diagonal: codex_core.unified_exec.async_watcher uses a module listed above it, which is the healthy direction.
codex_core.unified_exec.async_watcher uses codex_protocol.openai_models, so a change to codex_protocol.openai_models can break codex_core.unified_exec.async_watcher, while a change to codex_core.unified_exec.async_watcher can't break codex_protocol.openai_models.
Position
Below the diagonal: codex_core.unified_exec.async_watcher uses a module listed above it, which is the healthy direction.
codex_core.unified_exec.async_watcher uses codex_core.session.turn_context, so a change to codex_core.session.turn_context can break codex_core.unified_exec.async_watcher, while a change to codex_core.unified_exec.async_watcher can't break codex_core.session.turn_context.
Position
Below the diagonal: codex_core.unified_exec.async_watcher uses a module listed above it, which is the healthy direction.
codex_core.unified_exec.async_watcher uses codex_core.session.session, so a change to codex_core.session.session can break codex_core.unified_exec.async_watcher, while a change to codex_core.unified_exec.async_watcher can't break codex_core.session.session.
Position
Below the diagonal: codex_core.unified_exec.async_watcher uses a module listed above it, which is the healthy direction.
codex_core.tools.registry uses codex_protocol.tool_name, so a change to codex_protocol.tool_name can break codex_core.tools.registry, while a change to codex_core.tools.registry can't break codex_protocol.tool_name.
Position
Below the diagonal: codex_core.tools.registry uses a module listed above it, which is the healthy direction.
codex_core.tools.registry uses codex_shell_command.shell_snapshot_render, so a change to codex_shell_command.shell_snapshot_render can break codex_core.tools.registry, while a change to codex_core.tools.registry can't break codex_shell_command.shell_snapshot_render.
Position
Below the diagonal: codex_core.tools.registry uses a module listed above it, which is the healthy direction.
codex_core.tools.registry uses codex_utils_path_uri, so a change to codex_utils_path_uri can break codex_core.tools.registry, while a change to codex_core.tools.registry can't break codex_utils_path_uri.
Position
Below the diagonal: codex_core.tools.registry uses a module listed above it, which is the healthy direction.
codex_core.tools.registry uses codex_protocol.models, so a change to codex_protocol.models can break codex_core.tools.registry, while a change to codex_core.tools.registry can't break codex_protocol.models.
Position
Below the diagonal: codex_core.tools.registry uses a module listed above it, which is the healthy direction.
codex_core.tools.registry uses codex_protocol.protocol, so a change to codex_protocol.protocol can break codex_core.tools.registry, while a change to codex_core.tools.registry can't break codex_protocol.protocol.
Position
Below the diagonal: codex_core.tools.registry uses a module listed above it, which is the healthy direction.
codex_core.tools.registry uses codex_history, so a change to codex_history can break codex_core.tools.registry, while a change to codex_core.tools.registry can't break codex_history.
Position
Below the diagonal: codex_core.tools.registry uses a module listed above it, which is the healthy direction.
codex_core.tools.registry uses codex_tools.tool_spec, so a change to codex_tools.tool_spec can break codex_core.tools.registry, while a change to codex_core.tools.registry can't break codex_tools.tool_spec.
Position
Below the diagonal: codex_core.tools.registry uses a module listed above it, which is the healthy direction.
codex_core.tools.registry uses codex_core.session.turn_context, so a change to codex_core.session.turn_context can break codex_core.tools.registry, while a change to codex_core.tools.registry can't break codex_core.session.turn_context.
Position
Below the diagonal: codex_core.tools.registry uses a module listed above it, which is the healthy direction.
codex_core.tools.registry uses codex_core.session.session, so a change to codex_core.session.session can break codex_core.tools.registry, while a change to codex_core.tools.registry can't break codex_core.session.session.
Position
Below the diagonal: codex_core.tools.registry uses a module listed above it, which is the healthy direction.
codex_core.tools.registry uses codex_core.tools.context, so a change to codex_core.tools.context can break codex_core.tools.registry, while a change to codex_core.tools.registry can't break codex_core.tools.context.
Position
Below the diagonal: codex_core.tools.registry uses a module listed above it, which is the healthy direction.
codex_tui.terminal_hyperlinks uses codex_tui.empty_state_animation.geometry, so a change to codex_tui.empty_state_animation.geometry can break codex_tui.terminal_hyperlinks, while a change to codex_tui.terminal_hyperlinks can't break codex_tui.empty_state_animation.geometry.
Position
Below the diagonal: codex_tui.terminal_hyperlinks uses a module listed above it, which is the healthy direction.
codex_tui.terminal_hyperlinks uses codex_core.unified_exec.async_watcher, so a change to codex_core.unified_exec.async_watcher can break codex_tui.terminal_hyperlinks, while a change to codex_tui.terminal_hyperlinks can't break codex_core.unified_exec.async_watcher.
Position
Below the diagonal: codex_tui.terminal_hyperlinks uses a module listed above it, which is the healthy direction.
codex_tui.tui uses codex_config.types, so a change to codex_config.types can break codex_tui.tui, while a change to codex_tui.tui can't break codex_config.types.
Position
Below the diagonal: codex_tui.tui uses a module listed above it, which is the healthy direction.
codex_tui.tui uses codex_tui.terminal_hyperlinks, so a change to codex_tui.terminal_hyperlinks can break codex_tui.tui, while a change to codex_tui.tui can't break codex_tui.terminal_hyperlinks.
Position
Below the diagonal: codex_tui.tui uses a module listed above it, which is the healthy direction.
codex_tui.bottom_pane.chat_composer uses codex_protocol.thread_id, so a change to codex_protocol.thread_id can break codex_tui.bottom_pane.chat_composer, while a change to codex_tui.bottom_pane.chat_composer can't break codex_protocol.thread_id.
Position
Below the diagonal: codex_tui.bottom_pane.chat_composer uses a module listed above it, which is the healthy direction.
codex_tui.bottom_pane.chat_composer uses codex_protocol.openai_models, so a change to codex_protocol.openai_models can break codex_tui.bottom_pane.chat_composer, while a change to codex_tui.bottom_pane.chat_composer can't break codex_protocol.openai_models.
Position
Below the diagonal: codex_tui.bottom_pane.chat_composer uses a module listed above it, which is the healthy direction.
codex_tui.bottom_pane.chat_composer uses codex_core.unified_exec.async_watcher, so a change to codex_core.unified_exec.async_watcher can break codex_tui.bottom_pane.chat_composer, while a change to codex_tui.bottom_pane.chat_composer can't break codex_core.unified_exec.async_watcher.
Position
Below the diagonal: codex_tui.bottom_pane.chat_composer uses a module listed above it, which is the healthy direction.
codex_tui.bottom_pane.chat_composer uses codex_tui.tui, so a change to codex_tui.tui can break codex_tui.bottom_pane.chat_composer, while a change to codex_tui.bottom_pane.chat_composer can't break codex_tui.tui.
Position
Below the diagonal: codex_tui.bottom_pane.chat_composer uses a module listed above it, which is the healthy direction.
37→38 codex_tui.bottom_pane.chat_composer uses codex_tui.bottom_panepart of a loop✕
Connections
5 pairs of types, where a type in codex_tui.bottom_pane.chat_composer uses a type in codex_tui.bottom_pane.
codex_tui.bottom_pane.chat_composer uses codex_tui.bottom_pane, so a change to codex_tui.bottom_pane can break codex_tui.bottom_pane.chat_composer, while a change to codex_tui.bottom_pane.chat_composer can't break codex_tui.bottom_pane.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
codex_tui.bottom_pane uses codex_protocol.thread_id, so a change to codex_protocol.thread_id can break codex_tui.bottom_pane, while a change to codex_tui.bottom_pane can't break codex_protocol.thread_id.
Position
Below the diagonal: codex_tui.bottom_pane uses a module listed above it, which is the healthy direction.
codex_tui.bottom_pane uses codex_tui.empty_state_animation.geometry, so a change to codex_tui.empty_state_animation.geometry can break codex_tui.bottom_pane, while a change to codex_tui.bottom_pane can't break codex_tui.empty_state_animation.geometry.
Position
Below the diagonal: codex_tui.bottom_pane uses a module listed above it, which is the healthy direction.
codex_tui.bottom_pane uses codex_protocol.openai_models, so a change to codex_protocol.openai_models can break codex_tui.bottom_pane, while a change to codex_tui.bottom_pane can't break codex_protocol.openai_models.
Position
Below the diagonal: codex_tui.bottom_pane uses a module listed above it, which is the healthy direction.
codex_tui.bottom_pane uses codex_config.types, so a change to codex_config.types can break codex_tui.bottom_pane, while a change to codex_tui.bottom_pane can't break codex_config.types.
Position
Below the diagonal: codex_tui.bottom_pane uses a module listed above it, which is the healthy direction.
codex_tui.bottom_pane uses codex_core.unified_exec.async_watcher, so a change to codex_core.unified_exec.async_watcher can break codex_tui.bottom_pane, while a change to codex_tui.bottom_pane can't break codex_core.unified_exec.async_watcher.
Position
Below the diagonal: codex_tui.bottom_pane uses a module listed above it, which is the healthy direction.
codex_tui.bottom_pane uses codex_tui.tui, so a change to codex_tui.tui can break codex_tui.bottom_pane, while a change to codex_tui.bottom_pane can't break codex_tui.tui.
Position
Below the diagonal: codex_tui.bottom_pane uses a module listed above it, which is the healthy direction.
codex_tui.bottom_pane uses codex_tui.bottom_pane.chat_composer, so a change to codex_tui.bottom_pane.chat_composer can break codex_tui.bottom_pane, while a change to codex_tui.bottom_pane can't break codex_tui.bottom_pane.chat_composer.
Position
Below the diagonal: codex_tui.bottom_pane uses a module listed above it, which is the healthy direction.
codex_tui.chatwidget uses codex_protocol.thread_id, so a change to codex_protocol.thread_id can break codex_tui.chatwidget, while a change to codex_tui.chatwidget can't break codex_protocol.thread_id.
Position
Below the diagonal: codex_tui.chatwidget uses a module listed above it, which is the healthy direction.
codex_tui.chatwidget uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_tui.chatwidget, while a change to codex_tui.chatwidget can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_tui.chatwidget uses a module listed above it, which is the healthy direction.
codex_tui.chatwidget uses codex_tui.empty_state_animation.geometry, so a change to codex_tui.empty_state_animation.geometry can break codex_tui.chatwidget, while a change to codex_tui.chatwidget can't break codex_tui.empty_state_animation.geometry.
Position
Below the diagonal: codex_tui.chatwidget uses a module listed above it, which is the healthy direction.
codex_tui.chatwidget uses codex_utils_path_uri, so a change to codex_utils_path_uri can break codex_tui.chatwidget, while a change to codex_tui.chatwidget can't break codex_utils_path_uri.
Position
Below the diagonal: codex_tui.chatwidget uses a module listed above it, which is the healthy direction.
codex_tui.chatwidget uses codex_protocol.models, so a change to codex_protocol.models can break codex_tui.chatwidget, while a change to codex_tui.chatwidget can't break codex_protocol.models.
Position
Below the diagonal: codex_tui.chatwidget uses a module listed above it, which is the healthy direction.
codex_tui.chatwidget uses codex_protocol.protocol, so a change to codex_protocol.protocol can break codex_tui.chatwidget, while a change to codex_tui.chatwidget can't break codex_protocol.protocol.
Position
Below the diagonal: codex_tui.chatwidget uses a module listed above it, which is the healthy direction.
codex_tui.chatwidget uses codex_protocol.openai_models, so a change to codex_protocol.openai_models can break codex_tui.chatwidget, while a change to codex_tui.chatwidget can't break codex_protocol.openai_models.
Position
Below the diagonal: codex_tui.chatwidget uses a module listed above it, which is the healthy direction.
codex_tui.chatwidget uses codex_app_server_protocol.protocol.v2.thread_data, so a change to codex_app_server_protocol.protocol.v2.thread_data can break codex_tui.chatwidget, while a change to codex_tui.chatwidget can't break codex_app_server_protocol.protocol.v2.thread_data.
Position
Below the diagonal: codex_tui.chatwidget uses a module listed above it, which is the healthy direction.
codex_tui.chatwidget uses codex_protocol.config_types, so a change to codex_protocol.config_types can break codex_tui.chatwidget, while a change to codex_tui.chatwidget can't break codex_protocol.config_types.
Position
Below the diagonal: codex_tui.chatwidget uses a module listed above it, which is the healthy direction.
codex_tui.chatwidget uses codex_app_server_protocol.protocol.v2.config, so a change to codex_app_server_protocol.protocol.v2.config can break codex_tui.chatwidget, while a change to codex_tui.chatwidget can't break codex_app_server_protocol.protocol.v2.config.
Position
Below the diagonal: codex_tui.chatwidget uses a module listed above it, which is the healthy direction.
codex_tui.chatwidget uses codex_config.types, so a change to codex_config.types can break codex_tui.chatwidget, while a change to codex_tui.chatwidget can't break codex_config.types.
Position
Below the diagonal: codex_tui.chatwidget uses a module listed above it, which is the healthy direction.
codex_tui.chatwidget uses codex_tui.app_server_session, so a change to codex_tui.app_server_session can break codex_tui.chatwidget, while a change to codex_tui.chatwidget can't break codex_tui.app_server_session.
Position
Below the diagonal: codex_tui.chatwidget uses a module listed above it, which is the healthy direction.
codex_tui.chatwidget uses codex_core.unified_exec.async_watcher, so a change to codex_core.unified_exec.async_watcher can break codex_tui.chatwidget, while a change to codex_tui.chatwidget can't break codex_core.unified_exec.async_watcher.
Position
Below the diagonal: codex_tui.chatwidget uses a module listed above it, which is the healthy direction.
codex_tui.chatwidget uses codex_tui.terminal_hyperlinks, so a change to codex_tui.terminal_hyperlinks can break codex_tui.chatwidget, while a change to codex_tui.chatwidget can't break codex_tui.terminal_hyperlinks.
Position
Below the diagonal: codex_tui.chatwidget uses a module listed above it, which is the healthy direction.
codex_tui.chatwidget uses codex_tui.tui, so a change to codex_tui.tui can break codex_tui.chatwidget, while a change to codex_tui.chatwidget can't break codex_tui.tui.
Position
Below the diagonal: codex_tui.chatwidget uses a module listed above it, which is the healthy direction.
codex_tui.chatwidget uses codex_tui.bottom_pane.chat_composer, so a change to codex_tui.bottom_pane.chat_composer can break codex_tui.chatwidget, while a change to codex_tui.chatwidget can't break codex_tui.bottom_pane.chat_composer.
Position
Below the diagonal: codex_tui.chatwidget uses a module listed above it, which is the healthy direction.
codex_tui.chatwidget uses codex_tui.bottom_pane, so a change to codex_tui.bottom_pane can break codex_tui.chatwidget, while a change to codex_tui.chatwidget can't break codex_tui.bottom_pane.
Position
Below the diagonal: codex_tui.chatwidget uses a module listed above it, which is the healthy direction.
codex_tui.app uses codex_protocol.thread_id, so a change to codex_protocol.thread_id can break codex_tui.app, while a change to codex_tui.app can't break codex_protocol.thread_id.
Position
Below the diagonal: codex_tui.app uses a module listed above it, which is the healthy direction.
codex_tui.app uses codex_utils_absolute_path, so a change to codex_utils_absolute_path can break codex_tui.app, while a change to codex_tui.app can't break codex_utils_absolute_path.
Position
Below the diagonal: codex_tui.app uses a module listed above it, which is the healthy direction.
codex_tui.app uses codex_tui.empty_state_animation.geometry, so a change to codex_tui.empty_state_animation.geometry can break codex_tui.app, while a change to codex_tui.app can't break codex_tui.empty_state_animation.geometry.
Position
Below the diagonal: codex_tui.app uses a module listed above it, which is the healthy direction.
codex_tui.app uses codex_protocol.models, so a change to codex_protocol.models can break codex_tui.app, while a change to codex_tui.app can't break codex_protocol.models.
Position
Below the diagonal: codex_tui.app uses a module listed above it, which is the healthy direction.
codex_tui.app uses codex_protocol.protocol, so a change to codex_protocol.protocol can break codex_tui.app, while a change to codex_tui.app can't break codex_protocol.protocol.
Position
Below the diagonal: codex_tui.app uses a module listed above it, which is the healthy direction.
codex_tui.app uses codex_app_server_protocol.rpc, so a change to codex_app_server_protocol.rpc can break codex_tui.app, while a change to codex_tui.app can't break codex_app_server_protocol.rpc.
Position
Below the diagonal: codex_tui.app uses a module listed above it, which is the healthy direction.
codex_tui.app uses codex_protocol.openai_models, so a change to codex_protocol.openai_models can break codex_tui.app, while a change to codex_tui.app can't break codex_protocol.openai_models.
Position
Below the diagonal: codex_tui.app uses a module listed above it, which is the healthy direction.
codex_tui.app uses codex_app_server_protocol.protocol.v2.thread_data, so a change to codex_app_server_protocol.protocol.v2.thread_data can break codex_tui.app, while a change to codex_tui.app can't break codex_app_server_protocol.protocol.v2.thread_data.
Position
Below the diagonal: codex_tui.app uses a module listed above it, which is the healthy direction.
codex_tui.app uses codex_app_server_protocol.protocol.v2.config, so a change to codex_app_server_protocol.protocol.v2.config can break codex_tui.app, while a change to codex_tui.app can't break codex_app_server_protocol.protocol.v2.config.
Position
Below the diagonal: codex_tui.app uses a module listed above it, which is the healthy direction.
codex_tui.app uses codex_config.state, so a change to codex_config.state can break codex_tui.app, while a change to codex_tui.app can't break codex_config.state.
Position
Below the diagonal: codex_tui.app uses a module listed above it, which is the healthy direction.
codex_tui.app uses codex_config.types, so a change to codex_config.types can break codex_tui.app, while a change to codex_tui.app can't break codex_config.types.
Position
Below the diagonal: codex_tui.app uses a module listed above it, which is the healthy direction.
codex_tui.app uses codex_core.config, so a change to codex_core.config can break codex_tui.app, while a change to codex_tui.app can't break codex_core.config.
Position
Below the diagonal: codex_tui.app uses a module listed above it, which is the healthy direction.
codex_tui.app uses codex_app_server_client, so a change to codex_app_server_client can break codex_tui.app, while a change to codex_tui.app can't break codex_app_server_client.
Position
Below the diagonal: codex_tui.app uses a module listed above it, which is the healthy direction.
codex_tui.app uses codex_tui.app_server_session, so a change to codex_tui.app_server_session can break codex_tui.app, while a change to codex_tui.app can't break codex_tui.app_server_session.
Position
Below the diagonal: codex_tui.app uses a module listed above it, which is the healthy direction.
codex_tui.app uses codex_tui.terminal_hyperlinks, so a change to codex_tui.terminal_hyperlinks can break codex_tui.app, while a change to codex_tui.app can't break codex_tui.terminal_hyperlinks.
Position
Below the diagonal: codex_tui.app uses a module listed above it, which is the healthy direction.
codex_tui.app uses codex_tui.chatwidget, so a change to codex_tui.chatwidget can break codex_tui.app, while a change to codex_tui.app can't break codex_tui.chatwidget.
Position
Below the diagonal: codex_tui.app uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 63% · Adequate · gated by D1, D2, X4 ·
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 category
Findings
Severity
A03:2025 — Software Supply Chain Failures
89
High / Critical
A05:2025 — Injection
37
High / Critical
A02:2025 — Security Misconfiguration
2
High / Critical
Roadmap
Top priorities: 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; Resolve the 18 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (7), REDACTED (5), REDACTED (4); 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.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
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.
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 — 64
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 — 5226
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 — 279
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 16
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
This survey 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. All 76 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.
Every figure here is one of two 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. 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.
What we checked — 76 dimensions across the health lenses
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
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, 5375 of 5569 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.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
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.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
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 — We 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.
D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we 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 48 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 2,508 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 — We 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 — We 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 — We measured this, but not all of it. What we 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 — We measured this, but not all of it. What we 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.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we 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 — We measured this, but not all of it. What we 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 — We 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 naming rules read C# through Roslyn and every other language through its sidecar model; these languages are left out (PHP's reading is its own change, a Roslyn-loaded VB or F# project has no population builder yet). Their declarations carry no naming verdict this run — this says nothing about whether their names are consistent.
D21 Naming Consistency — not measured this run — We 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. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D21 Naming Consistency — not measured this run — We 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. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D22 Internal API Consistency — not measured this run — We 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 — We 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. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
D27 Navigability — not measured this run — We 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 — We 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/gqlj…; 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 — We 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 — We 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 — We 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 — We measured this, but not all of it. What we 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), and artefact counts an order of magnitude off. 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.
X10 Duplicated predicate — not measured this run — We 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. 72 further occurrence(s) are not listed individually; the score already reflects all 112.
X12 Unreachable branch — not measured this run — We 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 most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X13 Undrained process stream — not measured this run — We 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 most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X16 Unfloored truncation loop — not measured this run — We 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 most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X17 Uncapped recursion over a caller-supplied document — not measured this run — We 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 most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X25 Inert configuration knob — not measured this run — We 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 most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X3 Exception handling — not measured this run — We 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 most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X4 Structured logging — measured, with a gap in what it reached — We measured this, but not all of it. What we 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
We assess the repository exactly as committed, and only the repository. By design we do 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.
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 checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
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.
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: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
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.
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.
763 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was App::handle_event at 724. A further 60 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 178 — they are counted neither in the figure above nor in this dimension's score. 34 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 178), codex-rs/tui/src/keymap_setup/actions.rs (codex_tui::keymap_setup::actions::binding_slot at 173), codex-rs/app-server-protocol/src/protocol/common.rs (ServerNotification::to_params at 88), codex-rs/tui/src/app/app_server_event_targets.rs (codex_tui::app::app_server_event_targets::server_notification_thread_target at 68), codex-rs/tui/src/slash_command.rs (SlashCommand::description at 63), and 29 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.
+ 290 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 1 body over 240 down to 240 or less in Cyclomatic Complexity — start with App::handle_event (cyclomatic 724). — Refactoring it lifts Cyclomatic Complexity from 3.9 to about 5.1/10.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
+ 415 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 5 bodies over 240 down to 240 or less in Cognitive Complexity — start with App::handle_event (cognitive 807), codex_cloud_tasks::run_cloud (cognitive 757), App::run (cognitive 439). — 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 5 together lifts Cognitive Complexity from 2.0 to about 3.4/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
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.
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 304 MethodTooLong finding(s) in God Classes — start with mod.rs (19), thread_processor.rs (9), render.rs (6). — One of this dimension's main actionable groups (304 warning-level).
Resolve the 270 FileTooLong finding(s) in God Classes — start with REDACTED (15), mod.rs (13), client.rs (5). — One of this dimension's main actionable groups (270 warning-level).
Resolve the 216 FunctionTooLong finding(s) in God Classes — start with REDACTED (9), mod.rs (7), turn.rs (5). — One of this dimension's main actionable groups (216 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
706 duplicated block group(s) detected. 2.9 % of the production lines (34,065 of 1,189,610) are in a reported copy. A further 580 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 36 of the 1286 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.
+ 230 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 53 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with mod.rs (4), markdown_render.rs (3), config_requirements.rs (2). — One of this dimension's main actionable groups (53 warning-level).
Resolve the 52 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with REDACTED (2), methods.rs (2), remote.rs (2). — One of this dimension's main actionable groups (52 warning-level).
Resolve the 50 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with http.rs (2), http_proxy.rs (2), socks5.rs (2). — One of this dimension's main actionable groups (50 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling7.0 / 10Adequate✓ 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.
192 production modules (Cargo+npm+Python+Bazel), 0 dependency cycle(s), 25 unstable depended-on module(s). Read from the build's own module declarations; 42 module(s) off the main sequence, with abstractness counted on 153 of the 192 (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 · ×41
+ 22 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 41 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (41 warning-level).
Resolve the 1 Unstable project codex-agent-message-board-extension finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 Unstable project codex-agent-message-board-host finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Resolve the 20 Low cohesion finding(s) in Cohesion (LCOM4) — start with mod.rs (3), extension.rs (3), client.rs (2). — One of this dimension's main actionable groups (20 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D10 · Test Quality9.4 / 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.
0 skipped, 2 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 48 tests. Measured on the JavaScript/TypeScript suite only — at least 2,508 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
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).
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.
93 outdated, 0 yanked direct Cargo dependencies. 248 of 249 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 · ×93
Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
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.
0 of 1281 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 14 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.
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.
Resolve the 402 Hotspot finding(s) in Churn × Complexity Hotspots — start with mod.rs (15), REDACTED (11), render.rs (6). — One of this dimension's main actionable groups (402 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor9.1 / 10Exemplary✓ 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.
234 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 2766 of the 3625 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 · ×21
Further sole-owners (lower concentration)
✓ On the Gold path — maintain.
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
274 deducted task-comment markers across 1189610 LoC (0.0/KLoC) → score 10.0. 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.
Resolve the 273 TodoComment finding(s) in Explicit Debt — start with unified_exec.rs (28), rmcp_client.rs (14), permissions.rs (11). — One of this dimension's main actionable groups (273 warning-level).
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).
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
2 of 2 documentation facets pass in full. 73 document(s) read across 4 unit(s).
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
No ADRs foundcodex-rs/windows-sandbox-service/Cargo.toml:12
What to do
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml. — 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.
11 of 175 build units (Cargo, Python, npm) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
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.
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.
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).
37 finding(s): 0 critical, 32 high, 2 medium, 3 low. semgrep hit a parse error in 38 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 317), `codex-rs/core/src/context/world_state/mod.rs` (line 434, line 663), `codex-rs/core/src/context_manager/history.rs` (line 1475), … (+33 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 15 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
+ 5 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
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).
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (4 issue-level).
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).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
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. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
+ 6 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 17 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (14), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (17 issue-level).
Resolve the 3 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2), REDACTED. — One of this dimension's main actionable groups (3 issue-level).
Resolve the 1 High vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
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).
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.
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.
13 of 2766 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 2766 of the 3625 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
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).
Resolve the 12 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 (12 recommendation-level).
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.
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.
Resolve the 60 Change coupling finding(s) in Change Coupling — start with streaming.rs (3), mcp.rs (2), app_event.rs (2). — One of this dimension's main actionable groups (60 warning-level).
Resolve the 14 Change-coupling hub finding(s) in Change Coupling — start with tests.rs (2), REDACTED, windows_sandbox.rs. — One of this dimension's main actionable groups (14 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 6 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (6 warning-level).
Resolve the 2 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 warning-level).
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.
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.
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. Reported 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. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
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.
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.
Do you agree with this assessment?
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.
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.
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.
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.
`.card` sets color: var(
--color-text-primary,
light-dark(rgb(26 28 31), rgb(255 255 255))
) on background-color: color-mix(in oklab, var(
--color-text-primary,
light-dark(rgb(26 28 31), rgb(255 255 255))
) 5%, var(
--color-background-primary,
light-dark(rgb(255 255 255), rgb(24 24 24))
)) — 1.0:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — codex-rs/tui/assets/inline_visualization/visualize.css:353
`.btn:not(.btn-primary, .viz-tile):is( [aria-pressed="true"], [aria-selected="true"], .is-selected )` sets color: var(
--color-text-inverse,
light-dark(rgb(255 255 255), rgb(13 13 13))
) on background-color: light-dark(rgb(51 156 255), rgb(51 156 255)) — 2.9:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — codex-rs/tui/assets/inline_visualization/visualize.css:1307
`.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:1218
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.
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.
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.
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.
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.
Do you agree with this assessment?
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.
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:327
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.
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.
Do you agree with this assessment?
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.
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.
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.
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.
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.
Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
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.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
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.
Do you agree with this assessment?
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's code 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.
Only 74/90 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 11 more.
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
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.
`.github/dependabot.yaml` schedules updates, but no `package-ecosystem` entry covers `uv`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list. — .github/dependabot.yaml:4
What to do
Dependabot is configured but does not watch `uv` — add that `package-ecosystem` entry 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.
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.
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:373
`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:399
`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.
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.
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.
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 each language's code 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
`run_ssh_proxy` 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/tcp-tunnel/src/ssh.rs:81
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`.
Do you agree with this assessment?
R1 · Type Safety8.6 / 10Strong✓ 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.
React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): 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. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.
codex-cli/bin/codex.js:26 · 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:26
codex-cli/bin/codex.js:268 · 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:268
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.
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:172
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
Do you agree with this assessment?
R3 · Large Files6.7 / 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.
Do you agree with this assessment?
R4 · Test Coverage6.2 / 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-rs/responses-api-proxy/npm/bin/codex-responses-api-proxy.js:1, codex-rs/code-mode-runtime/src/runtime/settled.js:1, codex-rs/code-mode-runtime/src/runtime/content.js:1
What to do
Add tests that import the unreached modules (directly or through their public entry).
Do you agree with this assessment?
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.
Do you agree with this assessment?
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
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.
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.
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:170)), 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:1505, codex-rs/analytics/src/reducer.rs:4184, …
`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:170).
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:1505` (`Sha1::digest`), `codex-rs/analytics/src/reducer.rs:4184` (`Sha1::new`), `codex-rs/codex-mcp/src/tool_catalog_cache.rs:393` (`Sha1::new`), `codex-rs/codex-mcp/src/tool_catalog_cache.rs:460` (`Sha1::new`), `codex-rs/codex-mcp/src/tools.rs:277` (`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.
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.
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.
Do you agree with this assessment?
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.
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.
Do you agree with this assessment?
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.
Do you agree with this assessment?
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.
Do you agree with this assessment?
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.
Do you agree with this assessment?
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.
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 69 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:69
`warn!` at line 1635 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:1635
`warn!` at line 1646 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:1646
`error!` at line 1911 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:1911
`debug!` at line 305 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:305
`debug!` at line 310 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:310
`debug!` at line 88 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:88
`debug!` at line 111 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:111
`debug!` at line 180 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:180
`debug!` at line 222 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:222
`debug!` at line 226 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:226
`debug!` at line 230 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:230
`warn!` at line 196 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:196
`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 1288 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:1288
`error!` at line 1622 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:1622
`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 125 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:125
`warn!` at line 1000 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:1000
`warn!` at line 472 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:472
`warn!` at line 489 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:489
`warn!` at line 496 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:496
`warn!` at line 542 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:542
`warn!` at line 616 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:616
`warn!` at line 641 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:641
`warn!` at line 1055 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:1055
`warn!` at line 1058 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:1058
`warn!` at line 1073 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:1073
`warn!` at line 1076 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:1076
`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 1327 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:1327
`error!` at line 980 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:980
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.
Do you agree with this assessment?
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).
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.
Unscored — 4 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.
P12 CI test-gate honesty — 1 observation(s) recorded · 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'.
X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 37 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 — 55 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/gqlj…; 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 does not read html yet; 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+ sibling projects each declaring an entity of their own or taking another project's integration events. 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#, Visual Basic, TypeScript and JavaScript comments only; comments in this repository's .py, .rs source were not judged.
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.
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
P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
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.
X12 Unreachable branch — X12 reached only 3% of this repository's production lines — rust (1,156,189 lines), c (1 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X13 Undrained process stream — X13 reached only 3% of this repository's production lines — rust (1,156,189 lines), c (1 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X16 Unfloored truncation loop — X16 reached only 0% of this repository's production lines — rust (1,156,189 lines), python (31,206 lines), c (1 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X17 Uncapped recursion over a caller-supplied document — X17 reached only 3% of this repository's production lines — rust (1,156,189 lines), c (1 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X18 Disposal-pattern correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
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.
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X25 Inert configuration knob — X25 reached only 3% of this repository's production lines — rust (1,156,189 lines), c (1 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X3 Exception handling — X3 reached only 3% of this repository's production lines — rust (1,156,189 lines), c (1 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
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.
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.
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:327— `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.
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.
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.
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.
Hotspot: codex-rs/tui/src/app/event_dispatch.rs codex-rs/tui/src/app/event_dispatch.rs:35— codex-rs/tui/src/app/event_dispatch.rs changed 199 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 724 in App::handle_event at line 35. 4 of those changes were fix/bug commits, and the other 195 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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:248— codex-rs/tui/src/app/startup.rs changed 131 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 231 in App::run at line 248. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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:790— codex-rs/core/src/session/session.rs changed 199 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 113 in Session::new at line 790. 1 of those changes was a fix/bug commit, and the other 198 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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/session/turn.rs codex-rs/core/src/session/turn.rs:2869— codex-rs/core/src/session/turn.rs changed 151 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 130 in codex_core::session::turn::try_run_sampling_request at line 2869. 2 of those changes were fix/bug commits, and the other 149 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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/core/src/config/mod.rs codex-rs/core/src/config/mod.rs:3392— codex-rs/core/src/config/mod.rs changed 165 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 117 in Config::load_config_with_layer_stack at line 3392. 2 of those changes were fix/bug commits, and the other 163 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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/app-server/src/message_processor.rs codex-rs/app-server/src/message_processor.rs:1138— codex-rs/app-server/src/message_processor.rs changed 94 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 195 in MessageProcessor::handle_initialized_client_request at line 1138. 3 of those changes were fix/bug commits, and the other 91 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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:863— codex-rs/tui/src/app.rs changed 145 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 125 in App::handle_tui_event at line 863. 2 of those changes were fix/bug commits, and the other 143 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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/tui/src/lib.rs codex-rs/tui/src/lib.rs:1239— codex-rs/tui/src/lib.rs changed 140 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 122 in codex_tui::run_ratatui_app at line 1239. 2 of those changes were fix/bug commits, and the other 138 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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/core/src/session/mod.rs codex-rs/core/src/session/mod.rs:5124— codex-rs/core/src/session/mod.rs changed 302 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in Session::assemble_initial_context at line 5124. 2 of those changes were fix/bug commits, and the other 300 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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:5297— codex-rs/app-server/src/request_processors/thread_processor.rs changed 103 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 102 in ThreadRequestProcessor::thread_fork_inner at line 5297. 4 of those changes were fix/bug commits, and the other 99 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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/startup_orchestration.rs codex-rs/tui/src/startup_orchestration.rs:10— codex-rs/tui/src/startup_orchestration.rs changed 53 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 147 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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/bottom_pane/chat_composer.rs codex-rs/tui/src/bottom_pane/chat_composer.rs:4659— codex-rs/tui/src/bottom_pane/chat_composer.rs changed 109 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 70 in ChatComposer::render_with_options at line 4659. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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/tui/src/app/agents_overview.rs codex-rs/tui/src/app/agents_overview.rs:565— codex-rs/tui/src/app/agents_overview.rs changed 87 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 84 in App::attach_agents_overview_thread at line 565. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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/app-server/src/lib.rs codex-rs/app-server/src/lib.rs:515— codex-rs/app-server/src/lib.rs changed 63 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 112 in codex_app_server::run_main_with_transport_options at line 515. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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:1063— codex-rs/cli/src/main.rs changed 67 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 102 in codex_cli::dispatch_cli at line 1063. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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/core/src/thread_manager.rs codex-rs/core/src/thread_manager.rs:2491— codex-rs/core/src/thread_manager.rs changed 99 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 63 in ThreadManagerState::spawn_thread at line 2491. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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/tui/src/app/owned_transcript.rs codex-rs/tui/src/app/owned_transcript.rs:812— codex-rs/tui/src/app/owned_transcript.rs changed 61 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 96 in App::handle_owned_transcript_event at line 812. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +00:00' --full-history --no-merges -- codex-rs/tui/src/app/owned_transcript.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:173— codex-rs/tui/src/chatwidget/slash_dispatch.rs changed 58 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 173. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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/app-server/src/bespoke_event_handling.rs codex-rs/app-server/src/bespoke_event_handling.rs:148— codex-rs/app-server/src/bespoke_event_handling.rs changed 48 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 106 in codex_app_server::bespoke_event_handling::apply_bespoke_event_handling at line 148. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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:416— codex-rs/codex-mcp/src/connection_manager.rs changed 48 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 96 in McpConnectionSet::new at line 416. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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/features/src/lib.rs codex-rs/features/src/lib.rs:740— codex-rs/features/src/lib.rs changed 176 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in Features::apply_map at line 740. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +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/tui/src/chatwidget/protocol.rs codex-rs/tui/src/chatwidget/protocol.rs:4— codex-rs/tui/src/chatwidget/protocol.rs changed 46 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 97 in ChatWidget::handle_server_notification at line 4. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +00:00' --full-history --no-merges -- codex-rs/tui/src/chatwidget/protocol.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/input.rs codex-rs/tui/src/app/input.rs:440— codex-rs/tui/src/app/input.rs changed 59 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 71 in App::handle_key_event at line 440. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +00:00' --full-history --no-merges -- codex-rs/tui/src/app/input.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/app_server_events.rs codex-rs/tui/src/app/app_server_events.rs:189— codex-rs/tui/src/app/app_server_events.rs changed 53 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 78 in App::handle_server_notification_event at line 189. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +00:00' --full-history --no-merges -- codex-rs/tui/src/app/app_server_events.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/mod.rs codex-rs/tui/src/bottom_pane/mod.rs:2466— codex-rs/tui/src/bottom_pane/mod.rs changed 113 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in BottomPane::renderable_for_views at line 2466. 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:43:57 +00:00' --until='2026-11-14 09:43:57 +00:00' --full-history --no-merges -- codex-rs/tui/src/bottom_pane/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.
MethodTooLong: App.handle_event codex-rs/tui/src/app/event_dispatch.rs:35— MethodTooLong — handle_event runs 2974 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 2874 over it, 29.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.
MethodTooLong: Config.load_config_with_layer_stack codex-rs/core/src/config/mod.rs:3392— MethodTooLong — load_config_with_layer_stack runs 1293 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 1193 over it, 12.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.
MethodTooLong: RuntimeKeymap.resolve codex-rs/tui/src/keymap.rs:707— MethodTooLong — resolve runs 804 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 704 over it, 8.04× 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:1138— MethodTooLong — handle_initialized_client_request runs 746 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 646 over it, 7.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: McpConnectionSet.new codex-rs/codex-mcp/src/connection_manager.rs:416— MethodTooLong — new runs 681 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 581 over it, 6.81× 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:5297— MethodTooLong — thread_fork_inner runs 536 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 436 over it, 5.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.
MethodTooLong: ThreadRequestProcessor.thread_resume_inner codex-rs/app-server/src/request_processors/thread_processor.rs:3959— MethodTooLong — thread_resume_inner runs 495 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 395 over it, 4.95× 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:2491— MethodTooLong — spawn_thread runs 420 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 320 over it, 4.20× 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 406 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 306 over it, 4.06× 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.validate_conflicts codex-rs/tui/src/keymap.rs:2173— MethodTooLong — validate_conflicts runs 398 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 298 over it, 3.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.
MethodTooLong: Session.initialize codex-rs/core/src/session/mod.rs:699— MethodTooLong — initialize runs 384 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 284 over it, 3.84× 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:78— MethodTooLong — build_world_state_for_step runs 377 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 277 over it, 3.77× 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:565— MethodTooLong — attach_agents_overview_thread runs 364 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 264 over it, 3.64× 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:260— MethodTooLong — apply_event 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.
MethodTooLong: ConfigRequirements.try_from codex-rs/config/src/config_requirements.rs:2195— MethodTooLong — try_from runs 353 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 253 over it, 3.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.
MethodTooLong: UnifiedExecRuntime.run codex-rs/core/src/tools/runtimes/unified_exec.rs:221— MethodTooLong — run runs 353 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 253 over it, 3.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.
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.submit_user_message_with_prepared_images codex-rs/tui/src/chatwidget/input_submission.rs:158— MethodTooLong — submit_user_message_with_prepared_images runs 340 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 240 over it, 3.40× 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:743— MethodTooLong — handle_inline_policy_request runs 329 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 229 over it, 3.29× 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:173— MethodTooLong — dispatch_command_from_source 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: MessageProcessor.new codex-rs/app-server/src/message_processor.rs:291— MethodTooLong — new runs 327 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 227 over it, 3.27× 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:143— MethodTooLong — change_working_directory_with_managed runs 322 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 222 over it, 3.22× 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 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: GuardianV2Extension.score_tool codex-rs/ext/guardian-v2/src/async_scorer/observation.rs:53— MethodTooLong — score_tool runs 320 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 220 over it, 3.20× 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:247— MethodTooLong — ensure_v2_agent_loaded runs 318 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 218 over it, 3.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.
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:398— # 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:901— // 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:272— // 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:412— // 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:331— // 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:437— // 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:356— // 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:460— // 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:78— // 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:1912— // 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:386— // 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:780— // 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:781— // 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:800— // 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:849— // 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:850— // 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.
FileTooLong: request_processors/thread_processor.rs codex-rs/app-server/src/request_processors/thread_processor.rs— FileTooLong — 5300 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: ThreadRequestProcessor (2 blocks, 506-6186), declaring 44 free functions. The bar is 500 significant lines; this is 4800 over it, 10.60× 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 — 4553 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: Session (2 blocks, 601-6083). The bar is 500 significant lines; this is 4053 over it, 9.11× 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 — 3695 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 63 free functions. The bar is 500 significant lines; this is 3195 over it, 7.39× 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 — 3303 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 2803 over it, 6.61× 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 — 3270 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 (32-4429). The bar is 500 significant lines; this is 2770 over it, 6.54× 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: bottom_pane/chat_composer.rs codex-rs/tui/src/bottom_pane/chat_composer.rs— FileTooLong — 3195 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 88% of them inside a single declaration: ChatComposer (5 blocks, 632-5017). The bar is 500 significant lines; this is 2695 over it, 6.39× 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 — 3189 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 2689 over it, 6.38× 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/resume_picker.rs codex-rs/tui/src/resume_picker.rs— FileTooLong — 3091 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 86 free functions. The bar is 500 significant lines; this is 2591 over it, 6.18× 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 — 2898 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 35 free functions. The bar is 500 significant lines; this is 2398 over it, 5.80× 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/manager.rs codex-rs/core-plugins/src/manager.rs— FileTooLong — 2836 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 79% of them inside a single declaration: PluginsManager (2 blocks, 633-3795). The bar is 500 significant lines; this is 2336 over it, 5.67× 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: auth/manager.rs codex-rs/login/src/auth/manager.rs— FileTooLong — 2671 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 31 free functions. The bar is 500 significant lines; this is 2171 over it, 5.34× 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 — 2534 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 2034 over it, 5.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/thread_manager.rs codex-rs/core/src/thread_manager.rs— FileTooLong — 2421 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 1921 over it, 4.84× 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 — 2403 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 37 free functions. The bar is 500 significant lines; this is 1903 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/realtime_conversation.rs codex-rs/core/src/realtime_conversation.rs— FileTooLong — 2330 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 1830 over it, 4.66× 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 — 2317 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 90 free functions. The bar is 500 significant lines; this is 1817 over it, 4.63× 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 — 2176 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 58 free functions. The bar is 500 significant lines; this is 1676 over it, 4.35× 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/keymap.rs codex-rs/tui/src/keymap.rs— FileTooLong — 2139 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 71% of them inside a single declaration: RuntimeKeymap (2 blocks, 88-2768). The bar is 500 significant lines; this is 1639 over it, 4.28× 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/main.rs codex-rs/cli/src/main.rs— FileTooLong — 2029 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 1529 over it, 4.06× 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/tui/src/lib.rs— FileTooLong — 1992 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 41 free functions. The bar is 500 significant lines; this is 1492 over it, 3.98× 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 — 1971 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 70% of them inside a single declaration: PluginRequestProcessor (2 blocks, 62-2196). The bar is 500 significant lines; this is 1471 over it, 3.94× 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/config_requirements.rs codex-rs/config/src/config_requirements.rs— FileTooLong — 1962 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 1462 over it, 3.92× 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 — 1952 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 1452 over it, 3.90× 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 — 1946 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 1446 over it, 3.89× 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.
FunctionTooLong: codex_app_server::bespoke_event_handling::apply_bespoke_event_handling codex-rs/app-server/src/bespoke_event_handling.rs:148— FunctionTooLong — codex_app_server::bespoke_event_handling::apply_bespoke_event_handling runs 940 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 840 over it, 9.40× 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_cloud_tasks::run_cloud codex-rs/cloud-tasks/src/lib.rs:827— FunctionTooLong — codex_cloud_tasks::run_cloud runs 919 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 819 over it, 9.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_tui::run_ratatui_app codex-rs/tui/src/lib.rs:1239— FunctionTooLong — codex_tui::run_ratatui_app runs 871 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 771 over it, 8.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_tui::startup_orchestration::run_main_inner codex-rs/tui/src/startup_orchestration.rs:10— FunctionTooLong — codex_tui::startup_orchestration::run_main_inner runs 791 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 691 over it, 7.91× 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:2869— FunctionTooLong — codex_core::session::turn::try_run_sampling_request runs 726 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 626 over it, 7.26× 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:515— FunctionTooLong — codex_app_server::run_main_with_transport_options 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.
FunctionTooLong: codex_tui::dynamic_tools::execute_inner codex-rs/tui/src/dynamic_tools.rs:325— FunctionTooLong — codex_tui::dynamic_tools::execute_inner runs 632 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 532 over it, 6.32× 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:217— FunctionTooLong — codex_core::session::turn::run_turn runs 581 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 481 over it, 5.81× 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:273— FunctionTooLong — codex_exec::run_main runs 440 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 340 over it, 4.40× 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:919— FunctionTooLong — codex_exec::run_exec_session runs 430 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 330 over it, 4.30× 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:463— FunctionTooLong — codex_app_server::in_process::start_uninitialized runs 427 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 327 over it, 4.27× 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::request_processors::thread_lifecycle::start_listener codex-rs/app-server/src/request_processors/thread_lifecycle.rs:330— FunctionTooLong — codex_app_server::request_processors::thread_lifecycle::start_listener runs 383 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 283 over it, 3.83× 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:234— FunctionTooLong — codex_core::guardian::review_session::run_review_on_session runs 375 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 275 over it, 3.75× 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:569— FunctionTooLong — codex_network_proxy::http_proxy::http_plain_proxy runs 371 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 271 over it, 3.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_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 358 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 258 over it, 3.58× 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::session::handlers::submission_loop codex-rs/core/src/session/handlers.rs:520— FunctionTooLong — codex_core::session::handlers::submission_loop runs 315 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 215 over it, 3.15× 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:578— FunctionTooLong — codex_core::shell_snapshot::capture_snapshot 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.
FunctionTooLong: codex_config::loader::load_config_layers_state codex-rs/config/src/loader/mod.rs:147— FunctionTooLong — codex_config::loader::load_config_layers_state runs 297 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 197 over it, 2.97× 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:3095— 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_code_mode_runtime::cell_actor::run_cell codex-rs/code-mode-runtime/src/cell_actor/mod.rs:113— FunctionTooLong — codex_code_mode_runtime::cell_actor::run_cell runs 286 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 186 over it, 2.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.
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_core::mcp_tool_call::handle_approved_mcp_tool_call codex-rs/core/src/mcp_tool_call.rs:472— FunctionTooLong — codex_core::mcp_tool_call::handle_approved_mcp_tool_call runs 269 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 169 over it, 2.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.
FunctionTooLong: codex_core::session::mcp::review_guardian_mcp_elicitation codex-rs/core/src/session/mcp.rs:1007— FunctionTooLong — codex_core::session::mcp::review_guardian_mcp_elicitation 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.
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 164) codex-rs/tui/src/lib.rs:1239— codex_tui::run_ratatui_app has cognitive complexity 164 (threshold 15). Drivers by points: if/else 63 (96 pts), match/switch 26 (40 pts), boolean chains 28 (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.
codex_tui::startup_orchestration::run_main_inner (cognitive 158) codex-rs/tui/src/startup_orchestration.rs:10— codex_tui::startup_orchestration::run_main_inner has cognitive complexity 158 (threshold 15). Drivers by points: if/else 88 (111 pts), boolean chains 29, match/switch 12 (18 pts) (nesting depth added 29). 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 140) codex-rs/tui/src/dynamic_tools.rs:325— codex_tui::dynamic_tools::execute_inner has cognitive complexity 140 (threshold 15). Drivers by points: if/else 36 (79 pts), match/switch 11 (41 pts), boolean chains 10, loops 4 (10 pts) (nesting depth added 79). 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 128) codex-rs/tui/src/resume_picker/sources.rs:34— codex_tui::resume_picker::sources::spawn has cognitive complexity 128 (threshold 15). Drivers by points: if/else 24 (90 pts), match/switch 7 (24 pts), boolean chains 7, loops 4 (7 pts) (nesting depth added 86). To reduce it, split the body into named stages: move each independent step 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::onboarding::onboarding_screen::run_onboarding_screen_inner (cognitive 107) codex-rs/tui/src/onboarding/onboarding_screen.rs:700— codex_tui::onboarding::onboarding_screen::run_onboarding_screen_inner has cognitive complexity 107 (threshold 15). Drivers by points: if/else 18 (69 pts), match/switch 8 (28 pts), loops 2 (6 pts), boolean chains 4 (nesting depth added 75). To reduce it, split the body into named stages: move each independent step 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::markdown_copy::render_selection (cognitive 89) codex-rs/tui/src/markdown_copy.rs:402— codex_tui::markdown_copy::render_selection has cognitive complexity 89 (threshold 15). Drivers by points: if/else 26 (52 pts), boolean chains 24, 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:314— 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::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::sidebar_chooser::paint (cognitive 55) codex-rs/tui/src/sidebar_chooser.rs:373— codex_tui::sidebar_chooser::paint has cognitive complexity 55 (threshold 15). Drivers by points: if/else 30 (44 pts), boolean chains 4, match/switch 2 (4 pts), loops 2 (3 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_tui::thread_transcript::thread_items_to_transcript_cells (cognitive 50) codex-rs/tui/src/thread_transcript.rs:129— 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::app::user_turn_submission::try_submit_user_turn (cognitive 48) codex-rs/tui/src/app/user_turn_submission.rs:12— codex_tui::app::user_turn_submission::try_submit_user_turn has cognitive complexity 48 (threshold 15). Drivers by points: if/else 22 (39 pts), boolean chains 6, match/switch 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_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 46) codex-rs/tui/src/history_cell/mcp.rs:647— codex_tui::history_cell::mcp::new_mcp_tools_output_from_statuses has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (30 pts), loops 3 (9 pts), match/switch 3 (6 pts), boolean chains 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.
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::markdown_copy::table::render (cognitive 42) codex-rs/tui/src/markdown_copy/table.rs:163— codex_tui::markdown_copy::table::render has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 7 (13 pts), boolean chains 12 (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_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::terminal_hyperlinks::mark_buffer_hyperlinks (cognitive 39) codex-rs/tui/src/terminal_hyperlinks.rs:852— 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.
ClassTooLong: ThreadRequestProcessor codex-rs/app-server/src/request_processors/thread_processor.rs:506— ClassTooLong — 4339 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 132 methods, 2 blocks, lines 506-6186. The bar is 400 significant lines; this is 3939 over it, 10.85× 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:632— ClassTooLong — 2826 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 294 methods, 5 blocks, lines 632-5017. The bar is 400 significant lines; this is 2426 over it, 7.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.
ClassTooLong: PluginsManager codex-rs/core-plugins/src/manager.rs:633— ClassTooLong — 2242 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 98 methods, 2 blocks, lines 633-3795. The bar is 400 significant lines; this is 1842 over it, 5.61× 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:639— ClassTooLong — 2013 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, 4 blocks, lines 639-5132. The bar is 400 significant lines; this is 1613 over it, 5.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.
ClassTooLong: AnalyticsReducer codex-rs/analytics/src/reducer.rs:217— ClassTooLong — 1807 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 217-2923. The bar is 400 significant lines; this is 1407 over it, 4.52× 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:508— ClassTooLong — 1547 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 508-2677. The bar is 400 significant lines; this is 1147 over it, 3.87× 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:88— ClassTooLong — 1528 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 8 methods, 2 blocks, lines 88-2768. The bar is 400 significant lines; this is 1128 over it, 3.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: BottomPane codex-rs/tui/src/bottom_pane/mod.rs:304— ClassTooLong — 1496 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 234 methods, 3 blocks, lines 304-2717. The bar is 400 significant lines; this is 1096 over it, 3.74× 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:145— ClassTooLong — 1452 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 186 methods, 6 blocks, lines 145-2394. The bar is 400 significant lines; this is 1052 over it, 3.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.
ClassTooLong: MessageProcessor codex-rs/app-server/src/message_processor.rs:151— ClassTooLong — 1427 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 151-2062. The bar is 400 significant lines; this is 1027 over it, 3.57× 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:62— ClassTooLong — 1373 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 62-2196. The bar is 400 significant lines; this is 973 over it, 3.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: AppServerSession codex-rs/tui/src/app_server_session.rs:392— ClassTooLong — 1311 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 127 methods, 2 blocks, lines 392-2318. The bar is 400 significant lines; this is 911 over it, 3.28× 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:73— ClassTooLong — 1248 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 330 methods, 2 blocks, lines 73-2164. The bar is 400 significant lines; this is 848 over it, 3.12× 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:416— ClassTooLong — 1175 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 416-1999. The bar is 400 significant lines; this is 775 over it, 2.94× 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:87— ClassTooLong — 1170 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 42 methods, 2 blocks, lines 87-1616. The bar is 400 significant lines; this is 770 over it, 2.93× 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: ThreadHistoryBuilder codex-rs/app-server-protocol/src/protocol/thread_history.rs:291— ClassTooLong — 1124 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 80 methods, 3 blocks, lines 291-1857. The bar is 400 significant lines; this is 724 over it, 2.81× 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:2236— ClassTooLong — 1090 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 89 methods, 3 blocks, lines 2236-3818. The bar is 400 significant lines; this is 690 over it, 2.73× 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:110— ClassTooLong — 1011 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 71 methods, 2 blocks, lines 110-1518. The bar is 400 significant lines; this is 611 over it, 2.53× 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:126— ClassTooLong — 1006 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 58 methods, 2 blocks, lines 126-1497. The bar is 400 significant lines; this is 606 over it, 2.52× 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 — 1005 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-1406. The bar is 400 significant lines; this is 605 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: McpConnectionSet codex-rs/codex-mcp/src/connection_manager.rs:379— ClassTooLong — 974 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 52 methods, 2 blocks, lines 379-1649. The bar is 400 significant lines; this is 574 over it, 2.44× 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:264— ClassTooLong — 970 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 70 methods, 5 blocks, lines 264-2101. The bar is 400 significant lines; this is 570 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: PickerState codex-rs/tui/src/resume_picker.rs:1124— ClassTooLong — 967 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 54 methods, 2 blocks, lines 1124-2549. The bar is 400 significant lines; this is 567 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: RequestUserInputOverlay codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:140— ClassTooLong — 959 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-1530. The bar is 400 significant lines; this is 559 over it, 2.40× 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.
App::handle_event (cognitive 807) codex-rs/tui/src/app/event_dispatch.rs:35— App::handle_event has cognitive complexity 807 (threshold 15). Drivers by points: if/else 268 (585 pts), match/switch 49 (116 pts), boolean chains 87, loops 7 (19 pts) (nesting depth added 396). 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 439) codex-rs/tui/src/app/startup.rs:248— App::run has cognitive complexity 439 (threshold 15). Drivers by points: if/else 125 (283 pts), match/switch 34 (94 pts), boolean chains 55, loops 3 (7 pts) (nesting depth added 222). Of this number, 438 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::handle_tui_event (cognitive 177) codex-rs/tui/src/app.rs:863— App::handle_tui_event has cognitive complexity 177 (threshold 15). Drivers by points: if/else 70 (123 pts), boolean chains 47, match/switch 5 (7 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.
App::attach_agents_overview_thread (cognitive 154) codex-rs/tui/src/app/agents_overview.rs:565— App::attach_agents_overview_thread has cognitive complexity 154 (threshold 15). Drivers by points: if/else 52 (101 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_owned_transcript_event (cognitive 127) codex-rs/tui/src/app/owned_transcript.rs:812— App::handle_owned_transcript_event has cognitive complexity 127 (threshold 15). Drivers by points: if/else 49 (83 pts), boolean chains 38, match/switch 3 (6 pts) (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.
App::handle_server_notification_event (cognitive 111) codex-rs/tui/src/app/app_server_events.rs:189— App::handle_server_notification_event has cognitive complexity 111 (threshold 15). Drivers by points: if/else 40 (73 pts), boolean chains 23, match/switch 5 (10 pts), loops 2 (5 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.
App::handle_key_event (cognitive 100) codex-rs/tui/src/app/input.rs:440— App::handle_key_event has cognitive complexity 100 (threshold 15). Drivers by points: if/else 39 (67 pts), boolean chains 28, match/switch 3 (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.
App::handle_sidebar_input (cognitive 91) codex-rs/tui/src/app/side_focus.rs:136— App::handle_sidebar_input has cognitive complexity 91 (threshold 15). Drivers by points: if/else 34 (62 pts), boolean chains 19, match/switch 5 (10 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.
App::change_working_directory_with_managed (cognitive 83) codex-rs/tui/src/app/working_directory.rs:143— 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::handle_side_focus_key (cognitive 75) codex-rs/tui/src/app/side_focus.rs:428— App::handle_side_focus_key has cognitive complexity 75 (threshold 15). Drivers by points: if/else 36 (44 pts), boolean chains 31 (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.
App::apply_agents_overview_thread_refresh (cognitive 67) codex-rs/tui/src/app/agents_overview.rs:158— App::apply_agents_overview_thread_refresh has cognitive complexity 67 (threshold 15). Drivers by points: if/else 20 (49 pts), boolean chains 10, loops 4 (7 pts), match/switch 1 (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.
App::finish_reconnect (cognitive 62) codex-rs/tui/src/app/reconnect.rs:364— App::finish_reconnect has cognitive complexity 62 (threshold 15). Drivers by points: if/else 35 (49 pts), boolean chains 10, 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.
App::switch_to_new_backend_session (cognitive 58) codex-rs/tui/src/app/backend_selection.rs:149— App::switch_to_new_backend_session has cognitive complexity 58 (threshold 15). Drivers by points: if/else 33 (44 pts), boolean chains 8, loops 1 (3 pts), match/switch 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.
App::activate_prepared_session_after_clear (cognitive 58) codex-rs/tui/src/app/session_lifecycle.rs:1833— App::activate_prepared_session_after_clear has cognitive complexity 58 (threshold 15). Drivers by points: if/else 20 (41 pts), boolean chains 14, loops 1 (2 pts), 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.
App::start_agents_overview_refresh (cognitive 57) codex-rs/tui/src/app/agents_overview_threads.rs:259— App::start_agents_overview_refresh has cognitive complexity 57 (threshold 15). Drivers by points: if/else 18 (34 pts), boolean chains 10, 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::handle_server_request_event (cognitive 51) codex-rs/tui/src/app/app_server_events.rs:635— App::handle_server_request_event has cognitive complexity 51 (threshold 15). Drivers by points: if/else 25 (37 pts), boolean chains 14 (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.
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::enqueue_thread_notification (cognitive 51) codex-rs/tui/src/app/thread_routing.rs:1130— App::enqueue_thread_notification has cognitive complexity 51 (threshold 15). Drivers by points: if/else 27 (35 pts), boolean chains 10, match/switch 4 (6 pts) (nesting depth added 10). 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::render_owned_transcript (cognitive 49) codex-rs/tui/src/app/owned_transcript.rs:242— App::render_owned_transcript has cognitive complexity 49 (threshold 15). Drivers by points: if/else 20 (34 pts), boolean chains 7, match/switch 4 (6 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.
App::update_feature_flags (cognitive 47) codex-rs/tui/src/app/config_persistence.rs:724— 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::select_session_model (cognitive 47) codex-rs/tui/src/app/model_defaults.rs:89— App::select_session_model has cognitive complexity 47 (threshold 15). Drivers by points: if/else 18 (33 pts), boolean chains 10, match/switch 2 (4 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.
App::open_agent_picker (cognitive 46) codex-rs/tui/src/app/session_lifecycle.rs:61— 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::reset_thread_event_state (cognitive 43) codex-rs/tui/src/app/session_lifecycle.rs:1003— App::reset_thread_event_state has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 6 (16 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.
App::run_agents_overview_action (cognitive 40) codex-rs/tui/src/app/agents_overview_actions.rs:286— App::run_agents_overview_action has cognitive complexity 40 (threshold 15). Drivers by points: if/else 19 (28 pts), boolean chains 6, loops 2 (4 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.
App::try_submit_active_thread_op_via_app_server (cognitive 36) codex-rs/tui/src/app/thread_routing.rs:775— App::try_submit_active_thread_op_via_app_server has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (26 pts), boolean chains 4, match/switch 2 (4 pts), loops 1 (2 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.
TooManyMethods: ChatWidget codex-rs/tui/src/chatwidget.rs:533— TooManyMethods — 1060 methods, declared across 90 files: src/chatwidget.rs (101), chatwidget/status_surfaces.rs (61), chatwidget/interaction.rs (58), chatwidget/settings.rs (57), +86 more file(s). The bar is 30 methods; this is 1030 over it, 35.33× 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:556— TooManyMethods — 597 methods, declared across 86 files: app/thread_routing.rs (62), app/config_persistence.rs (38), app/session_lifecycle.rs (34), app/side.rs (33), +82 more file(s). The bar is 30 methods; this is 567 over it, 19.90× 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:73— TooManyMethods — 330 methods, declared across 34 files: session/mod.rs (167), session/mcp.rs (24), session/turn_context.rs (16), tasks/mod.rs (14), +30 more file(s). The bar is 30 methods; this is 300 over it, 11.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: ChatComposer codex-rs/tui/src/bottom_pane/chat_composer.rs:632— TooManyMethods — 294 methods, declared across 17 files: bottom_pane/chat_composer.rs (175), chat_composer/history_search.rs (16), chat_composer/footer_state.rs (15), chat_composer/paste_input.rs (14), +13 more file(s). The bar is 30 methods; this is 264 over it, 9.80× 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:304— TooManyMethods — 234 methods, declared across 9 files: bottom_pane/mod.rs (187), bottom_pane/startup.rs (16), chat_composer/sparkle.rs (8), bottom_pane/questions.rs (7), +5 more file(s). The bar is 30 methods; this is 204 over it, 7.80× 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:145— TooManyMethods — 186 methods, declared across 7 files: bottom_pane/textarea.rs (120), 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 156 over it, 6.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: TranscriptView codex-rs/tui/src/transcript_view.rs:92— TooManyMethods — 183 methods, declared across 21 files: src/transcript_view.rs (29), transcript_view/selection.rs (25), transcript_view/search.rs (24), transcript_view/disclosure.rs (13), +17 more file(s). The bar is 30 methods; this is 153 over it, 6.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: ThreadRequestProcessor codex-rs/app-server/src/request_processors/thread_processor.rs:506— TooManyMethods — 132 methods, declared across 12 files: request_processors/thread_processor.rs (109), request_processors/thread_attachments.rs (5), request_processors/thread_delete.rs (5), request_processors/thread_sections.rs (5), +8 more file(s). The bar is 30 methods; this is 102 over it, 4.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: AppServerSession codex-rs/tui/src/app_server_session.rs:392— TooManyMethods — 127 methods, declared across 14 files: src/app_server_session.rs (78), app_server_session/history.rs (11), app_server_session/side_chat_history.rs (7), app_server_session/rollout_history.rs (6), +10 more file(s). The bar is 30 methods; this is 97 over it, 4.23× 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:202— TooManyMethods — 118 methods, declared across 2 files: src/codex_thread.rs (117), session/extension_interruption.rs (1). The bar is 30 methods; this is 88 over it, 3.93× 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:102— TooManyMethods — 113 methods, declared across 16 files: runtime/threads.rs (46), src/runtime.rs (10), runtime/logs.rs (9), runtime/projects.rs (8), +12 more file(s). The bar is 30 methods; this is 83 over it, 3.77× 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:633— TooManyMethods — 98 methods, declared across 3 files: src/manager.rs (95), src/remote_mutations.rs (2), src/discoverable.rs (1). The bar is 30 methods; this is 68 over it, 3.27× 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:204— TooManyMethods — 94 methods, declared across 9 files: reducer/code_cell.rs (23), tool/agents.rs (22), reducer/tool.rs (14), reducer/conversation.rs (13), +5 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: AuthManager codex-rs/login/src/auth/manager.rs:2236— TooManyMethods — 89 methods, declared across 3 files: auth/manager.rs (83), manager/workspace_switching.rs (4), manager/workspace_routing.rs (2). The bar is 30 methods; this is 59 over it, 2.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: ThreadHistoryBuilder codex-rs/app-server-protocol/src/protocol/thread_history.rs:291— TooManyMethods — 80 methods. The bar is 30 methods; this is 50 over it, 2.67× 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:508— 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: ThreadManager codex-rs/core/src/thread_manager.rs:316— TooManyMethods — 73 methods, declared across 3 files: src/thread_manager.rs (67), thread_manager/shutdown.rs (5), thread_manager/managed.rs (1). The bar is 30 methods; this is 43 over it, 2.43× 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:110— TooManyMethods — 71 methods, declared across 9 files: request_processors/account_processor.rs (48), account_processor/gateway_oauth.rs (6), account_processor/workspace_switching.rs (5), account_processor/workspace_routing.rs (4), +5 more file(s). The bar is 30 methods; this is 41 over it, 2.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: Client codex-rs/backend-client/src/client.rs:183— TooManyMethods — 70 methods, declared across 9 files: src/client.rs (49), 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 40 over it, 2.33× 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: FileSystemSandboxPolicy codex-rs/protocol/src/permissions.rs:264— TooManyMethods — 70 methods, declared across 4 files: src/permissions.rs (61), permissions/target.rs (7), permissions/enforcement.rs (1), permissions/local_aliases.rs (1). The bar is 30 methods; this is 40 over it, 2.33× 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:284— TooManyMethods — 65 methods. The bar is 30 methods; this is 35 over it, 2.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.
TooManyMethods: ExecServerClient codex-rs/exec-server/src/client.rs:356— TooManyMethods — 63 methods, declared across 5 files: src/client.rs (47), src/client_transport.rs (10), client/rpc_http_client.rs (3), client/accepted.rs (2), +1 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: 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: ContextManager codex-rs/core/src/context_manager/history.rs:105— TooManyMethods — 59 methods, declared across 3 files: context_manager/history.rs (53), context_manager/history_user_authorization.rs (5), session/rollout_reconstruction.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.
codex_tui::startup_orchestration::run_main_inner (cyclomatic 147) codex-rs/tui/src/startup_orchestration.rs:10— codex_tui::startup_orchestration::run_main_inner has cyclomatic complexity 147 (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 122) codex-rs/tui/src/lib.rs:1239— codex_tui::run_ratatui_app has cyclomatic complexity 122 (threshold 15). To reduce it, separate the cases: extract each independent 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:325— 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 51) codex-rs/tui/src/markdown_copy.rs:402— codex_tui::markdown_copy::render_selection 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_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::resume_picker::sources::spawn (cyclomatic 44) codex-rs/tui/src/resume_picker/sources.rs:34— codex_tui::resume_picker::sources::spawn has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent 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 37) codex-rs/tui/src/onboarding/onboarding_screen.rs:700— codex_tui::onboarding::onboarding_screen::run_onboarding_screen_inner has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent 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:314— 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::app::user_turn_submission::try_submit_user_turn (cyclomatic 32) codex-rs/tui/src/app/user_turn_submission.rs:12— codex_tui::app::user_turn_submission::try_submit_user_turn 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_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::sidebar_chooser::paint (cyclomatic 31) codex-rs/tui/src/sidebar_chooser.rs:373— codex_tui::sidebar_chooser::paint 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::markdown_copy::table::render (cyclomatic 30) codex-rs/tui/src/markdown_copy/table.rs:163— codex_tui::markdown_copy::table::render 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.
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::mcp::new_mcp_tools_output_from_statuses (cyclomatic 28) codex-rs/tui/src/history_cell/mcp.rs:647— codex_tui::history_cell::mcp::new_mcp_tools_output_from_statuses 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::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::chatwidget::safety_recourse::metadata::parse (cyclomatic 27) codex-rs/tui/src/chatwidget/safety_recourse/metadata.rs:53— codex_tui::chatwidget::safety_recourse::metadata::parse 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.
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:1383— 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::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:651— 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_core::session::turn::try_run_sampling_request (cognitive 262) codex-rs/core/src/session/turn.rs:2869— codex_core::session::turn::try_run_sampling_request has cognitive complexity 262 (threshold 15). Drivers by points: if/else 82 (213 pts), match/switch 10 (26 pts), boolean chains 22, loops 1 (nesting depth added 147). To reduce it, split the body into named stages: move each independent step 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 146) codex-rs/core/src/session/turn.rs:217— codex_core::session::turn::run_turn has cognitive complexity 146 (threshold 15). Drivers by points: if/else 43 (112 pts), boolean chains 18, match/switch 7 (14 pts), loops 2 (nesting depth added 76). 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::agent::history::prepare_forked_history (cognitive 68) codex-rs/core/src/agent/history.rs:192— codex_core::agent::history::prepare_forked_history has cognitive complexity 68 (threshold 15). Drivers by points: if/else 32 (47 pts), boolean chains 16, 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.
codex_core::client::map_response_events (cognitive 64) codex-rs/core/src/client.rs:2788— codex_core::client::map_response_events has cognitive complexity 64 (threshold 15). Drivers by points: if/else 17 (51 pts), loops 2 (5 pts), boolean chains 4, match/switch 2 (4 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.
codex_core::context_manager::media_availability::replace_unresolvable_media_files (cognitive 63) codex-rs/core/src/context_manager/media_availability.rs:22— codex_core::context_manager::media_availability::replace_unresolvable_media_files has cognitive complexity 63 (threshold 15). Drivers by points: if/else 10 (33 pts), loops 8 (20 pts), match/switch 3 (9 pts), boolean chains 1 (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_core::compact_remote_v2::select_retained_items (cognitive 62) codex-rs/core/src/compact_remote_v2.rs:662— codex_core::compact_remote_v2::select_retained_items has cognitive complexity 62 (threshold 15). Drivers by points: if/else 25 (56 pts), boolean chains 5, loops 1 (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.
codex_core::session::mcp::review_guardian_mcp_elicitation (cognitive 57) codex-rs/core/src/session/mcp.rs:1007— codex_core::session::mcp::review_guardian_mcp_elicitation has cognitive complexity 57 (threshold 15). Drivers by points: if/else 24 (40 pts), boolean chains 10, 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::session::handlers::submission_loop (cognitive 55) codex-rs/core/src/session/handlers.rs:520— codex_core::session::handlers::submission_loop has cognitive complexity 55 (threshold 15). Drivers by points: if/else 12 (26 pts), match/switch 9 (26 pts), boolean chains 2, loops 1 (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_core::shell_snapshot::capture_snapshot (cognitive 55) codex-rs/core/src/shell_snapshot.rs:578— codex_core::shell_snapshot::capture_snapshot has cognitive complexity 55 (threshold 15). Drivers by points: boolean chains 24, if/else 16 (21 pts), loops 8 (10 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_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::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:986— 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:214— 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::guardian::review_session::run_review_on_session (cognitive 38) codex-rs/core/src/guardian/review_session.rs:234— codex_core::guardian::review_session::run_review_on_session has cognitive complexity 38 (threshold 15). Drivers by points: if/else 20 (23 pts), match/switch 9 (11 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, 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::collect_compaction_output (cognitive 37) codex-rs/core/src/compact_remote_v2.rs:386— 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::realtime_conversation::sideband::spawn_webrtc_sideband_input_task (cognitive 36) codex-rs/core/src/realtime_conversation/sideband.rs:30— codex_core::realtime_conversation::sideband::spawn_webrtc_sideband_input_task has cognitive complexity 36 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 6 (12 pts), boolean chains 6, 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::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:732— 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::guardian::input_budget::finalize (cognitive 32) codex-rs/core/src/guardian/input_budget.rs:162— codex_core::guardian::input_budget::finalize has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 5 (7 pts), match/switch 3 (5 pts), boolean chains 4 (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::session::turn::run_sampling_request (cognitive 31) codex-rs/core/src/session/turn.rs:1895— codex_core::session::turn::run_sampling_request has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (22 pts), match/switch 2 (5 pts), boolean chains 3, 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_core::session::turn::handle_plan_segments (cognitive 29) codex-rs/core/src/session/turn.rs:2529— 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::guardian::recorded_tool_call::review_tool_call (cognitive 28) codex-rs/core/src/guardian/recorded_tool_call.rs:40— codex_core::guardian::recorded_tool_call::review_tool_call has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 7 (10 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.
codex_core::mcp_tool_exposure::append_mcp_tools (cognitive 28) codex-rs/core/src/mcp_tool_exposure.rs:133— codex_core::mcp_tool_exposure::append_mcp_tools has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (23 pts), match/switch 1 (3 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_core::realtime_conversation::handle_realtime_server_event (cognitive 28) codex-rs/core/src/realtime_conversation.rs:2864— 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::mcp_tool_call::build_mcp_tool_approval_elicitation_meta (cognitive 27) codex-rs/core/src/mcp_tool_call.rs:2323— codex_core::mcp_tool_call::build_mcp_tool_approval_elicitation_meta has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 3, 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.
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: 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: 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 83% of the time (15 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 15 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: 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 82% of the time (14 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 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 14 shared commits counted here, the most recent 3 are `b514f638` Add policy-checked TCP upstream tunneling for SOCKS (#60523); `634ebc18` Support credential brokering in plaintext HTTP tunnels (#44089); `56d3e819` Refactor credential-broker tunnel protocol detection (#44077) — 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 82% of the time (18 of the 22 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 18 shared commits counted here, the most recent 3 are `8044c686` Add keyboard and mouse navigation for sidebar tabs (#60181); `ed8eac40` Add keyboard controls for TUI pane resizing and zoom (#59595); `db3c4441` Add directional conversation focus shortcuts in workspace mode (#59287) — 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 80% of the time (12 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 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: 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: 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: 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 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 `c93a54e1` Show effective processing tiers in TUI status surfaces (#57265); `8ea2428c` Add Daybreak state to the status line and terminal title (#49861); `1e71e35d` Add thread usage to TUI status surfaces (#38282) — 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 69% of the time (9 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 9 shared commits counted here, the most recent 3 are `76dcb819` Honor permission grant scopes in executor capability discovery (#60461); `c7e80f87` Preserve executor MCP credential boundaries across reconnects (#48143); `e8098eb4` Separate selected plugin identities from MCP contributions (#47939) — 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 68% of the time (15 of the 22 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 `1f0290c6` Broadcast thread section changes to connected clients (#58380); `82883da2` Notify subscribers when thread read state changes (#52384); `90abcfac` Add experimental thread prediction protocol types (#49480) — 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 67% of the time (10 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 10 shared commits counted here, the most recent 3 are `09db085f` Support negotiated server-side truncation in Code Mode clients (#58125); `a79a18cd` Expose tool dispatch and timing observations to extensions (#47662); `0fd1cd8d` Add opt-in overhead timing to code-mode responses (#46288) — 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 67% of the time (10 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 10 shared commits counted here, the most recent 3 are `4e4767ff` Search task history from the command center (#60286); `025f6d71` Show unread results in the TUI command center (#58263); `7298a6e0` Add shared task pinning to the agent command center (#51500) — 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 64% of the time (16 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 16 shared commits counted here, the most recent 3 are `4969675f` Resolve network approval prompts when their requests end (#58350); `07316174` Forward Guardian reviewer events to parent raw-event subscribers (#56…; `a6baf886` Signal abandonment of unanswered MCP elicitations (#51611) — 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 64% of the time (21 of the 33 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 21 shared commits counted here, the most recent 3 are `007f668c` Respect turn filesystem permissions during executor skill discovery (…; `ac9372e5` Add a thread-store builder with host cleanup support (#58954); `e776b27e` Add frozen cloud skill snapshots to the app server (#55631) — 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: environment_context.rs ↔ mod.rs codex-rs/core/src/context/environment_context.rs:1— `codex-rs/core/src/context/environment_context.rs` and `codex-rs/core/src/session/mod.rs` change together 63% of the time (12 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 — 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 `4bc2c723` Select the elevated Windows sandbox for network proxies (#33445); `abbb8c56` Require the elevated Windows sandbox for network proxies (#32857); `3b32d861` [codex] migrate environment context to model world state (#29249) — run `git show` on any of them.
Change coupling: permissions_instructions.rs ↔ openai_models.rs codex-rs/prompts/src/permissions_instructions.rs:1— `codex-rs/prompts/src/permissions_instructions.rs` and `codex-rs/protocol/src/openai_models.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 `e8e6a922` Support catalog headings for saved command-prefix notices (#57599); `133c11db` Allow model catalogs to customize approval instruction headings (#57581); `698599a4` Support model-catalog wording for permission path warnings (#57263) — run `git show` on any of them.
Change coupling: app_event.rs ↔ slash_commands.rs codex-rs/tui/src/app_event.rs:1— `codex-rs/tui/src/app_event.rs` and `codex-rs/tui/src/bottom_pane/slash_commands.rs` change together 61% of the time (11 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 11 shared commits counted here, the most recent 3 are `12e82f44` Remove personality selection from the TUI (#44935); `f6976ab0` Add managed worktree creation to TUI session commands (#43120); `4617d4d2` Add an agents overview dashboard to the TUI (#39094) — 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 61% of the time (42 of the 69 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 42 shared commits counted here, the most recent 3 are `36e074a2` Add local diagnostic ZIP saves to the TUI (#60542); `b095b2ef` Support inline permission profile selection with `/permissions` (#54383); `dcd9e954` Add `/presets` for reusable prompts and slash commands (#54380) — run `git show` on any of them.
Change coupling: user_authorization.rs ↔ guardian_review_evidence.rs codex-rs/core/src/agent/control/user_authorization.rs:1— `codex-rs/core/src/agent/control/user_authorization.rs` and `codex-rs/core/src/context/guardian_review_evidence.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 `e6de6a24` Move Guardian review evidence into the reviewer extension (#57702); `1d516d8b` Remove legacy Guardian authorization evidence paths (#47688); `c51cb968` Preserve Guardian evidence during checkpoint migration (#45789) — 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 58% of the time (7 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 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.
App::handle_event (cyclomatic 724) codex-rs/tui/src/app/event_dispatch.rs:35— App::handle_event has cyclomatic complexity 724 (threshold 15). To reduce it, separate the cases: extract each independent 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 231) codex-rs/tui/src/app/startup.rs:248— App::run has cyclomatic complexity 231 (threshold 15). Of this number, 230 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 125) codex-rs/tui/src/app.rs:863— App::handle_tui_event has cyclomatic complexity 125 (threshold 15). To reduce it, separate the cases: extract each independent 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 96) codex-rs/tui/src/app/owned_transcript.rs:812— App::handle_owned_transcript_event 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.
App::attach_agents_overview_thread (cyclomatic 84) codex-rs/tui/src/app/agents_overview.rs:565— App::attach_agents_overview_thread has cyclomatic complexity 84 (threshold 15). To reduce it, separate the cases: extract each independent 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 78) codex-rs/tui/src/app/app_server_events.rs:189— App::handle_server_notification_event has cyclomatic complexity 78 (threshold 15). To reduce it, separate the cases: extract each independent 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_key_event (cyclomatic 71) codex-rs/tui/src/app/input.rs:440— App::handle_key_event has cyclomatic complexity 71 (threshold 15). To reduce it, separate the cases: extract each independent 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:143— 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_sidebar_input (cyclomatic 65) codex-rs/tui/src/app/side_focus.rs:136— App::handle_sidebar_input 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.
App::handle_side_focus_key (cyclomatic 61) codex-rs/tui/src/app/side_focus.rs:428— App::handle_side_focus_key has cyclomatic complexity 61 (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::finish_reconnect (cyclomatic 45) codex-rs/tui/src/app/reconnect.rs:364— App::finish_reconnect 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.
App::workspace_hud (cyclomatic 42) codex-rs/tui/src/app/workspace_hud.rs:10— App::workspace_hud has cyclomatic complexity 42 (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.
App::enqueue_thread_notification (cyclomatic 41) codex-rs/tui/src/app/thread_routing.rs:1130— App::enqueue_thread_notification 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.
App::switch_to_new_backend_session (cyclomatic 39) codex-rs/tui/src/app/backend_selection.rs:149— App::switch_to_new_backend_session 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.
App::handle_server_request_event (cyclomatic 38) codex-rs/tui/src/app/app_server_events.rs:635— App::handle_server_request_event 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.
App::activate_prepared_session_after_clear (cyclomatic 36) codex-rs/tui/src/app/session_lifecycle.rs:1833— App::activate_prepared_session_after_clear 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::apply_agents_overview_thread_refresh (cyclomatic 35) codex-rs/tui/src/app/agents_overview.rs:158— App::apply_agents_overview_thread_refresh 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.
App::start_agents_overview_refresh (cyclomatic 35) codex-rs/tui/src/app/agents_overview_threads.rs:259— App::start_agents_overview_refresh 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.
App::render_owned_transcript (cyclomatic 34) codex-rs/tui/src/app/owned_transcript.rs:242— App::render_owned_transcript 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.
App::route_key_chord_event (cyclomatic 33) codex-rs/tui/src/app/input.rs:77— App::route_key_chord_event has cyclomatic complexity 33 (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::update_feature_flags (cyclomatic 31) codex-rs/tui/src/app/config_persistence.rs:724— 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::try_submit_active_thread_op_via_app_server (cyclomatic 31) codex-rs/tui/src/app/thread_routing.rs:775— App::try_submit_active_thread_op_via_app_server 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_mode_owns_chord (cyclomatic 30) codex-rs/tui/src/app/input/select_mode.rs:17— App::select_mode_owns_chord has cyclomatic complexity 30 (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::select_session_model (cyclomatic 29) codex-rs/tui/src/app/model_defaults.rs:89— App::select_session_model 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::open_agent_picker (cyclomatic 29) codex-rs/tui/src/app/session_lifecycle.rs:61— 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.
Duplicated block (8 lines × 2) codex-rs/analytics/src/product_attribution.rs:61— codex-rs/analytics/src/product_attribution.rs:61-68 | codex-rs/tui/src/keymap/chords.rs:576-583 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/analytics/src/product_attribution.rs:61` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (8 lines × 2) codex-rs/analytics/src/reducer.rs:2708— codex-rs/analytics/src/reducer.rs:2708-2715 | codex-rs/analytics/src/reducer.rs:2836-2843 — both copies are in the same file, so extract the 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/analytics/src/reducer.rs:2707` calls `turn_steer` and `codex-rs/analytics/src/reducer.rs:2835` 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 (8 lines × 2) codex-rs/app-server-transport/src/transport/remote_control/mod.rs:441— codex-rs/app-server-transport/src/transport/remote_control/mod.rs:441-448 | codex-rs/app-server-transport/src/transport/remote_control/mod.rs:689-696 — both copies are in the same file, so extract the 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server/src/request_processors/thread_goal_processor.rs:342` 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.
Duplicated block (8 lines × 2) codex-rs/codex-mcp/src/mcp/mod.rs:775— codex-rs/codex-mcp/src/mcp/mod.rs:775-782 | codex-rs/codex-mcp/src/mcp/mod.rs:815-822 — both copies are in the same file, so extract the 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 `codex-rs/codex-mcp/src/mcp/mod.rs:775` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/codex-mcp/src/mcp/mod.rs:814` calls `or_else`, `get` and `codex-rs/codex-mcp/src/mcp/mod.rs:774` 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 (8 lines × 2) codex-rs/config/src/config_requirements.rs:366— codex-rs/config/src/config_requirements.rs:366-373 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8 lines × 2) codex-rs/config/src/config_requirements.rs:376— codex-rs/config/src/config_requirements.rs:376-383 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8 lines × 2) codex-rs/core-plugins/src/manager.rs:2481— codex-rs/core-plugins/src/manager.rs:2481-2488 | codex-rs/core-plugins/src/manager.rs:2546-2553 — both copies are in the same file, so extract the 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 `codex-rs/core-plugins/src/manager.rs:2481` 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. 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 (8 lines × 2) codex-rs/core-plugins/src/remote.rs:2382— codex-rs/core-plugins/src/remote.rs:2382-2389 | codex-rs/core-plugins/src/remote/share.rs:387-394 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core-plugins/src/remote.rs:2382` 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.
Duplicated block (8 lines × 2) codex-rs/core/src/session/turn.rs:2445— codex-rs/core/src/session/turn.rs:2445-2452 | codex-rs/rollout/src/policy.rs:174-181 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/rollout/src/policy.rs:182` calls `SafetyBuffering` and `codex-rs/core/src/session/turn.rs:2453` does not — after which the two agree again for 3 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 (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/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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/ext/goal/src/accounting.rs:378` 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.
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 — before extracting anything, compare `codex-rs/ext/memories/src/schema.rs` and `codex-rs/ext/skills/src/tools/schema.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 40 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 (8 lines × 2) codex-rs/otel/src/metrics/client.rs:161— codex-rs/otel/src/metrics/client.rs:161-168 | codex-rs/otel/src/metrics/client.rs:224-231 — both copies are in the same file, so extract the 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 `codex-rs/otel/src/metrics/client.rs:161` 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.
Duplicated block (8 lines × 2) codex-rs/protocol/src/permissions.rs:1427— codex-rs/protocol/src/permissions.rs:1427-1434 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/protocol/src/permissions.rs:1427` 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.
Duplicated block (8 lines × 2) codex-rs/rollout/src/metadata.rs:175— codex-rs/rollout/src/metadata.rs:175-182 | codex-rs/state/src/runtime/threads.rs:1513-1520 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/rollout/src/metadata.rs:183` calls `TokenUsageRecord` and `codex-rs/state/src/runtime/threads.rs:1521` does not — after which the two agree again for 3 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 (8 lines × 2) codex-rs/sandboxing/src/manager.rs:538— codex-rs/sandboxing/src/manager.rs:538-545 | codex-rs/sandboxing/src/manager.rs:600-607 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
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/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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/shell-command/src/shell_snapshot_restore.rs:18` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8 lines × 2) codex-rs/thread-store/src/local/model_context.rs:127— codex-rs/thread-store/src/local/model_context.rs:127-134 | codex-rs/thread-store/src/local/model_context.rs:193-200 — both copies are in the same file, so extract the 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 `codex-rs/thread-store/src/local/model_context.rs:127` 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.
Duplicated block (8 lines × 2) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1258— codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1258-1265 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:1061-1068 — 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 6 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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1258` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1266` calls `trim`, `is_empty` and `codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:1069` 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 (8 lines × 2) codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:811— codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:811-818 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:827-834 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:811` 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.
Duplicated block (8 lines × 2) codex-rs/tui/src/history_cell/approvals.rs:55— codex-rs/tui/src/history_cell/approvals.rs:55-62 | codex-rs/tui/src/history_cell/approvals.rs:100-107 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/history_cell/approvals.rs:55` 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.
Duplicated block (8 lines × 2) codex-rs/tui/src/history_cell/mcp.rs:744— codex-rs/tui/src/history_cell/mcp.rs:744-751 | codex-rs/tui/src/history_cell/mcp.rs:764-771 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/history_cell/mcp.rs:744` 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.
Duplicated block (8 lines × 2) codex-rs/tui/src/keymap.rs:748— codex-rs/tui/src/keymap.rs:748-755 | codex-rs/tui/src/keymap.rs:761-768 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/keymap.rs:748` 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.
Duplicated block (9 lines × 2) codex-rs/app-server/src/request_processors/account_processor.rs:768— codex-rs/app-server/src/request_processors/account_processor.rs:768-777 | codex-rs/app-server/src/request_processors/account_processor.rs:837-845 — both copies are in the same file, so extract the 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 `codex-rs/app-server/src/request_processors/account_processor.rs:768` 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.
Duplicated block (9 lines × 2) codex-rs/app-server/src/request_processors/plugins.rs:1546— codex-rs/app-server/src/request_processors/plugins.rs:1546-1554 | codex-rs/app-server/src/request_processors/plugins.rs:1644-1652 — both copies are in the same file, so extract the 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.
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:524-532 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (9 lines × 2) codex-rs/cloud-tasks-client/src/http.rs:812— codex-rs/cloud-tasks-client/src/http.rs:812-820 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/cloud-tasks-client/src/http.rs:812` 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.
Duplicated block (9 lines × 2) codex-rs/cloud-tasks/src/lib.rs:723— codex-rs/cloud-tasks/src/lib.rs:723-731 | codex-rs/cloud-tasks/src/lib.rs:784-792 — both copies are in the same file, so extract the 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 `codex-rs/cloud-tasks/src/lib.rs:723` 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.
Duplicated block (9 lines × 2) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:146— codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:146-154 | codex-rs/codex-api/src/endpoint/responses_websocket.rs:142-150 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:146` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 2) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:1211— codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:1211-1219 | codex-rs/codex-api/src/endpoint/responses_websocket.rs:611-619 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (9 lines × 2) codex-rs/codex-api/src/endpoint/session.rs:98— codex-rs/codex-api/src/endpoint/session.rs:98-106 | codex-rs/codex-api/src/endpoint/session.rs:139-147 — both copies are in the same file, so extract the 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 `codex-rs/codex-api/src/endpoint/session.rs:98` 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.
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. 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 (9 lines × 2) codex-rs/config/src/requirements_layers/layer.rs:208— codex-rs/config/src/requirements_layers/layer.rs:208-216 | codex-rs/config/src/requirements_layers/layer.rs:225-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/config/src/requirements_layers/layer.rs:208` 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.
Duplicated block (9 lines × 2) codex-rs/core-plugins/src/loader.rs:1114— codex-rs/core-plugins/src/loader.rs:1114-1122 | codex-rs/core-plugins/src/loader.rs:1168-1176 — both copies are in the same file, so extract the 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 `codex-rs/core-plugins/src/loader.rs:1114` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (9 lines × 2) codex-rs/core-plugins/src/remote.rs:1965— codex-rs/core-plugins/src/remote.rs:1965-1973 | codex-rs/core-plugins/src/remote.rs:2060-2068 — both copies are in the same file, so extract the 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 `codex-rs/core-plugins/src/remote.rs:1965` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (9 lines × 2) codex-rs/core/src/client.rs:1999— codex-rs/core/src/client.rs:1999-2007 | codex-rs/core/src/client.rs:2221-2229 — both copies are in the same file, so extract the 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, `codex-rs/core/src/client.rs:2008` calls `http_transport` and `codex-rs/core/src/client.rs:2230` 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 (9 lines × 2) codex-rs/core/src/context_manager/normalize.rs:72— codex-rs/core/src/context_manager/normalize.rs:72-80 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core/src/context_manager/normalize.rs:72` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (9 lines × 2) codex-rs/core/src/hook_runtime/executor.rs:32— codex-rs/core/src/hook_runtime/executor.rs:32-41 | codex-rs/core/src/mcp_tool_exposure.rs:268-276 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core/src/hook_runtime/executor.rs:32` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. 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 (9 lines × 2) codex-rs/core/src/realtime_conversation.rs:1063— codex-rs/core/src/realtime_conversation.rs:1063-1071 | codex-rs/core/src/realtime_conversation.rs:1225-1233 — both copies are in the same file, so extract the 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/session/turn_context.rs:466— codex-rs/core/src/session/turn_context.rs:466-474 | codex-rs/core/src/session/turn_context.rs:898-906 — both copies are in the same file, so extract the 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/handlers/extension_tools.rs:198— codex-rs/core/src/tools/handlers/extension_tools.rs:198-206 | codex-rs/core/src/tools/handlers/extension_tools.rs:213-221 — both copies are in the same file, so extract the 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 `codex-rs/core/src/tools/handlers/extension_tools.rs:198` 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.
Duplicated block (9 lines × 2) codex-rs/exec-server-protocol/src/protocol.rs:262— codex-rs/exec-server-protocol/src/protocol.rs:262-270 | codex-rs/exec-server-protocol/src/protocol.rs:293-301 — both copies are in the same file, so extract the 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/src/lib.rs:430— codex-rs/exec/src/lib.rs:430-438 | codex-rs/exec/src/lib.rs:460-468 — both copies are in the same file, so extract the 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:400-408 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
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:523-531 — 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. 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 (9 lines × 2) codex-rs/login/src/auth/manager.rs:2536— codex-rs/login/src/auth/manager.rs:2536-2544 | codex-rs/login/src/auth/manager.rs:2577-2585 — both copies are in the same file, so extract the 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 `codex-rs/login/src/auth/manager.rs:2536` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (9 lines × 2) codex-rs/network-proxy/src/credential_broker.rs:1513— codex-rs/network-proxy/src/credential_broker.rs:1513-1521 | codex-rs/network-proxy/src/credential_broker/environment.rs:200-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/network-proxy/src/credential_broker.rs:1513` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/network-proxy/src/credential_broker.rs:1512` calls `filter`, `should_restore` and `codex-rs/network-proxy/src/credential_broker/environment.rs:199` 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/network-proxy/src/state.rs:256` 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.
Duplicated block (7 lines × 2) codex-rs/app-server/src/request_processors/apps_processor.rs:70— codex-rs/app-server/src/request_processors/apps_processor.rs:70-76 | codex-rs/app-server/src/request_processors/mcp_processor.rs:463-469 — 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/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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/apply-patch/src/seek_sequence.rs:38` 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.
Duplicated block (7 lines × 2) codex-rs/cloud-tasks-client/src/http.rs:920— codex-rs/cloud-tasks-client/src/http.rs:920-926 | codex-rs/cloud-tasks/src/util.rs:20-26 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/cloud-tasks-client/src/http.rs:920` 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.
Duplicated block (7 lines × 2) codex-rs/cloud-tasks/src/env_detect.rs:356— codex-rs/cloud-tasks/src/env_detect.rs:356-362 | codex-rs/cloud-tasks/src/env_detect.rs:394-400 — both copies are in the same file, so extract the 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 `codex-rs/cloud-tasks/src/env_detect.rs:356` 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.
Duplicated block (7 lines × 2) codex-rs/code-mode-runtime/src/runtime/value.rs:147— codex-rs/code-mode-runtime/src/runtime/value.rs:147-153 | codex-rs/code-mode-runtime/src/runtime/value.rs:271-277 — both copies are in the same file, so extract the 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 `codex-rs/code-mode-runtime/src/runtime/value.rs:147` 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.
Duplicated block (7 lines × 2) codex-rs/core/src/client.rs:2009— codex-rs/core/src/client.rs:2009-2015 | codex-rs/core/src/client.rs:2230-2236 — both copies are in the same file, so extract the 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, `codex-rs/core/src/client.rs:2008` calls `http_transport` and `codex-rs/core/src/client.rs:2229` 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 (7 lines × 2) codex-rs/core/src/session/mcp.rs:807— codex-rs/core/src/session/mcp.rs:807-813 | codex-rs/core/src/session/mod.rs:3626-3632 — 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 `codex-rs/core/src/session/mcp.rs:807` 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.
Duplicated block (7 lines × 2) codex-rs/core/src/session/mod.rs:3471— codex-rs/core/src/session/mod.rs:3471-3477 | codex-rs/core/src/session/mod.rs:3689-3695 — both copies are in the same file, so extract the 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 `codex-rs/core/src/session/mod.rs:3471` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/core/src/session/mod.rs:3688` calls `clone` and `codex-rs/core/src/session/mod.rs:3469` 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 (7 lines × 2) codex-rs/core/src/skills.rs:205— codex-rs/core/src/skills.rs:205-211 | codex-rs/core/src/skills.rs:301-309 — both copies are in the same file, so extract the 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 `codex-rs/core/src/skills.rs:205` 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.
Duplicated block (7 lines × 2) codex-rs/execpolicy/src/parser.rs:363— codex-rs/execpolicy/src/parser.rs:363-369 | codex-rs/execpolicy/src/parser.rs:421-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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/external-agent-migration/src/detect/sessions/connectors_cla.rs:210` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/external-agent-migration/src/detect/sessions/cur.rs:67` calls `path` and `codex-rs/external-agent-migration/src/detect/sessions/connectors_cla.rs:217` 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 (7 lines × 2) codex-rs/external-agent-migration/src/service.rs:602— codex-rs/external-agent-migration/src/service.rs:602-608 | codex-rs/external-agent-migration/src/service.rs:646-652 — both copies are in the same file, so extract the 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:1021-1027 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/hooks/src/engine/discovery.rs:489` 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.
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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/http-client/src/transport.rs:223` calls `is_success` and `codex-rs/http-client/src/transport.rs:183` 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 (7 lines × 2) codex-rs/network-proxy/src/http_proxy.rs:285— codex-rs/network-proxy/src/http_proxy.rs:285-291 | codex-rs/network-proxy/src/http_proxy.rs:367-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/network-proxy/src/http_proxy.rs:285` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
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:360-366 — both copies are in the same file, so extract the 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 `codex-rs/network-proxy/src/socks5.rs:250` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 2) codex-rs/network-proxy/src/socks5.rs:760— codex-rs/network-proxy/src/socks5.rs:760-766 | codex-rs/network-proxy/src/socks5.rs:849-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/network-proxy/src/socks5.rs:760` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 2) codex-rs/rmcp-client/src/oauth/ema_identity.rs:131— codex-rs/rmcp-client/src/oauth/ema_identity.rs:131-137 | codex-rs/rmcp-client/src/oauth/ema_identity.rs:183-189 — both copies are in the same file, so extract the 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:150-156 — 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:2808— codex-rs/tui/src/app_server_session.rs:2808-2814 | codex-rs/tui/src/app_server_session.rs:2858-2864 — both copies are in the same file, so extract the 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/chat_composer.rs:4377— codex-rs/tui/src/bottom_pane/chat_composer.rs:4377-4383 | codex-rs/tui/src/bottom_pane/mentions_v2/search_catalog.rs:94-100 — 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/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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/mentions_v2/render.rs:287` 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.
Duplicated block (7 lines × 2) codex-rs/tui/src/bottom_pane/textarea.rs:1499— codex-rs/tui/src/bottom_pane/textarea.rs:1499-1505 | codex-rs/tui/src/bottom_pane/textarea.rs:1570-1576 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/bottom_pane/textarea.rs:1499` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/chatwidget/plugin_catalog.rs:980` 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.
Duplicated block (7 lines × 2) codex-rs/tui/src/resume_picker.rs:634— codex-rs/tui/src/resume_picker.rs:634-640 | codex-rs/tui/src/resume_picker.rs:688-694 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
ChatWidget::submit_user_message_with_prepared_images (cognitive 107) codex-rs/tui/src/chatwidget/input_submission.rs:158— ChatWidget::submit_user_message_with_prepared_images has cognitive complexity 107 (threshold 15). Drivers by points: if/else 45 (71 pts), boolean chains 17, loops 6 (11 pts), match/switch 5 (8 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 97) codex-rs/tui/src/chatwidget/slash_dispatch.rs:783— ChatWidget::dispatch_prepared_command_with_args has cognitive complexity 97 (threshold 15). Drivers by points: if/else 30 (64 pts), match/switch 9 (23 pts), boolean chains 7, loops 1 (3 pts) (nesting depth added 50). 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.
ChatWidget::handle_server_notification (cognitive 90) codex-rs/tui/src/chatwidget/protocol.rs:4— ChatWidget::handle_server_notification has cognitive complexity 90 (threshold 15). Drivers by points: if/else 39 (72 pts), boolean chains 13, match/switch 3 (5 pts) (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.
ChatWidget::dispatch_command_from_source (cognitive 68) codex-rs/tui/src/chatwidget/slash_dispatch.rs:173— ChatWidget::dispatch_command_from_source has cognitive complexity 68 (threshold 15). Drivers by points: if/else 33 (61 pts), match/switch 3 (6 pts), boolean chains 1 (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.
ChatWidget::on_realtime_transcript_done (cognitive 66) codex-rs/tui/src/chatwidget/realtime.rs:1460— 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_key_event_with_activation_key (cognitive 62) codex-rs/tui/src/chatwidget/interaction.rs:154— ChatWidget::handle_key_event_with_activation_key has cognitive complexity 62 (threshold 15). Drivers by points: if/else 30 (43 pts), boolean chains 17, 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::handle_question_key (cognitive 57) codex-rs/tui/src/chatwidget/questions.rs:56— 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 45) codex-rs/tui/src/chatwidget/thread_usage.rs:183— ChatWidget::finish_thread_usage_refresh has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 12, 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:259— 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:453— ChatWidget::handle_turn_completed_notification has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (32 pts), boolean chains 6, 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::replay_thread_turns (cognitive 39) codex-rs/tui/src/chatwidget/replay.rs:111— ChatWidget::replay_thread_turns has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 8, 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::on_session_configured_with_display_and_fork_parent_title (cognitive 39) codex-rs/tui/src/chatwidget/session_flow.rs:68— ChatWidget::on_session_configured_with_display_and_fork_parent_title has cognitive complexity 39 (threshold 15). Drivers by points: if/else 20 (23 pts), boolean chains 15, 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::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::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:37— 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::note_realtime_user_item_started (cognitive 30) codex-rs/tui/src/chatwidget/realtime.rs:665— 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::open_reasoning_popup (cognitive 29) codex-rs/tui/src/chatwidget/model_popups.rs:516— 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::handle_command_execution_completed_now (cognitive 27) codex-rs/tui/src/chatwidget/command_lifecycle.rs:370— ChatWidget::handle_command_execution_completed_now has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (17 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::on_interrupted_turn (cognitive 27) codex-rs/tui/src/chatwidget/input_restore.rs:433— ChatWidget::on_interrupted_turn has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 1 (3 pts), match/switch 1 (3 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.
ChatWidget::on_realtime_transcript_delta (cognitive 27) codex-rs/tui/src/chatwidget/realtime.rs:1317— 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::maybe_send_next_queued_input (cognitive 26) codex-rs/tui/src/chatwidget/input_flow.rs:252— ChatWidget::maybe_send_next_queued_input has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 4, match/switch 2 (4 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.
ChatWidget::restore_thread_input_state (cognitive 26) codex-rs/tui/src/chatwidget/input_restore.rs:780— ChatWidget::restore_thread_input_state has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 9, loops 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.
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::submit_initial_user_message_if_pending (cognitive 24) codex-rs/tui/src/chatwidget/input_restore.rs:174— 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.
Duplicated block (10 lines × 2) codex-rs/app-server-daemon/src/lib.rs:510— codex-rs/app-server-daemon/src/lib.rs:510-519 | codex-rs/app-server-daemon/src/lib.rs:888-897 — both copies are in the same file, so extract the 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/src/request_processors/thread_processor.rs:3468— codex-rs/app-server/src/request_processors/thread_processor.rs:3468-3478 | codex-rs/app-server/src/request_processors/thread_processor.rs:3530-3539 — both copies are in the same file, so extract the 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 `codex-rs/app-server/src/request_processors/thread_processor.rs:3468` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (10 lines × 2) codex-rs/cli/src/doctor.rs:665— codex-rs/cli/src/doctor.rs:665-674 | codex-rs/cli/src/main.rs:2148-2157 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/cli/src/doctor/output.rs:823` 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.
Duplicated block (10 lines × 2) codex-rs/cli/src/mcp_cmd.rs:869— codex-rs/cli/src/mcp_cmd.rs:869-878 | codex-rs/cli/src/mcp_cmd.rs:926-935 — both copies are in the same file, so extract the 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 `codex-rs/cli/src/mcp_cmd.rs:869` 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.
Duplicated block (10 lines × 2) codex-rs/cli/src/plugin_cmd.rs:382— codex-rs/cli/src/plugin_cmd.rs:382-391 | codex-rs/core-plugins/src/manager.rs:3809-3818 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/cli/src/plugin_cmd.rs:382` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/core-plugins/src/manager.rs:3819` calls `as_path`, `display`, `to_string` and `codex-rs/cli/src/plugin_cmd.rs:392` 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 (10 lines × 2) codex-rs/codex-mcp/src/binding_clients.rs:108— codex-rs/codex-mcp/src/binding_clients.rs:108-117 | codex-rs/codex-mcp/src/binding_clients.rs:139-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/codex-mcp/src/binding_clients.rs:108` 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.
Duplicated block (10 lines × 2) codex-rs/codex-mcp/src/runtime.rs:843— codex-rs/codex-mcp/src/runtime.rs:843-852 | codex-rs/codex-mcp/src/runtime.rs:864-873 — both copies are in the same file, so extract the 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/config/src/diagnostics.rs:163— codex-rs/config/src/diagnostics.rs:163-172 | codex-rs/config/src/strict_config.rs:85-94 — 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 `codex-rs/config/src/diagnostics.rs:163` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (10 lines × 2) codex-rs/config/src/loader/mod.rs:468— codex-rs/config/src/loader/mod.rs:468-477 | codex-rs/config/src/loader/project_discovery.rs:19-28 — 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/context-fragments/src/fragment.rs:168— codex-rs/context-fragments/src/fragment.rs:168-177 | codex-rs/memories/write/src/rollout_input.rs:363-372 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/context-fragments/src/fragment.rs:168` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (10 lines × 2) codex-rs/core/src/client.rs:3308— codex-rs/core/src/client.rs:3308-3317 | codex-rs/core/src/client.rs:3363-3372 — both copies are in the same file, so extract the 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 `codex-rs/core/src/client.rs:3308` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
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_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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core/src/context_manager/normalize.rs:352` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core/src/tools/handlers/multi_agents/wait.rs:157` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (10 lines × 2) codex-rs/core/src/tools/handlers/request_user_input_async.rs:141— codex-rs/core/src/tools/handlers/request_user_input_async.rs:141-150 | codex-rs/core/src/tools/handlers/send_message_to_user_async.rs:94-103 — 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 `codex-rs/core/src/tools/handlers/request_user_input_async.rs:141` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/core/src/tools/handlers/request_user_input_async.rs:139` calls `Some` and `codex-rs/core/src/tools/handlers/send_message_to_user_async.rs:93` 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 (10 lines × 2) codex-rs/exec-server-cli/src/exec_server_auth.rs:261— codex-rs/exec-server-cli/src/exec_server_auth.rs:261-270 | codex-rs/model-provider/src/amazon_bedrock/auth.rs:324-333 — 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/ext/image-generation/src/extension.rs:98— codex-rs/ext/image-generation/src/extension.rs:98-107 | codex-rs/ext/web-search/src/extension.rs:137-146 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/ext/image-generation/src/extension.rs:98` 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.
Duplicated block (10 lines × 2) codex-rs/network-proxy/src/http_proxy.rs:613— codex-rs/network-proxy/src/http_proxy.rs:613-622 | codex-rs/network-proxy/src/http_proxy.rs:757-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/network-proxy/src/http_proxy.rs:613` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/network-proxy/src/http_proxy.rs:767` calls `method` and `codex-rs/network-proxy/src/http_proxy.rs:623` 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 (10 lines × 2) codex-rs/network-proxy/src/mitm.rs:505— codex-rs/network-proxy/src/mitm.rs:505-514 | codex-rs/network-proxy/src/mitm.rs:554-563 — both copies are in the same file, so extract the 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 `codex-rs/network-proxy/src/mitm.rs:505` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
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:731-740 — both copies are in the same file, so extract the 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 `codex-rs/network-proxy/src/socks5.rs:221` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/network-proxy/src/socks5.rs:220` calls `extensions` and `codex-rs/network-proxy/src/socks5.rs:730` 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 (10 lines × 2) codex-rs/otel/src/provider.rs:513— codex-rs/otel/src/provider.rs:513-522 | codex-rs/otel/src/provider.rs:599-608 — both copies are in the same file, so extract the 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:368— codex-rs/protocol/src/approvals.rs:368-377 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (10 lines × 2) codex-rs/rollout-trace/src/inference.rs:270— codex-rs/rollout-trace/src/inference.rs:270-279 | codex-rs/rollout-trace/src/inference.rs:300-309 — both copies are in the same file, so extract the 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 `codex-rs/rollout-trace/src/inference.rs:270` 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.
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.
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 15 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 35 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-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-http-client — codex-http-client: abstractness 0.08, instability 0.02, distance 0.90 — zone of pain — concrete and depended on by 47 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 12 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-utils-path — codex-utils-path: 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.12, distance 0.88 — zone of pain — concrete and depended on by 80 project(s), so it's rigid to change.
Off the main sequence: codex-attachment-store — codex-attachment-store: abstractness 0.13, instability 0.00, distance 0.88 — zone of pain — concrete and depended on by 4 project(s), so it's rigid to change.
Off the main sequence: codex-utils-model-facing-id — codex-utils-model-facing-id: abstractness 0.13, instability 0.00, distance 0.88 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Off the main sequence: codex-utils-output-truncation — codex-utils-output-truncation: abstractness 0.00, instability 0.13, distance 0.87 — zone of pain — concrete and depended on by 13 project(s), so it's rigid to change.
ChatWidget::handle_server_notification (cyclomatic 97) codex-rs/tui/src/chatwidget/protocol.rs:4— ChatWidget::handle_server_notification has cyclomatic complexity 97 (threshold 15). To reduce it, separate the cases: extract each independent 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_command_from_source (cyclomatic 93) codex-rs/tui/src/chatwidget/slash_dispatch.rs:173— 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::dispatch_prepared_command_with_args (cyclomatic 74) codex-rs/tui/src/chatwidget/slash_dispatch.rs:783— ChatWidget::dispatch_prepared_command_with_args has cyclomatic complexity 74 (threshold 15). To reduce it, separate the cases: extract each independent 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 73) codex-rs/tui/src/chatwidget/input_submission.rs:158— ChatWidget::submit_user_message_with_prepared_images has cyclomatic complexity 73 (threshold 15). To reduce it, separate the cases: extract each independent 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 47) codex-rs/tui/src/chatwidget/interaction.rs:154— ChatWidget::handle_key_event_with_activation_key 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.
ChatWidget::on_realtime_transcript_done (cyclomatic 41) codex-rs/tui/src/chatwidget/realtime.rs:1460— 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::status_line_value_for_item (cyclomatic 38) codex-rs/tui/src/chatwidget/status_surfaces.rs:749— ChatWidget::status_line_value_for_item has cyclomatic complexity 38 (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:37— 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::on_session_configured_with_display_and_fork_parent_title (cyclomatic 36) codex-rs/tui/src/chatwidget/session_flow.rs:68— ChatWidget::on_session_configured_with_display_and_fork_parent_title 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.
ChatWidget::handle_question_key (cyclomatic 32) codex-rs/tui/src/chatwidget/questions.rs:56— 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::handle_thread_item (cyclomatic 32) codex-rs/tui/src/chatwidget/replay.rs:281— ChatWidget::handle_thread_item has cyclomatic complexity 32 (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_rate_limit_snapshot_from (cyclomatic 31) codex-rs/tui/src/chatwidget/rate_limits.rs:259— ChatWidget::on_rate_limit_snapshot_from 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::finish_thread_usage_refresh (cyclomatic 30) codex-rs/tui/src/chatwidget/thread_usage.rs:183— ChatWidget::finish_thread_usage_refresh 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 26) codex-rs/tui/src/chatwidget/replay.rs:111— ChatWidget::replay_thread_turns 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::handle_turn_completed_notification (cyclomatic 25) codex-rs/tui/src/chatwidget/protocol.rs:453— ChatWidget::handle_turn_completed_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.
ChatWidget::handle_item_started_notification (cyclomatic 24) codex-rs/tui/src/chatwidget/protocol.rs:582— ChatWidget::handle_item_started_notification 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.
ChatWidget::on_realtime_transcript_delta (cyclomatic 23) codex-rs/tui/src/chatwidget/realtime.rs:1317— 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::handle_command_execution_completed_now (cyclomatic 21) codex-rs/tui/src/chatwidget/command_lifecycle.rs:370— ChatWidget::handle_command_execution_completed_now 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:665— 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:977— 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:520— 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:1763— 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.
TooManyFields: ChatWidget codex-rs/tui/src/chatwidget.rs:533— TooManyFields — 194 stored fields beside 1060 methods. The bar is 30 stored fields; this is 164 over it, 6.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: Config codex-rs/core/src/config/mod.rs:639— TooManyFields — 169 stored fields beside 50 methods. The bar is 30 stored fields; this is 139 over it, 5.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: App codex-rs/tui/src/app.rs:556— TooManyFields — 115 stored fields beside 597 methods. The bar is 30 stored fields; this is 85 over it, 3.83× 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:167— TooManyFields — 107 stored fields beside 3 methods. The bar is 30 stored fields; this is 77 over it, 3.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: CodexTurnEventParams codex-rs/analytics/src/events.rs:1128— TooManyFields — 68 stored fields. The bar is 30 stored fields; this is 38 over it, 2.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: PickerState codex-rs/tui/src/resume_picker.rs:1124— TooManyFields — 51 stored fields beside 54 methods. The bar is 30 stored fields; this is 21 over it, 1.70× 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:632— TooManyFields — 50 stored fields beside 294 methods. The bar is 30 stored fields; this is 20 over it, 1.67× 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:510— TooManyFields — 49 stored fields. 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: ModelInfo codex-rs/protocol/src/openai_models.rs:428— 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: ConfigRequirementsToml codex-rs/config/src/config_requirements.rs:1182— TooManyFields — 46 stored fields beside 5 methods. The bar is 30 stored fields; this is 16 over it, 1.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: ConfigRequirementsWithSources codex-rs/config/src/config_requirements.rs:1346— TooManyFields — 46 stored fields beside 3 methods. The bar is 30 stored fields; this is 16 over it, 1.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: SessionServices codex-rs/core/src/state/service.rs:52— TooManyFields — 46 stored fields beside 2 methods. The bar is 30 stored fields; this is 16 over it, 1.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: 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: RealtimeConversationUiState codex-rs/tui/src/chatwidget/realtime.rs:140— TooManyFields — 44 stored fields beside 1 method. 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: TurnContext codex-rs/core/src/session/turn_context.rs:346— TooManyFields — 41 stored fields beside 30 methods. The bar is 30 stored fields; this is 11 over it, 1.37× 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:135— TooManyFields — 38 stored fields beside 4 methods. 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: ThreadRow codex-rs/state/src/model/thread_metadata.rs:354— 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: Writer codex-rs/tui/src/markdown_render.rs:508— TooManyFields — 37 stored fields beside 79 methods. 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:168— TooManyFields — 37 stored fields beside 4 methods. 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: GuardianReviewEventParams codex-rs/analytics/src/events.rs:412— 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: StoredThread codex-rs/thread-store/src/types.rs:661— 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: Session codex-rs/core/src/session/session.rs:73— TooManyFields — 36 stored fields beside 330 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: TranscriptView codex-rs/tui/src/transcript_view.rs:92— TooManyFields — 36 stored fields beside 183 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: AgentsOverviewState codex-rs/tui/src/app/agents_overview.rs:41— 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: ThreadMetadata codex-rs/state/src/model/thread_metadata.rs:126— 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.
Duplicated block (12 lines × 2) codex-rs/app-server/src/request_processors/turn_processor.rs:708— codex-rs/app-server/src/request_processors/turn_processor.rs:708-719 | codex-rs/app-server/src/request_processors/turn_processor.rs:1034-1045 — both copies are in the same file, so extract the 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 `codex-rs/app-server/src/request_processors/turn_processor.rs:708` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 2) codex-rs/code-mode-runtime/src/runtime/callbacks.rs:85— codex-rs/code-mode-runtime/src/runtime/callbacks.rs:85-96 | codex-rs/code-mode-runtime/src/runtime/callbacks.rs:285-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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/codex-api/src/endpoint/realtime_websocket/protocol_v2.rs:146` 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.
Duplicated block (12 lines × 2) codex-rs/config/src/marketplace_edit.rs:142— codex-rs/config/src/marketplace_edit.rs:142-153 | codex-rs/config/src/marketplace_edit.rs:158-169 — both copies are in the same file, so extract the 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 `codex-rs/config/src/marketplace_edit.rs:158` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/config/src/marketplace_edit.rs:141` calls `Table` and `codex-rs/config/src/marketplace_edit.rs:157` 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 (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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) codex-rs/core-plugins/src/remote/share/checkout.rs:461— codex-rs/core-plugins/src/remote/share/checkout.rs:461-472 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) codex-rs/core/src/hook_runtime.rs:555— codex-rs/core/src/hook_runtime.rs:555-566 | codex-rs/core/src/hook_runtime.rs:597-608 — both copies are in the same file, so extract the 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 `codex-rs/core/src/hook_runtime.rs:555` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 2) codex-rs/core/src/tools/orchestrator.rs:174— codex-rs/core/src/tools/orchestrator.rs:174-185 | codex-rs/core/src/tools/orchestrator.rs:210-221 — both copies are in the same file, so extract the 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 `codex-rs/core/src/tools/orchestrator.rs:174` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/core/src/tools/orchestrator.rs:222` calls `clone` and `codex-rs/core/src/tools/orchestrator.rs:186` 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 (12 lines × 2) codex-rs/exec-server/src/client/network_policy_audit.rs:60— codex-rs/exec-server/src/client/network_policy_audit.rs:60-71 | codex-rs/network-proxy/src/network_policy.rs:295-306 — 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/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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/ext/goal/src/api.rs:224` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/hooks/src/events/compact.rs:280` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/hooks/src/events/stop.rs:287` calls `Some` and `codex-rs/hooks/src/events/compact.rs:292` 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 (12 lines × 2) codex-rs/rollout-trace/src/reducer/conversation.rs:274— codex-rs/rollout-trace/src/reducer/conversation.rs:274-285 | codex-rs/rollout-trace/src/reducer/conversation.rs:294-305 — both copies are in the same file, so extract the 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 `codex-rs/rollout-trace/src/reducer/conversation.rs:274` 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.
Duplicated block (12 lines × 2) codex-rs/rollout/src/list.rs:1145— codex-rs/rollout/src/list.rs:1145-1156 | codex-rs/rollout/src/list.rs:1240-1251 — both copies are in the same file, so extract the 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 `codex-rs/rollout/src/list.rs:1145` 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.
Duplicated block (12 lines × 2) codex-rs/rollout/src/metadata.rs:78— codex-rs/rollout/src/metadata.rs:78-89 | codex-rs/rollout/src/metadata.rs:176-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 (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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/utils/absolute-path/src/absolutize.rs:40` calls `as_os_str`, `is_empty`, `from` and `codex-rs/skills/src/interface.rs:163` 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 (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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
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:139-150 — 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 `codex-rs/thread-store/src/local/archive_thread.rs:103` 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.
Duplicated block (12 lines × 2) codex-rs/tui/src/analytics/chats.rs:83— codex-rs/tui/src/analytics/chats.rs:83-94 | codex-rs/tui/src/analytics/tasks.rs:161-172 — 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 `codex-rs/tui/src/analytics/chats.rs:83` 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.
Duplicated block (12 lines × 2) codex-rs/tui/src/app/agents_overview_new.rs:284— codex-rs/tui/src/app/agents_overview_new.rs:284-295 | codex-rs/tui/src/app/managed_worktree_creation.rs:169-180 — 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 `codex-rs/tui/src/app/agents_overview_new.rs:284` 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.
Duplicated block (12 lines × 2) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:816— codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:816-827 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:544-555 — 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 6 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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:816` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (12 lines × 2) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:926— codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:926-937 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:403-414 — 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 6 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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:926` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/pending_input_preview.rs:108` 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.
Duplicated block (12 lines × 2) codex-rs/tui/src/chatwidget/realtime.rs:1473— codex-rs/tui/src/chatwidget/realtime.rs:1473-1484 | codex-rs/tui/src/chatwidget/realtime.rs:1639-1650 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/chatwidget/realtime.rs:1473` 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.
Duplicated block (6 lines × 2) codex-rs/app-server-client/src/lib.rs:751— codex-rs/app-server-client/src/lib.rs:751-756 | codex-rs/app-server-client/src/lib.rs:848-853 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (6 lines × 2) codex-rs/app-server-client/src/lib.rs:763— codex-rs/app-server-client/src/lib.rs:763-768 | codex-rs/app-server-client/src/lib.rs:860-865 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (6 lines × 2) codex-rs/app-server/src/request_processors/turn_processor.rs:196— codex-rs/app-server/src/request_processors/turn_processor.rs:196-201 | codex-rs/app-server/src/request_processors/turn_processor.rs:420-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 (6 lines × 2) codex-rs/cli/src/mcp_cmd.rs:1090— codex-rs/cli/src/mcp_cmd.rs:1090-1095 | codex-rs/cli/src/mcp_cmd.rs:1103-1108 — both copies are in the same file, so extract the 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 `codex-rs/cli/src/mcp_cmd.rs:1090` 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.
Duplicated block (6 lines × 2) codex-rs/cloud-tasks/src/lib.rs:1401— codex-rs/cloud-tasks/src/lib.rs:1401-1406 | codex-rs/cloud-tasks/src/lib.rs:1873-1878 — both copies are in the same file, so extract the 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 `codex-rs/cloud-tasks/src/lib.rs:1401` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (6 lines × 2) codex-rs/code-mode/src/grpc_session/mod.rs:497— codex-rs/code-mode/src/grpc_session/mod.rs:497-502 | codex-rs/code-mode/src/remote_session.rs:419-424 — 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/config/src/config_requirements.rs:1681— codex-rs/config/src/config_requirements.rs:1681-1686 | codex-rs/config/src/config_requirements.rs:1703-1708 — both copies are in the same file, so extract the 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/core/src/agent/control/user_authorization.rs:85— codex-rs/core/src/agent/control/user_authorization.rs:85-91 | codex-rs/core/src/context_manager/history_user_authorization.rs:58-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core/src/agent/control/user_authorization.rs:85` 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. 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 (6 lines × 2) codex-rs/core/src/config/auth_keyring.rs:52— codex-rs/core/src/config/auth_keyring.rs:52-57 | codex-rs/core/src/config/mod.rs:4240-4245 — 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 `codex-rs/core/src/config/auth_keyring.rs:52` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/core/src/config/auth_keyring.rs:51` calls `into_vec` and `codex-rs/core/src/config/mod.rs:4239` 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 (6 lines × 2) codex-rs/git-utils/src/info.rs:401— codex-rs/git-utils/src/info.rs:401-408 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/git-utils/src/info.rs:401` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/chat_composer/slash_input.rs:284` 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.
Duplicated block (6 lines × 2) codex-rs/tui/src/markdown_render/inline_directives.rs:187— codex-rs/tui/src/markdown_render/inline_directives.rs:187-192 | codex-rs/tui/src/markdown_render/math.rs:285-290 — before extracting anything, compare `codex-rs/tui/src/markdown_render/inline_directives.rs` and `codex-rs/tui/src/markdown_render/math.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 40 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/tui/src/transcript_view/mutations.rs:46— codex-rs/tui/src/transcript_view/mutations.rs:46-51 | codex-rs/tui/src/transcript_view/mutations.rs:94-100 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/transcript_view/mutations.rs:46` 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.
Duplicated block (6 lines × 2) codex-rs/backend-client/src/client.rs:539— codex-rs/backend-client/src/client.rs:539-544 | codex-rs/backend-client/src/client/rate_limit_resets.rs:86-91 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/backend-client/src/client.rs:539` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (6 lines × 2) codex-rs/cli/src/doctor.rs:3114— codex-rs/cli/src/doctor.rs:3114-3119 | codex-rs/cli/src/doctor/background.rs:113-118 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/cli/src/doctor.rs:3114` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (6 lines × 2) codex-rs/http-client/src/lib.rs:105— codex-rs/http-client/src/lib.rs:105-110 | codex-rs/rmcp-client/src/ema_auth_policy.rs:306-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 (6 lines × 2) codex-rs/login/src/auth/storage.rs:290— codex-rs/login/src/auth/storage.rs:290-295 | codex-rs/utils/path-utils/src/lib.rs:167-172 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/login/src/auth/storage.rs:290` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (6 lines × 2) codex-rs/rollout/src/list.rs:1477— codex-rs/rollout/src/list.rs:1477-1482 | codex-rs/rollout/src/rollout_reference_index.rs:96-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/rollout/src/list.rs:1477` 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.
Duplicated block (6 lines × 2) codex-rs/tui/src/tui.rs:1533— codex-rs/tui/src/tui.rs:1533-1538 | codex-rs/tui/src/tui.rs:1557-1562 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/tui.rs:1533` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
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:143— codex-rs/app-server/src/request_processors/account_processor/bedrock_setup.rs:143-148 | codex-rs/exec-server/src/environment.rs:692-697 — 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:241-246 — 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:968— codex-rs/core-plugins/src/marketplace.rs:968-973 | 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:2167— codex-rs/core-plugins/src/remote.rs:2167-2172 | codex-rs/core/src/config/mod.rs:5321-5326 — 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:905— codex-rs/core/src/mcp_tool_call.rs:905-910 | 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.
codex_core::session::turn::try_run_sampling_request (cyclomatic 130) codex-rs/core/src/session/turn.rs:2869— codex_core::session::turn::try_run_sampling_request has cyclomatic complexity 130 (threshold 15). To reduce it, separate the cases: extract each independent 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 73) codex-rs/core/src/session/turn.rs:217— codex_core::session::turn::run_turn has cyclomatic complexity 73 (threshold 15). To reduce it, separate the cases: extract each independent 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 61) codex-rs/core/src/session/handlers.rs:520— codex_core::session::handlers::submission_loop has cyclomatic complexity 61 (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::agent::history::prepare_forked_history (cyclomatic 55) codex-rs/core/src/agent/history.rs:192— codex_core::agent::history::prepare_forked_history 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.
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 45) codex-rs/core/src/shell_snapshot.rs:578— codex_core::shell_snapshot::capture_snapshot has cyclomatic complexity 45 (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::session::mcp::review_guardian_mcp_elicitation (cyclomatic 36) codex-rs/core/src/session/mcp.rs:1007— codex_core::session::mcp::review_guardian_mcp_elicitation 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_core::guardian::review_session::run_review_on_session (cyclomatic 32) codex-rs/core/src/guardian/review_session.rs:234— codex_core::guardian::review_session::run_review_on_session 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.
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::client::map_response_events (cyclomatic 28) codex-rs/core/src/client.rs:2788— codex_core::client::map_response_events 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_core::guardian::recorded_tool_call::review_tool_call (cyclomatic 28) codex-rs/core/src/guardian/recorded_tool_call.rs:40— codex_core::guardian::recorded_tool_call::review_tool_call 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::realtime_conversation::handle_handoff_output (cyclomatic 28) codex-rs/core/src/realtime_conversation.rs:2648— 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::context_manager::media_availability::replace_unresolvable_media_files (cyclomatic 26) codex-rs/core/src/context_manager/media_availability.rs:22— codex_core::context_manager::media_availability::replace_unresolvable_media_files 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_core::guardian::input_budget::finalize (cyclomatic 26) codex-rs/core/src/guardian/input_budget.rs:162— codex_core::guardian::input_budget::finalize 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.
codex_core::compact_remote_v2::select_retained_items (cyclomatic 25) codex-rs/core/src/compact_remote_v2.rs:662— codex_core::compact_remote_v2::select_retained_items 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_core::realtime_context::build_current_thread_section (cyclomatic 24) codex-rs/core/src/realtime_context.rs:214— 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:2864— 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::realtime_conversation::build_realtime_session_config (cyclomatic 23) codex-rs/core/src/realtime_conversation.rs:1692— codex_core::realtime_conversation::build_realtime_session_config 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.
codex_core::realtime_conversation::sideband::spawn_webrtc_sideband_input_task (cyclomatic 22) codex-rs/core/src/realtime_conversation/sideband.rs:30— codex_core::realtime_conversation::sideband::spawn_webrtc_sideband_input_task 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_core::exec::consume_output (cyclomatic 21) codex-rs/core/src/exec.rs:986— 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::prepare_realtime_start (cyclomatic 21) codex-rs/core/src/realtime_conversation.rs:1472— codex_core::realtime_conversation::prepare_realtime_start 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::model_search::resolve (cyclomatic 19) codex-rs/core/src/model_search.rs:303— codex_core::model_search::resolve 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_core::session::step_activation::check_legacy_model_safety (cyclomatic 19) codex-rs/core/src/session/step_activation.rs:90— 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:386— 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:74— 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.
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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (14 lines × 2) codex-rs/app-server-transport/src/transport/remote_control/mod.rs:496— codex-rs/app-server-transport/src/transport/remote_control/mod.rs:496-509 | codex-rs/app-server-transport/src/transport/remote_control/mod.rs:739-752 — both copies are in the same file, so extract the 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 `codex-rs/app-server-transport/src/transport/remote_control/mod.rs:496` 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.
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:430-443 — 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 8 separate duplicated blocks between them, totalling at least 140 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server/src/command_exec.rs:389` 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.
Duplicated block (14 lines × 2) codex-rs/app-server/src/request_processors/catalog_processor.rs:32— codex-rs/app-server/src/request_processors/catalog_processor.rs:32-45 | codex-rs/app-server/src/request_processors/plugins.rs:79-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server/src/request_processors/catalog_processor.rs:32` 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.
Duplicated block (14 lines × 2) codex-rs/app-server/src/request_processors/thread_processor.rs:1319— codex-rs/app-server/src/request_processors/thread_processor.rs:1319-1332 | codex-rs/app-server/src/request_processors/thread_processor.rs:2069-2082 — both copies are in the same file, so extract the 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 `codex-rs/app-server/src/request_processors/thread_processor.rs:1319` 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.
Duplicated block (14 lines × 2) codex-rs/cli/src/doctor.rs:2990— codex-rs/cli/src/doctor.rs:2990-3003 | codex-rs/cli/src/doctor.rs:3016-3029 — both copies are in the same file, so extract the 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 `codex-rs/cli/src/doctor.rs:2990` 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.
Duplicated block (14 lines × 2) codex-rs/cli/src/plugin_cmd.rs:393— codex-rs/cli/src/plugin_cmd.rs:393-406 | codex-rs/core-plugins/src/manager.rs:3821-3834 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/cli/src/plugin_cmd.rs:393` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/core-plugins/src/manager.rs:3819` calls `as_path`, `display`, `to_string` and `codex-rs/cli/src/plugin_cmd.rs:391` does not — after which the two agree again for 3 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 (14 lines × 2) codex-rs/config/src/loader/mod.rs:1868— codex-rs/config/src/loader/mod.rs:1868-1881 | codex-rs/ext/skills/src/host_roots.rs:426-439 — 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:2253— codex-rs/core-plugins/src/manager.rs:2253-2266 | codex-rs/core-plugins/src/manager.rs:2328-2341 — both copies are in the same file, so extract the 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 `codex-rs/core-plugins/src/manager.rs:2253` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (14 lines × 2) codex-rs/core/src/client.rs:3323— codex-rs/core/src/client.rs:3323-3336 | codex-rs/core/src/client.rs:3378-3391 — both copies are in the same file, so extract the 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 `codex-rs/core/src/client.rs:3323` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `error` to `&ApiError` in one and `Option<&ApiError>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (14 lines × 2) codex-rs/core/src/image_preparation.rs:347— codex-rs/core/src/image_preparation.rs:347-360 | codex-rs/core/src/image_preparation.rs:388-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core/src/image_preparation.rs:347` 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.
Duplicated block (14 lines × 2) codex-rs/exec/src/event_processor_with_human_output.rs:510— codex-rs/exec/src/event_processor_with_human_output.rs:510-523 | codex-rs/exec/src/event_processor_with_jsonl_output.rs:391-404 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (14 lines × 2) codex-rs/exec/src/event_processor_with_jsonl_output.rs:431— codex-rs/exec/src/event_processor_with_jsonl_output.rs:431-444 | codex-rs/exec/src/event_processor_with_jsonl_output.rs:463-476 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
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 91 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/external-agent-migration/src/detect/sessions/cla.rs:26` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/hooks/src/events/session_start.rs:229` 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.
Duplicated block (14 lines × 2) codex-rs/rmcp-client/src/oauth.rs:1274— codex-rs/rmcp-client/src/oauth.rs:1274-1287 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/shell-command/src/parse_command.rs:2516` 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.
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:144-157 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `params` to `CreateThreadParams` in one and `ResumeThreadParams` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (14 lines × 2) codex-rs/thread-store/src/local/update_thread_metadata.rs:784— codex-rs/thread-store/src/local/update_thread_metadata.rs:784-797 | codex-rs/thread-store/src/thread_metadata_sync.rs:430-443 — 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:950— codex-rs/tui/src/app/config_persistence.rs:950-963 | codex-rs/tui/src/app/config_persistence.rs:1354-1367 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/app/config_persistence.rs:950` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
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 6 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. 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (14 lines × 2) codex-rs/tui/src/daemon_recovery.rs:89— codex-rs/tui/src/daemon_recovery.rs:89-102 | codex-rs/tui/src/startup_hooks_review.rs:120-133 — 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/tui/src/history_cell/session.rs:352— codex-rs/tui/src/history_cell/session.rs:352-365 | codex-rs/tui/src/status/helpers.rs:149-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/history_cell/session.rs:352` 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.
Duplicated block (11 lines × 2) codex-rs/app-server-daemon/src/backend/pid.rs:670— codex-rs/app-server-daemon/src/backend/pid.rs:670-680 | codex-rs/app-server-daemon/src/lib.rs:1267-1277 — 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. 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 first that the copies are not typed on the same thing: the declarations holding them bind `file` to `&fs::File` in one and `&tokio::fs::File` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (11 lines × 2) codex-rs/app-server-protocol/src/export.rs:2063— codex-rs/app-server-protocol/src/export.rs:2063-2073 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
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:1128-1138 — 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 `codex-rs/app-server-protocol/src/protocol/event_mapping.rs:109` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1279— codex-rs/app-server-protocol/src/protocol/thread_history.rs:1279-1289 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:1325-1335 — both copies are in the same file, so extract the 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 `codex-rs/app-server-protocol/src/protocol/thread_history.rs:1279` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `payload` to `&codex_protocol::protocol::CollabCloseBeginEvent` in one and `&codex_protocol::protocol::CollabResumeBeginEvent` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (11 lines × 2) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1306— codex-rs/app-server-protocol/src/protocol/thread_history.rs:1306-1316 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:1355-1365 — both copies are in the same file, so extract the 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 `codex-rs/app-server-protocol/src/protocol/thread_history.rs:1306` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `payload` to `&codex_protocol::protocol::CollabCloseEndEvent` in one and `&codex_protocol::protocol::CollabResumeEndEvent` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (11 lines × 2) codex-rs/app-server-protocol/src/protocol/v2/thread_data.rs:471— codex-rs/app-server-protocol/src/protocol/v2/thread_data.rs:471-481 | codex-rs/protocol/src/protocol.rs:2324-2334 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server/src/external_agent_migration/processor.rs:746` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (11 lines × 2) codex-rs/app-server/src/fuzzy_file_search.rs:59— codex-rs/app-server/src/fuzzy_file_search.rs:59-69 | codex-rs/app-server/src/fuzzy_file_search.rs:234-244 — both copies are in the same file, so extract the 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 `codex-rs/app-server/src/fuzzy_file_search.rs:59` 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.
Duplicated block (11 lines × 2) codex-rs/app-server/src/request_processors/catalog_processor.rs:333— codex-rs/app-server/src/request_processors/catalog_processor.rs:333-343 | codex-rs/app-server/src/request_processors/catalog_processor.rs:513-523 — both copies are in the same file, so extract the 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 `codex-rs/app-server/src/request_processors/catalog_processor.rs:333` 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.
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. Note first that the copies are not typed on the same thing: the declarations holding them bind `params` to `ThreadGoalSetParams` in one and `ThreadGoalClearParams` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (11 lines × 2) codex-rs/app-server/src/request_processors/thread_processor.rs:1221— codex-rs/app-server/src/request_processors/thread_processor.rs:1221-1231 | codex-rs/app-server/src/request_processors/turn_processor.rs:1590-1600 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (11 lines × 2) codex-rs/code-mode-host/src/peer.rs:437— codex-rs/code-mode-host/src/peer.rs:437-447 | codex-rs/code-mode-host/src/peer.rs:469-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 (11 lines × 2) codex-rs/core-plugins/src/manager.rs:968— codex-rs/core-plugins/src/manager.rs:968-978 | codex-rs/core-plugins/src/manager.rs:999-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. 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core/src/tools/handlers/multi_agents/close_agent.rs:87` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
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:382-392 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/ext/memories/src/tools/mod.rs:63` 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.
Duplicated block (11 lines × 2) codex-rs/ext/skills/src/loader/metadata.rs:111— codex-rs/ext/skills/src/loader/metadata.rs:111-121 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/hooks/src/events/post_tool_use.rs:89` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `PostToolUseRequest` in one and `PreToolUseRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (11 lines × 2) codex-rs/model-provider/src/shared_state.rs:150— codex-rs/model-provider/src/shared_state.rs:150-160 | codex-rs/model-provider/src/shared_state.rs:174-184 — both copies are in the same file, so extract the 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 `codex-rs/model-provider/src/shared_state.rs:150` 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.
Duplicated block (11 lines × 2) codex-rs/otel/src/events/session_telemetry.rs:857— codex-rs/otel/src/events/session_telemetry.rs:857-867 | codex-rs/otel/src/events/session_telemetry.rs:924-934 — both copies are in the same file, so extract the 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 `codex-rs/otel/src/events/session_telemetry.rs:857` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (11 lines × 2) codex-rs/rmcp-client/src/ema_http_client.rs:300— codex-rs/rmcp-client/src/ema_http_client.rs:300-310 | codex-rs/rmcp-client/src/ema_http_client.rs:329-339 — both copies are in the same file, so extract the 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 `codex-rs/rmcp-client/src/ema_http_client.rs:300` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/state/src/runtime/thread_attachments.rs:89` 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.
Duplicated block (11 lines × 2) codex-rs/thread-store/src/local/rollout_migration.rs:929— codex-rs/thread-store/src/local/rollout_migration.rs:929-939 | codex-rs/thread-store/src/local/rollout_migration.rs:974-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 (11 lines × 2) codex-rs/tui/src/bottom_pane/custom_prompt_view.rs:205— codex-rs/tui/src/bottom_pane/custom_prompt_view.rs:205-215 | codex-rs/tui/src/bottom_pane/feedback_note_view.rs:167-177 — 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 `codex-rs/tui/src/bottom_pane/custom_prompt_view.rs:205` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/tui/src/bottom_pane/custom_prompt_view.rs:217` calls `is_some_and`, `text` and `codex-rs/tui/src/bottom_pane/feedback_note_view.rs:178` does not — after which the two agree again for 3 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 (11 lines × 2) codex-rs/tui/src/bottom_pane/multi_select_picker.rs:361— codex-rs/tui/src/bottom_pane/multi_select_picker.rs:361-371 | codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:167-177 — 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 99 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.
+ 10 more in this group — see findings.md.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×33
Edited copy of a member (11 corresponding lines) codex-rs/windows-sandbox-rs/src/setup_error.rs:182— codex-rs/windows-sandbox-rs/src/setup_error.rs:182-192 | codex-rs/worktree/src/metadata.rs:29-47 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/tui/src/thread_transcript/computer_groups.rs:21— codex-rs/tui/src/thread_transcript/computer_groups.rs:21-31 | codex-rs/tui/src/thread_transcript/exploration_groups.rs:14-25 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/context-fragments/src/fragment.rs:163— codex-rs/context-fragments/src/fragment.rs:163-177 | codex-rs/memories/write/src/rollout_input.rs:362-372 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/login/src/auth/manager.rs:581— codex-rs/login/src/auth/manager.rs:581-591 | codex-rs/login/src/auth/manager.rs:594-605 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/core/src/unified_exec/process_manager.rs:519— codex-rs/core/src/unified_exec/process_manager.rs:519-531 | codex-rs/core/src/unified_exec/process_manager.rs:892-902 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/ext/guardian-v2/src/sync_reviewer/mod.rs:246— codex-rs/ext/guardian-v2/src/sync_reviewer/mod.rs:246-256 | codex-rs/ext/guardian-v2/src/sync_reviewer/mod.rs:257-267 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/tui/src/app/background_requests.rs:590— codex-rs/tui/src/app/background_requests.rs:590-600 | codex-rs/tui/src/app/background_requests.rs:606-616 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/backend-client/src/client/rate_limit_resets.rs:72— codex-rs/backend-client/src/client/rate_limit_resets.rs:72-82 | codex-rs/backend-client/src/client/rate_limit_resets.rs:114-126 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/tui/src/onboarding/auth.rs:374— codex-rs/tui/src/onboarding/auth.rs:374-384 | codex-rs/tui/src/onboarding/auth.rs:390-400 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/tui/src/resume_picker.rs:3596— codex-rs/tui/src/resume_picker.rs:3596-3606 | codex-rs/tui/src/style.rs:102-112 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/cli/src/doctor/output.rs:676— codex-rs/cli/src/doctor/output.rs:676-686 | codex-rs/cli/src/doctor/output.rs:761-771 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/rmcp-client/src/elicitation_client_service.rs:366— codex-rs/rmcp-client/src/elicitation_client_service.rs:366-376 | codex-rs/rmcp-client/src/elicitation_client_service.rs:380-391 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/ollama/src/line_buffer.rs:17— codex-rs/ollama/src/line_buffer.rs:17-27 | codex-rs/rmcp-client/src/executor_process_transport.rs:120-131 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/login/src/auth/storage_telemetry.rs:78— codex-rs/login/src/auth/storage_telemetry.rs:78-88 | codex-rs/login/src/auth/storage_telemetry.rs:90-100 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/thread-store/src/local/thread_history/read.rs:281— codex-rs/thread-store/src/local/thread_history/read.rs:281-291 | codex-rs/thread-store/src/local/thread_history/search.rs:287-300 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/cloud-tasks-client/src/http.rs:919— codex-rs/cloud-tasks-client/src/http.rs:919-929 | codex-rs/cloud-tasks/src/util.rs:19-29 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/utils/cache/src/lib.rs:35— codex-rs/utils/cache/src/lib.rs:35-46 | codex-rs/utils/cache/src/lib.rs:56-66 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/tui/src/streaming/controller.rs:635— codex-rs/tui/src/streaming/controller.rs:635-645 | codex-rs/tui/src/streaming/controller.rs:786-796 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/state/src/runtime/threads.rs:810— codex-rs/state/src/runtime/threads.rs:810-820 | codex-rs/state/src/runtime/threads.rs:851-871 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1050— codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1050-1060 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:764-774 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/protocol/src/approvals.rs:365— codex-rs/protocol/src/approvals.rs:365-377 | codex-rs/tui/src/approval_events.rs:56-66 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/tui/src/bottom_pane/view_stack.rs:33— codex-rs/tui/src/bottom_pane/view_stack.rs:33-43 | codex-rs/tui/src/bottom_pane/view_stack.rs:45-56 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/utils/pty/src/process_group.rs:123— codex-rs/utils/pty/src/process_group.rs:123-136 | codex-rs/utils/pty/src/process_group.rs:139-149 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/rmcp-client/src/rmcp_client.rs:310— codex-rs/rmcp-client/src/rmcp_client.rs:310-323 | codex-rs/rmcp-client/src/streamable_http_retry.rs:220-230 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) codex-rs/analytics/src/client.rs:634— codex-rs/analytics/src/client.rs:634-648 | codex-rs/analytics/src/client.rs:662-672 — These two members are one piece of code written twice and then edited apart: 11 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.
Duplicated block (5 lines × 2) codex-rs/codex-mcp/src/tools.rs:200— codex-rs/codex-mcp/src/tools.rs:200-204 | codex-rs/codex-mcp/src/tools.rs:223-227 — both copies are in the same file, so extract the 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 `codex-rs/codex-mcp/src/tools.rs:200` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core/src/context_manager/normalize.rs:366` 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.
Duplicated block (5 lines × 2) codex-rs/core/src/session/session.rs:288— codex-rs/core/src/session/session.rs:288-292 | codex-rs/core/src/session/session.rs:330-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 (5 lines × 2) codex-rs/model-provider/src/shared_state.rs:57— codex-rs/model-provider/src/shared_state.rs:57-61 | codex-rs/model-provider/src/shared_state.rs:89-93 — both copies are in the same file, so extract the 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 `codex-rs/model-provider/src/shared_state.rs:57` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/shell-command/src/parse_command.rs:1528` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. 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 (5 lines × 2) codex-rs/tui/src/lib.rs:1721— codex-rs/tui/src/lib.rs:1721-1725 | codex-rs/tui/src/lib.rs:1825-1829 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/lib.rs:1721` 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.
Duplicated block (5 lines × 2) codex-rs/tui/src/markdown_render.rs:2302— codex-rs/tui/src/markdown_render.rs:2302-2306 | codex-rs/tui/src/markdown_render.rs:2315-2319 — both copies are in the same file, so extract the 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:2443— codex-rs/tui/src/markdown_render.rs:2443-2448 | codex-rs/tui/src/markdown_render.rs:2498-2502 — both copies are in the same file, so extract the 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:413-417 — 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:1278— codex-rs/codex-mcp/src/runtime.rs:1278-1282 | codex-rs/connectors/src/connector_runtime/mod.rs:552-556 — 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:711— codex-rs/config/src/mcp_types.rs:711-715 | 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:77— codex-rs/tui/src/chatwidget/input_queue.rs:77-81 | codex-rs/tui/src/chatwidget/user_messages.rs:904-908 — 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:957-961 — 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/shell-command/src/shell_snapshot_literals.rs:315— codex-rs/shell-command/src/shell_snapshot_literals.rs:315-320 | codex-rs/shell-command/src/shell_snapshot_literals.rs:418-422 — both copies are in the same file, so extract the 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 `codex-rs/shell-command/src/shell_snapshot_literals.rs:315` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/ollama/src/pull.rs:65` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. 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 (5 lines × 2) codex-rs/external-agent-migration/src/service.rs:623— codex-rs/external-agent-migration/src/service.rs:623-627 | codex-rs/external-agent-migration/src/service.rs:679-683 — both copies are in the same file, so extract the 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 `codex-rs/external-agent-migration/src/service.rs:623` 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.
Duplicated block (5 lines × 2) codex-rs/core-plugins/src/marketplace_upgrade/git.rs:37— codex-rs/core-plugins/src/marketplace_upgrade/git.rs:37-41 | codex-rs/core-plugins/src/startup_sync.rs:626-630 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core-plugins/src/marketplace_upgrade/git.rs:37` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/core-plugins/src/marketplace_upgrade/git.rs:45` calls `trim` and `codex-rs/core-plugins/src/startup_sync.rs:634` 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 (5 lines × 2) codex-rs/cloud-tasks/src/ui.rs:901— codex-rs/cloud-tasks/src/ui.rs:901-905 | codex-rs/cloud-tasks/src/ui.rs:1010-1014 — both copies are in the same file, so extract the 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/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. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `SessionStartRequest` in one and `StopRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (5 lines × 2) codex-rs/linux-sandbox/src/linux_run_main.rs:919— codex-rs/linux-sandbox/src/linux_run_main.rs:919-923 | codex-rs/linux-sandbox/src/linux_run_main.rs:954-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/linux-sandbox/src/linux_run_main.rs:919` 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.
Duplicated block (5 lines × 2) codex-rs/app-server-protocol/src/export.rs:1805— codex-rs/app-server-protocol/src/export.rs:1805-1809 | codex-rs/app-server-protocol/src/export.rs:1811-1815 — both copies are in the same file, so extract the 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/env_detect.rs:296— codex-rs/cloud-tasks/src/env_detect.rs:296-300 | codex-rs/cloud-tasks/src/env_detect.rs:312-316 — both copies are in the same file, so extract the 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 `codex-rs/cloud-tasks/src/env_detect.rs:296` 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
+ 8 more in this group — see findings.md.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×31
Edited copy of a member (13 corresponding lines) codex-rs/cloud-tasks-client/src/http.rs:655— codex-rs/cloud-tasks-client/src/http.rs:655-667 | codex-rs/cloud-tasks/src/lib.rs:365-377 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/tui/src/thread_transcript/computer_groups.rs:38— codex-rs/tui/src/thread_transcript/computer_groups.rs:38-50 | codex-rs/tui/src/thread_transcript/exploration_groups.rs:31-43 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/git-utils/src/info.rs:393— codex-rs/git-utils/src/info.rs:393-408 | codex-rs/tui/src/branch_summary.rs:198-210 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1082— codex-rs/app-server-protocol/src/protocol/thread_history.rs:1082-1096 | codex-rs/ext/image-generation/src/tool.rs:116-128 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/tui/src/bottom_pane/mentions_v2/filter.rs:48— codex-rs/tui/src/bottom_pane/mentions_v2/filter.rs:48-60 | codex-rs/tui/src/bottom_pane/skill_popup.rs:49-66 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/code-mode/src/grpc_session/reconnect.rs:89— codex-rs/code-mode/src/grpc_session/reconnect.rs:89-101 | codex-rs/code-mode/src/grpc_session/reconnect.rs:107-119 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/exec-server/src/rpc.rs:505— codex-rs/exec-server/src/rpc.rs:505-517 | codex-rs/exec-server/src/rpc.rs:523-535 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/cli/src/debug_sandbox/pid_tracker.rs:153— codex-rs/cli/src/debug_sandbox/pid_tracker.rs:153-165 | codex-rs/cli/src/debug_sandbox/pid_tracker.rs:167-182 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/exec-server/src/local_file_system.rs:677— codex-rs/exec-server/src/local_file_system.rs:677-689 | codex-rs/exec-server/src/local_file_system.rs:696-710 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/codex-mcp/src/ema_auth.rs:248— codex-rs/codex-mcp/src/ema_auth.rs:248-260 | codex-rs/codex-mcp/src/ema_auth.rs:265-277 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/tui/src/app.rs:345— codex-rs/tui/src/app.rs:345-363 | codex-rs/tui/src/app.rs:365-377 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/code-mode/src/remote_session/connection/driver/session_registry.rs:81— codex-rs/code-mode/src/remote_session/connection/driver/session_registry.rs:81-93 | codex-rs/code-mode/src/remote_session/connection/driver/session_registry.rs:95-108 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/hooks/src/schema.rs:876— codex-rs/hooks/src/schema.rs:876-888 | codex-rs/protocol/src/config_types.rs:274-290 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/thread-store/src/local/thread_sections.rs:15— codex-rs/thread-store/src/local/thread_sections.rs:15-34 | codex-rs/thread-store/src/local/thread_sections.rs:56-68 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/tui/src/bottom_pane/textarea.rs:1252— codex-rs/tui/src/bottom_pane/textarea.rs:1252-1264 | codex-rs/tui/src/bottom_pane/textarea.rs:1266-1278 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/rmcp-client/src/oauth.rs:588— codex-rs/rmcp-client/src/oauth.rs:588-600 | codex-rs/rmcp-client/src/oauth.rs:755-770 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/tui/src/chatwidget/usage.rs:290— codex-rs/tui/src/chatwidget/usage.rs:290-302 | codex-rs/tui/src/chatwidget/usage.rs:461-474 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/tui/src/history_cell/base.rs:158— codex-rs/tui/src/history_cell/base.rs:158-170 | codex-rs/tui/src/history_cell/base.rs:179-191 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/core/src/thread_manager.rs:1683— codex-rs/core/src/thread_manager.rs:1683-1696 | codex-rs/core/src/thread_manager.rs:1706-1718 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/core/src/tools/handlers/apply_patch.rs:407— codex-rs/core/src/tools/handlers/apply_patch.rs:407-419 | codex-rs/core/src/tools/handlers/mcp.rs:560-574 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/analytics/src/reducer.rs:3681— codex-rs/analytics/src/reducer.rs:3681-3694 | codex-rs/analytics/src/reducer.rs:3696-3708 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/core/src/tools/network_approval.rs:669— codex-rs/core/src/tools/network_approval.rs:669-681 | codex-rs/core/src/tools/network_approval.rs:683-700 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/tui/src/multi_agents.rs:351— codex-rs/tui/src/multi_agents.rs:351-366 | codex-rs/tui/src/multi_agents.rs:372-384 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/app-server-protocol/src/protocol/thread_history.rs:180— codex-rs/app-server-protocol/src/protocol/thread_history.rs:180-192 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:2005-2017 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) codex-rs/core-plugins/src/marketplace.rs:871— codex-rs/core-plugins/src/marketplace.rs:871-883 | codex-rs/core-plugins/src/marketplace.rs:922-934 — These two members are one piece of code written twice and then edited apart: 13 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.
Duplicated block (13 lines × 2) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1292— codex-rs/app-server-protocol/src/protocol/thread_history.rs:1292-1304 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:1341-1353 — both copies are in the same file, so extract the 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 `codex-rs/app-server-protocol/src/protocol/thread_history.rs:1292` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `payload` to `&codex_protocol::protocol::CollabCloseEndEvent` in one and `&codex_protocol::protocol::CollabResumeEndEvent` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (13 lines × 2) codex-rs/app-server-transport/src/transport/remote_control/mod.rs:463— codex-rs/app-server-transport/src/transport/remote_control/mod.rs:463-475 | codex-rs/app-server-transport/src/transport/remote_control/mod.rs:707-719 — both copies are in the same file, so extract the 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 `codex-rs/app-server-transport/src/transport/remote_control/mod.rs:463` 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.
Duplicated block (13 lines × 2) codex-rs/app-server-transport/src/transport/remote_control/mod.rs:542— codex-rs/app-server-transport/src/transport/remote_control/mod.rs:542-554 | codex-rs/app-server-transport/src/transport/remote_control/mod.rs:771-783 — both copies are in the same file, so extract the 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 `codex-rs/app-server-transport/src/transport/remote_control/mod.rs:542` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/app-server-transport/src/transport/remote_control/mod.rs:784` calls `borrow`, `is_enabled`, `Err` and `codex-rs/app-server-transport/src/transport/remote_control/mod.rs:555` 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 (13 lines × 2) codex-rs/app-server/src/lib.rs:775— codex-rs/app-server/src/lib.rs:775-787 | codex-rs/tui/src/startup_orchestration.rs:985-997 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server/src/lib.rs:775` 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.
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:2433-2445 — 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:635— codex-rs/app-server/src/outgoing_message.rs:635-647 | codex-rs/app-server/src/outgoing_message.rs:725-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server/src/outgoing_message.rs:635` 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.
Duplicated block (13 lines × 2) codex-rs/cloud-tasks/src/env_detect.rs:60— codex-rs/cloud-tasks/src/env_detect.rs:60-72 | codex-rs/cloud-tasks/src/env_detect.rs:340-352 — both copies are in the same file, so extract the 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 `codex-rs/cloud-tasks/src/env_detect.rs:60` 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.
Duplicated block (13 lines × 2) codex-rs/core-plugins/src/marketplace_upgrade/git.rs:317— codex-rs/core-plugins/src/marketplace_upgrade/git.rs:317-329 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (13 lines × 2) codex-rs/core/src/codex_thread.rs:573— codex-rs/core/src/codex_thread.rs:573-585 | codex-rs/core/src/codex_thread.rs:644-657 — both copies are in the same file, so extract the 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 `codex-rs/core/src/codex_thread.rs:573` 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.
Duplicated block (13 lines × 2) codex-rs/core/src/realtime_conversation.rs:777— codex-rs/core/src/realtime_conversation.rs:777-789 | codex-rs/core/src/realtime_conversation.rs:857-869 — both copies are in the same file, so extract the 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 `codex-rs/core/src/realtime_conversation.rs:777` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/ext/guardian-reviewer/src/pool.rs:235` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/ext/skills/src/sources.rs:196` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `SkillReadRequest<'_>` in one and `SkillSearchRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/external-agent-migration/src/sessions/append.rs:87` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/external-agent-migration/src/sessions/append.rs:120` calls `Ok`, `acquire` and `codex-rs/external-agent-migration/src/sessions/append.rs:85` 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/external-agent-migration/src/sessions/records_cla.rs:81` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
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:23-35 — 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:864— codex-rs/protocol/src/permissions.rs:864-876 | codex-rs/protocol/src/permissions.rs:2472-2484 — both copies are in the same file, so extract the 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 `codex-rs/protocol/src/permissions.rs:864` 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.
Duplicated block (13 lines × 2) codex-rs/rmcp-client/src/rmcp_client.rs:718— codex-rs/rmcp-client/src/rmcp_client.rs:718-730 | codex-rs/rmcp-client/src/rmcp_client.rs:1981-1993 — both copies are in the same file, so extract the 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 `codex-rs/rmcp-client/src/rmcp_client.rs:718` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 2) codex-rs/rollout-trace/src/protocol_event.rs:423— codex-rs/rollout-trace/src/protocol_event.rs:423-435 | codex-rs/rollout-trace/src/protocol_event.rs:505-517 — both copies are in the same file, so extract the 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, `codex-rs/rollout-trace/src/protocol_event.rs:421` calls `TurnAborted` and `codex-rs/rollout-trace/src/protocol_event.rs:504` does not — after which the two agree again for 3 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/thread-store/src/local/list_threads.rs:31` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `params` to `ListThreadsParams` in one and `SearchThreadsParams` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/thread-store/src/local/list_threads.rs:45` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `params` to `ListThreadsParams` in one and `SearchThreadsParams` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
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. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) async fn open_thread_goal_menu( &mut` in one and `super) async fn open_thread_goal_editor( &mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (13 lines × 2) codex-rs/tui/src/bottom_pane/chat_composer.rs:4539— codex-rs/tui/src/bottom_pane/chat_composer.rs:4539-4551 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (13 lines × 2) codex-rs/utils/image/src/lib.rs:414— codex-rs/utils/image/src/lib.rs:414-426 | codex-rs/utils/image/src/lib.rs:440-452 — both copies are in the same file, so extract the 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 `codex-rs/utils/image/src/lib.rs:414` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (13 lines × 2) codex-rs/windows-sandbox-rs/src/acl.rs:120— codex-rs/windows-sandbox-rs/src/acl.rs:120-132 | codex-rs/windows-sandbox-rs/src/acl.rs:928-940 — both copies are in the same file, so extract the 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 `codex-rs/windows-sandbox-rs/src/acl.rs:120` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/windows-sandbox-rs/src/acl.rs:941` calls `is_null`, `LocalFree` and `codex-rs/windows-sandbox-rs/src/acl.rs:133` 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.
+ 6 more in this group — see findings.md.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×28
Edited copy of a member (14 corresponding lines) codex-rs/tui/src/bottom_pane/experimental_features_view.rs:450— codex-rs/tui/src/bottom_pane/experimental_features_view.rs:450-463 | codex-rs/tui/src/bottom_pane/memories_settings_view.rs:455-468 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/cli/src/doctor.rs:3102— codex-rs/cli/src/doctor.rs:3102-3119 | codex-rs/cli/src/doctor/background.rs:105-118 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/core/src/tools/handlers/extension_tools.rs:197— codex-rs/core/src/tools/handlers/extension_tools.rs:197-210 | codex-rs/core/src/tools/handlers/extension_tools.rs:212-225 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/app-server-daemon/src/backend/pid.rs:669— codex-rs/app-server-daemon/src/backend/pid.rs:669-682 | codex-rs/app-server-daemon/src/lib.rs:1266-1279 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/core-plugins/src/remote.rs:1181— codex-rs/core-plugins/src/remote.rs:1181-1195 | codex-rs/core-plugins/src/remote.rs:2448-2461 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/exec-server/src/client.rs:763— codex-rs/exec-server/src/client.rs:763-778 | codex-rs/exec-server/src/client.rs:1290-1303 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/ext/goal/src/accounting.rs:374— codex-rs/ext/goal/src/accounting.rs:374-387 | codex-rs/ext/goal/src/accounting.rs:389-402 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/core-plugins/src/remote.rs:2467— codex-rs/core-plugins/src/remote.rs:2467-2482 | codex-rs/core-plugins/src/remote_legacy.rs:252-265 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/tui/src/ide_context/ipc.rs:491— codex-rs/tui/src/ide_context/ipc.rs:491-504 | codex-rs/tui/src/ide_context/ipc.rs:509-522 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/core-plugins/src/manager.rs:1215— codex-rs/core-plugins/src/manager.rs:1215-1228 | codex-rs/core-plugins/src/manager.rs:1230-1246 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/exec-server/src/rpc.rs:1005— codex-rs/exec-server/src/rpc.rs:1005-1018 | codex-rs/exec-server/src/rpc_server_requests.rs:160-176 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/protocol/src/permissions.rs:2361— codex-rs/protocol/src/permissions.rs:2361-2380 | codex-rs/sandboxing/src/launch.rs:228-241 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/core-plugins/src/remote.rs:2279— codex-rs/core-plugins/src/remote.rs:2279-2292 | codex-rs/core-plugins/src/remote/share.rs:365-378 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/tui/src/bottom_pane/picker_rows.rs:46— codex-rs/tui/src/bottom_pane/picker_rows.rs:46-59 | codex-rs/tui/src/bottom_pane/picker_rows.rs:68-81 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/rollout-trace/src/code_cell.rs:84— codex-rs/rollout-trace/src/code_cell.rs:84-98 | codex-rs/rollout-trace/src/code_cell.rs:126-139 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/code-mode-host/src/peer.rs:94— codex-rs/code-mode-host/src/peer.rs:94-107 | codex-rs/code-mode-host/src/peer.rs:109-124 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/app-server/src/request_processors/thread_processor.rs:5123— codex-rs/app-server/src/request_processors/thread_processor.rs:5123-5136 | codex-rs/core/src/thread_manager.rs:3106-3119 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/tui/src/onboarding/onboarding_screen.rs:243— codex-rs/tui/src/onboarding/onboarding_screen.rs:243-256 | codex-rs/tui/src/onboarding/onboarding_screen.rs:258-271 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/login/src/auth/storage.rs:343— codex-rs/login/src/auth/storage.rs:343-356 | codex-rs/login/src/auth/storage.rs:460-478 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/utils/audio/src/lib.rs:93— codex-rs/utils/audio/src/lib.rs:93-106 | codex-rs/utils/audio/src/lib.rs:108-121 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/tui/src/external_agent_config_migration/model.rs:80— codex-rs/tui/src/external_agent_config_migration/model.rs:80-93 | codex-rs/tui/src/external_agent_config_migration/model.rs:97-110 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/ext/goal/src/runtime.rs:677— codex-rs/ext/goal/src/runtime.rs:677-690 | codex-rs/ext/goal/src/tool.rs:418-434 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/network-proxy/src/http_proxy.rs:104— codex-rs/network-proxy/src/http_proxy.rs:104-117 | codex-rs/network-proxy/src/socks5.rs:76-94 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) sdk/python/src/openai_codex/_login.py:30— sdk/python/src/openai_codex/_login.py:30-43 | sdk/python/src/openai_codex/_login.py:47-60 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) codex-rs/code-mode/src/grpc_session/state.rs:174— codex-rs/code-mode/src/grpc_session/state.rs:174-187 | codex-rs/code-mode/src/grpc_session/state.rs:192-205 — These two members are one piece of code written twice and then edited apart: 14 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.
+ 3 more in this group — see findings.md.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×28
Edited copy of a member (10 corresponding lines) codex-rs/exec-server/src/remote.rs:1076— codex-rs/exec-server/src/remote.rs:1076-1089 | codex-rs/message-board/src/local/json_search.rs:72-81 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) scripts/codex_package/dotslash.py:167— scripts/codex_package/dotslash.py:167-177 | scripts/codex_package/v8.py:212-221 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/core-plugins/src/command_migration.rs:328— codex-rs/core-plugins/src/command_migration.rs:328-337 | codex-rs/external-agent-migration/src/subagents.rs:189-198 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/code-mode-host/src/grpc/waits.rs:86— codex-rs/code-mode-host/src/grpc/waits.rs:86-95 | codex-rs/code-mode-host/src/grpc/waits.rs:97-106 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/exec-server/src/client/http_response_body_stream.rs:437— codex-rs/exec-server/src/client/http_response_body_stream.rs:437-446 | codex-rs/exec-server/src/client/http_response_body_stream.rs:457-467 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/tui/src/branch_summary.rs:476— codex-rs/tui/src/branch_summary.rs:476-485 | codex-rs/tui/src/branch_summary.rs:495-506 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/network-proxy/src/credential_broker/registry.rs:54— codex-rs/network-proxy/src/credential_broker/registry.rs:54-63 | codex-rs/network-proxy/src/credential_broker/registry.rs:65-75 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/core/src/context/environment_context.rs:166— codex-rs/core/src/context/environment_context.rs:166-179 | codex-rs/tui/src/bottom_pane/approval_overlay.rs:1038-1047 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/rollout-trace/src/reducer/code_cell.rs:664— codex-rs/rollout-trace/src/reducer/code_cell.rs:664-674 | codex-rs/rollout-trace/src/reducer/tool.rs:451-460 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/code-mode-runtime/src/runtime/globals.rs:118— codex-rs/code-mode-runtime/src/runtime/globals.rs:118-127 | codex-rs/code-mode-runtime/src/runtime/globals.rs:132-141 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/exec-server/src/local_file_system.rs:1185— codex-rs/exec-server/src/local_file_system.rs:1185-1194 | codex-rs/exec-server/src/no_follow/mod.rs:106-117 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/core/src/client.rs:1385— codex-rs/core/src/client.rs:1385-1394 | codex-rs/ext/guardian-v2/src/async_scorer/sampler/connection_pool.rs:456-470 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/network-proxy/src/credential_broker/providers.rs:117— codex-rs/network-proxy/src/credential_broker/providers.rs:117-126 | codex-rs/network-proxy/src/credential_broker/providers.rs:128-137 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/tui/src/app/plugin_mentions.rs:84— codex-rs/tui/src/app/plugin_mentions.rs:84-96 | codex-rs/tui/src/bottom_pane/chat_composer.rs:4523-4532 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/tui/src/bottom_pane/command_popup.rs:258— codex-rs/tui/src/bottom_pane/command_popup.rs:258-267 | codex-rs/tui/src/bottom_pane/command_popup.rs:270-280 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/protocol/src/permissions.rs:668— codex-rs/protocol/src/permissions.rs:668-677 | codex-rs/protocol/src/permissions.rs:977-988 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/app-server-client/src/remote.rs:1019— codex-rs/app-server-client/src/remote.rs:1019-1028 | codex-rs/app-server-client/src/remote.rs:1032-1041 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/code-mode-protocol/src/host/payload.rs:319— codex-rs/code-mode-protocol/src/host/payload.rs:319-330 | codex-rs/code-mode-protocol/src/host/payload.rs:334-343 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/protocol/src/permissions.rs:688— codex-rs/protocol/src/permissions.rs:688-699 | codex-rs/protocol/src/permissions/deny_read_validator.rs:93-102 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/core/src/tools/approvals.rs:177— codex-rs/core/src/tools/approvals.rs:177-186 | codex-rs/ext/guardian-reviewer/src/approval_request.rs:103-112 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/app-server/src/request_processors/feedback_doctor_report.rs:184— codex-rs/app-server/src/request_processors/feedback_doctor_report.rs:184-193 | codex-rs/external-agent-migration/src/sessions/mod.rs:189-198 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/core/src/session/input_queue.rs:98— codex-rs/core/src/session/input_queue.rs:98-107 | codex-rs/core/src/session/input_queue.rs:109-120 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/aws-auth/src/lib.rs:37— codex-rs/aws-auth/src/lib.rs:37-46 | codex-rs/login/src/auth/bedrock_access_keys.rs:22-31 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/exec-server/src/capability_discovery.rs:324— codex-rs/exec-server/src/capability_discovery.rs:324-335 | codex-rs/ext/skills/src/loader/environment.rs:310-319 — These two members are one piece of code written twice and then edited apart: 10 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.
Edited copy of a member (10 corresponding lines) codex-rs/app-server/src/request_processors/apps_processor.rs:426— codex-rs/app-server/src/request_processors/apps_processor.rs:426-435 | codex-rs/app-server/src/request_processors/apps_processor/read.rs:99-108 — These two members are one piece of code written twice and then edited apart: 10 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.
+ 3 more in this group — see findings.md.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×27
Edited copy of a member (15 corresponding lines) codex-rs/tui/src/diff_render.rs:1321— codex-rs/tui/src/diff_render.rs:1321-1335 | codex-rs/tui/src/diff_render.rs:1345-1359 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/config/src/schema.rs:289— codex-rs/config/src/schema.rs:289-303 | codex-rs/hooks/src/schema.rs:781-795 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1257— codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1257-1272 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:1060-1074 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/tui/src/bottom_pane/list_selection_view.rs:1227— codex-rs/tui/src/bottom_pane/list_selection_view.rs:1227-1244 | codex-rs/tui/src/bottom_pane/list_selection_view.rs:1246-1260 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/tui/src/bottom_pane/textarea.rs:1889— codex-rs/tui/src/bottom_pane/textarea.rs:1889-1903 | codex-rs/tui/src/bottom_pane/textarea.rs:1905-1921 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/tui/src/app/background_requests.rs:803— codex-rs/tui/src/app/background_requests.rs:803-817 | codex-rs/tui/src/app/recap.rs:144-166 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/tui/src/chatwidget/status_surfaces.rs:632— codex-rs/tui/src/chatwidget/status_surfaces.rs:632-646 | codex-rs/tui/src/chatwidget/status_surfaces.rs:648-662 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/app-server-daemon/src/backend/stderr_log.rs:108— codex-rs/app-server-daemon/src/backend/stderr_log.rs:108-122 | codex-rs/tui/src/terminal_probe.rs:143-157 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/tui/src/markdown_render.rs:1319— codex-rs/tui/src/markdown_render.rs:1319-1333 | codex-rs/tui/src/markdown_render.rs:1351-1376 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/cli/src/doctor/title.rs:208— codex-rs/cli/src/doctor/title.rs:208-224 | codex-rs/tui/src/chatwidget/status_surfaces.rs:1141-1155 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/rmcp-client/src/http_client_redirect.rs:184— codex-rs/rmcp-client/src/http_client_redirect.rs:184-198 | codex-rs/rmcp-client/src/http_client_redirect.rs:203-217 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/tui/src/bottom_pane/experimental_features_view.rs:432— codex-rs/tui/src/bottom_pane/experimental_features_view.rs:432-447 | codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:267-281 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/guardian-context/src/allocation.rs:177— codex-rs/guardian-context/src/allocation.rs:177-191 | codex-rs/guardian-context/src/retained_instructions.rs:240-255 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/skills/src/interface.rs:150— codex-rs/skills/src/interface.rs:150-164 | codex-rs/utils/absolute-path/src/absolutize.rs:26-45 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/app-server/src/request_processors/thread_attachments.rs:280— codex-rs/app-server/src/request_processors/thread_attachments.rs:280-294 | codex-rs/app-server/src/request_processors/thread_sections.rs:221-236 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1228— codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1228-1247 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:941-955 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/cli/src/doctor/title.rs:166— codex-rs/cli/src/doctor/title.rs:166-187 | codex-rs/tui/src/chatwidget/status_surfaces.rs:541-555 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/thread-store/src/local/thread_attachments.rs:38— codex-rs/thread-store/src/local/thread_attachments.rs:38-53 | codex-rs/thread-store/src/local/thread_attachments.rs:86-100 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/core/src/exec_policy.rs:1028— codex-rs/core/src/exec_policy.rs:1028-1045 | codex-rs/core/src/exec_policy.rs:1052-1066 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) sdk/python/src/openai_codex/_login.py:64— sdk/python/src/openai_codex/_login.py:64-78 | sdk/python/src/openai_codex/_login.py:84-98 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/core/src/mcp_tool_call.rs:2664— codex-rs/core/src/mcp_tool_call.rs:2664-2678 | codex-rs/core/src/mcp_tool_call.rs:2742-2756 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/exec-server/src/server/file_system_handler.rs:222— codex-rs/exec-server/src/server/file_system_handler.rs:222-236 | codex-rs/exec-server/src/server/file_system_handler.rs:314-330 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/ext/skills/src/render.rs:547— codex-rs/ext/skills/src/render.rs:547-561 | codex-rs/ext/skills/src/render.rs:1162-1179 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/app-server/src/request_processors/account_processor.rs:516— codex-rs/app-server/src/request_processors/account_processor.rs:516-531 | codex-rs/app-server/src/request_processors/account_processor.rs:894-908 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) codex-rs/app-server/src/request_processors/fs_processor.rs:99— codex-rs/app-server/src/request_processors/fs_processor.rs:99-113 | codex-rs/app-server/src/request_processors/fs_processor.rs:159-174 — These two members are one piece of code written twice and then edited apart: 15 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.
+ 2 more in this group — see findings.md.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×27
Edited copy of a member (16 corresponding lines) codex-rs/tui/src/tui.rs:1523— codex-rs/tui/src/tui.rs:1523-1538 | codex-rs/tui/src/tui.rs:1543-1562 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:806— codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:806-827 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:540-555 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/rollout/src/list_files.rs:230— codex-rs/rollout/src/list_files.rs:230-247 | codex-rs/rollout/src/list_files.rs:253-268 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/rollout/src/recorder.rs:1122— codex-rs/rollout/src/recorder.rs:1122-1137 | codex-rs/rollout/src/recorder.rs:1143-1158 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/rollout/src/list_files.rs:119— codex-rs/rollout/src/list_files.rs:119-134 | codex-rs/rollout/src/list_files.rs:186-204 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/rollout/src/maintenance.rs:37— codex-rs/rollout/src/maintenance.rs:37-52 | codex-rs/state/src/runtime/reclamation.rs:122-137 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/core-plugins/src/remote/share/local_paths.rs:56— codex-rs/core-plugins/src/remote/share/local_paths.rs:56-74 | codex-rs/external-agent-migration/src/sessions/ledger.rs:375-390 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/rollout-trace/src/reducer/code_cell.rs:287— codex-rs/rollout-trace/src/reducer/code_cell.rs:287-305 | codex-rs/rollout-trace/src/reducer/code_cell.rs:354-369 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/core-plugins/src/manager.rs:1679— codex-rs/core-plugins/src/manager.rs:1679-1694 | codex-rs/core-plugins/src/manager.rs:1696-1714 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/core/src/guardian/mod.rs:140— codex-rs/core/src/guardian/mod.rs:140-155 | codex-rs/core/src/guardian/mod.rs:186-201 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/cli/src/doctor/output/detail.rs:125— codex-rs/cli/src/doctor/output/detail.rs:125-140 | codex-rs/cli/src/migrate_rollouts.rs:435-450 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/app-server-protocol/src/export.rs:547— codex-rs/app-server-protocol/src/export.rs:547-562 | codex-rs/app-server-protocol/src/export_user_verification.rs:36-53 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/exec-server/src/environment.rs:721— codex-rs/exec-server/src/environment.rs:721-736 | codex-rs/exec-server/src/environment.rs:802-818 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/cli/src/doctor/title.rs:107— codex-rs/cli/src/doctor/title.rs:107-122 | codex-rs/tui/src/chatwidget/status_surfaces.rs:1300-1315 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/thread-store/src/in_memory.rs:696— codex-rs/thread-store/src/in_memory.rs:696-713 | codex-rs/thread-store/src/in_memory.rs:718-733 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/tui/src/app/history_ui.rs:383— codex-rs/tui/src/app/history_ui.rs:383-410 | codex-rs/tui/src/app/resize_reflow.rs:292-307 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/otel/src/metrics/config.rs:74— codex-rs/otel/src/metrics/config.rs:74-94 | codex-rs/otel/src/metrics/config.rs:102-117 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/rollout-trace/src/reducer/code_cell.rs:642— codex-rs/rollout-trace/src/reducer/code_cell.rs:642-657 | codex-rs/rollout-trace/src/reducer/tool.rs:394-411 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/analytics/src/reducer.rs:1650— codex-rs/analytics/src/reducer.rs:1650-1665 | codex-rs/analytics/src/reducer.rs:1671-1687 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/tui/src/history_cell/mcp.rs:812— codex-rs/tui/src/history_cell/mcp.rs:812-827 | codex-rs/tui/src/history_cell/notices.rs:378-393 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/core-plugins/src/manager.rs:1290— codex-rs/core-plugins/src/manager.rs:1290-1305 | codex-rs/core-plugins/src/manager.rs:1311-1327 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/exec-server/src/sandboxed_file_system.rs:125— codex-rs/exec-server/src/sandboxed_file_system.rs:125-140 | codex-rs/exec-server/src/sandboxed_file_system.rs:281-297 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/tui/src/app_server_session/fs.rs:39— codex-rs/tui/src/app_server_session/fs.rs:39-54 | codex-rs/tui/src/app_server_session/fs.rs:60-76 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/config/src/loader/macos.rs:270— codex-rs/config/src/loader/macos.rs:270-288 | codex-rs/config/src/loader/mod.rs:677-692 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) codex-rs/tools/src/json_schema.rs:269— codex-rs/tools/src/json_schema.rs:269-284 | codex-rs/tools/src/json_schema.rs:286-301 — These two members are one piece of code written twice and then edited apart: 16 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.
+ 2 more in this group — see findings.md.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×25
Edited copy of a member (9 corresponding lines) codex-rs/app-server-client/src/remote.rs:124— codex-rs/app-server-client/src/remote.rs:124-132 | codex-rs/tui/src/lib.rs:473-481 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/config/src/marketplace_edit.rs:70— codex-rs/config/src/marketplace_edit.rs:70-78 | codex-rs/config/src/plugin_edit.rs:77-88 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/cloud-config/src/metrics.rs:87— codex-rs/cloud-config/src/metrics.rs:87-95 | codex-rs/external-agent-migration/src/reporting.rs:96-106 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/external-agent-migration/src/mcp.rs:359— codex-rs/external-agent-migration/src/mcp.rs:359-367 | codex-rs/external-agent-migration/src/source/mod.rs:76-84 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/code-mode-protocol/src/host/payload.rs:216— codex-rs/code-mode-protocol/src/host/payload.rs:216-224 | codex-rs/code-mode-protocol/src/host/payload.rs:230-238 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/tui/src/bottom_pane/scroll_state.rs:110— codex-rs/tui/src/bottom_pane/scroll_state.rs:110-118 | codex-rs/tui/src/bottom_pane/scroll_state.rs:125-133 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/core-plugins/src/store.rs:451— codex-rs/core-plugins/src/store.rs:451-459 | codex-rs/linux-sandbox/src/bundled_bwrap.rs:211-219 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/core/src/tools/handlers/mcp_resource.rs:307— codex-rs/core/src/tools/handlers/mcp_resource.rs:307-315 | codex-rs/core/src/tools/handlers/mcp_resource.rs:354-366 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/code-mode-runtime/src/runtime/globals.rs:148— codex-rs/code-mode-runtime/src/runtime/globals.rs:148-156 | codex-rs/code-mode-runtime/src/runtime/globals.rs:162-170 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/cli/src/doctor/progress.rs:64— codex-rs/cli/src/doctor/progress.rs:64-72 | codex-rs/cli/src/doctor/progress.rs:86-97 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/config/src/plugin_edit.rs:154— codex-rs/config/src/plugin_edit.rs:154-162 | codex-rs/core/src/config/edit/document_helpers.rs:248-257 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/tui/src/history_cell/approvals.rs:304— codex-rs/tui/src/history_cell/approvals.rs:304-312 | codex-rs/tui/src/history_cell/approvals.rs:336-344 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/state/src/sqlite/busy_retry.rs:85— codex-rs/state/src/sqlite/busy_retry.rs:85-93 | codex-rs/state/src/sqlite/busy_retry.rs:102-110 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/git-utils/src/info.rs:70— codex-rs/git-utils/src/info.rs:70-78 | codex-rs/git-utils/src/info.rs:131-144 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/cli/src/doctor.rs:1111— codex-rs/cli/src/doctor.rs:1111-1120 | codex-rs/cli/src/doctor/git.rs:85-93 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/connectors/src/metadata.rs:23— codex-rs/connectors/src/metadata.rs:23-31 | codex-rs/core-plugins/src/remote.rs:2155-2165 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/core-plugins/src/remote/share/checkout.rs:177— codex-rs/core-plugins/src/remote/share/checkout.rs:177-185 | codex-rs/core-plugins/src/remote/share/local_paths.rs:78-86 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/exec-server/src/noise_channel.rs:224— codex-rs/exec-server/src/noise_channel.rs:224-235 | codex-rs/exec-server/src/noise_channel.rs:239-247 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/network-proxy/src/system_dns.rs:24— codex-rs/network-proxy/src/system_dns.rs:24-32 | codex-rs/network-proxy/src/system_dns.rs:34-42 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/tui/src/chatwidget/slash_command_args.rs:27— codex-rs/tui/src/chatwidget/slash_command_args.rs:27-35 | codex-rs/tui/src/chatwidget/slash_command_args.rs:42-51 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/external-agent-migration/src/source/mod.rs:21— codex-rs/external-agent-migration/src/source/mod.rs:21-29 | codex-rs/external-agent-migration/src/utils.rs:16-25 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:251— codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:251-262 | codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1154-1162 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/config/src/state.rs:412— codex-rs/config/src/state.rs:412-420 | codex-rs/login/src/auth/manager.rs:3635-3643 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/protocol/src/protocol.rs:4259— codex-rs/protocol/src/protocol.rs:4259-4268 | codex-rs/tui/src/history_cell/mcp.rs:42-50 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) codex-rs/codex-mcp/src/elicitation.rs:697— codex-rs/codex-mcp/src/elicitation.rs:697-705 | codex-rs/ext/guardian-reviewer/src/elicitation.rs:184-193 — These two members are one piece of code written twice and then edited apart: 9 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.
codex_cli::dispatch_cli (cognitive 130) codex-rs/cli/src/main.rs:1063— codex_cli::dispatch_cli has cognitive complexity 130 (threshold 15). Drivers by points: if/else 34 (86 pts), match/switch 11 (23 pts), boolean chains 11, loops 3 (10 pts) (nesting depth added 71). To reduce it, split the body into named stages: move each independent step 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 90) codex-rs/cli/src/doctor.rs:1534— codex_cli::doctor::mcp_check_from_servers has cognitive complexity 90 (threshold 15). Drivers by points: if/else 26 (63 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:337— 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:1417— 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 38) codex-rs/cli/src/debug_sandbox.rs:208— codex_cli::debug_sandbox::run_command_under_sandbox has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (21 pts), match/switch 6 (8 pts), boolean chains 6, loops 1 (3 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_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:691— 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 27) codex-rs/cli/src/mcp_cmd.rs:969— codex_cli::mcp_cmd::run_get has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (16 pts), match/switch 6 (10 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.
codex_cli::plugin_cmd::configured_marketplace_snapshot_issues (cognitive 23) codex-rs/cli/src/plugin_cmd.rs:1009— 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:81— 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::doctor::provider_reachability_check (cognitive 18) codex-rs/cli/src/doctor.rs:2813— 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:2619— 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 17) codex-rs/cli/src/migrate_nfs_db.rs:27— codex_cli::migrate_nfs_db::run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 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.
codex_cli::run_interactive_tui (cognitive 16) codex-rs/cli/src/main.rs:2559— codex_cli::run_interactive_tui has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, 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.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×24
Edited copy of a member (12 corresponding lines) codex-rs/agent-identity/src/lib.rs:293— codex-rs/agent-identity/src/lib.rs:293-305 | codex-rs/login/src/token_data.rs:144-155 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/backend-client/src/client.rs:624— codex-rs/backend-client/src/client.rs:624-635 | codex-rs/backend-client/src/client.rs:641-657 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/core-plugins/src/loader.rs:1111— codex-rs/core-plugins/src/loader.rs:1111-1122 | codex-rs/core-plugins/src/loader.rs:1165-1176 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/windows-sandbox-rs/src/cap.rs:89— codex-rs/windows-sandbox-rs/src/cap.rs:89-100 | codex-rs/windows-sandbox-rs/src/cap.rs:103-114 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/protocol/src/models/executed_tool_calls.rs:749— codex-rs/protocol/src/models/executed_tool_calls.rs:749-760 | codex-rs/protocol/src/models/executed_tool_calls.rs:763-776 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/core/src/config/otel.rs:49— codex-rs/core/src/config/otel.rs:49-65 | codex-rs/core/src/config/otel.rs:103-114 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/core/src/config/edit/document_helpers.rs:267— codex-rs/core/src/config/edit/document_helpers.rs:267-279 | codex-rs/core/src/config/edit/document_helpers.rs:283-294 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/tui/src/bottom_pane/memories_settings_view.rs:120— codex-rs/tui/src/bottom_pane/memories_settings_view.rs:120-131 | codex-rs/tui/src/bottom_pane/memories_settings_view.rs:133-146 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/network-proxy/src/credential_broker/providers.rs:157— codex-rs/network-proxy/src/credential_broker/providers.rs:157-169 | codex-rs/network-proxy/src/credential_broker/providers.rs:173-184 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/chatgpt/src/connectors.rs:371— codex-rs/chatgpt/src/connectors.rs:371-385 | codex-rs/connectors/src/merge.rs:92-103 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/exec-server/src/remote_file_system.rs:91— codex-rs/exec-server/src/remote_file_system.rs:91-102 | codex-rs/exec-server/src/remote_file_system.rs:278-289 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/network-proxy/src/certs.rs:617— codex-rs/network-proxy/src/certs.rs:617-636 | codex-rs/network-proxy/src/certs.rs:648-659 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/tui/src/pets/asset_pack.rs:165— codex-rs/tui/src/pets/asset_pack.rs:165-179 | codex-rs/tui/src/pets/model.rs:314-325 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/core-plugins/src/loader.rs:724— codex-rs/core-plugins/src/loader.rs:724-735 | codex-rs/core-plugins/src/marketplace_policy.rs:301-316 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/core/src/context/world_state/environments_instructions.rs:39— codex-rs/core/src/context/world_state/environments_instructions.rs:39-52 | codex-rs/core/src/context/world_state/model_catalog.rs:151-162 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/rollout-trace/src/thread.rs:493— codex-rs/rollout-trace/src/thread.rs:493-504 | codex-rs/rollout-trace/src/thread.rs:518-530 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/tui/src/app/thread_events.rs:663— codex-rs/tui/src/app/thread_events.rs:663-674 | codex-rs/tui/src/app/thread_events.rs:697-710 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/exec-server/src/client/route_aware_http_client.rs:351— codex-rs/exec-server/src/client/route_aware_http_client.rs:351-362 | codex-rs/rmcp-client/src/http_client_adapter.rs:748-759 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/tui/src/bottom_pane/textarea.rs:1303— codex-rs/tui/src/bottom_pane/textarea.rs:1303-1318 | codex-rs/tui/src/bottom_pane/textarea.rs:1327-1338 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/app-server/src/request_processors/config_processor.rs:306— codex-rs/app-server/src/request_processors/config_processor.rs:306-317 | codex-rs/app-server/src/request_processors/config_processor.rs:322-336 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/analytics/src/reducer.rs:427— codex-rs/analytics/src/reducer.rs:427-445 | codex-rs/core/src/responses_metadata.rs:497-508 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/linux-sandbox/src/linux_run_main.rs:684— codex-rs/linux-sandbox/src/linux_run_main.rs:684-695 | codex-rs/utils/pty/src/process_group.rs:29-41 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/message-board/src/in_memory.rs:470— codex-rs/message-board/src/in_memory.rs:470-481 | codex-rs/message-board/src/local.rs:480-491 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) codex-rs/app-server-test-client/src/lib.rs:837— codex-rs/app-server-test-client/src/lib.rs:837-852 | codex-rs/app-server-test-client/src/lib.rs:1151-1162 — These two members are one piece of code written twice and then edited apart: 12 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 (8 corresponding lines) · ×24
Edited copy of a member (8 corresponding lines) codex-rs/config/src/diagnostics.rs:485— codex-rs/config/src/diagnostics.rs:485-495 | codex-rs/config/src/diagnostics.rs:497-504 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/protocol/src/models/executed_tool_calls.rs:66— codex-rs/protocol/src/models/executed_tool_calls.rs:66-73 | codex-rs/protocol/src/models/executed_tool_calls.rs:76-85 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/cloud-tasks-client/src/http.rs:729— codex-rs/cloud-tasks-client/src/http.rs:729-736 | codex-rs/cloud-tasks-client/src/http.rs:785-794 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/tui/src/diff_render.rs:1215— codex-rs/tui/src/diff_render.rs:1215-1222 | codex-rs/tui/src/diff_render.rs:1224-1231 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/login/src/auth/manager.rs:719— codex-rs/login/src/auth/manager.rs:719-726 | codex-rs/login/src/auth/manager.rs:729-738 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/network-proxy/src/socks5.rs:585— codex-rs/network-proxy/src/socks5.rs:585-592 | codex-rs/network-proxy/src/socks5.rs:594-601 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) REDACTED:400— REDACTED:400-409 | codex-rs/utils/absolute-path/src/lib.rs:220-227 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/analytics/src/reducer.rs:194— codex-rs/analytics/src/reducer.rs:194-201 | codex-rs/core-plugins/src/plugin_metrics.rs:151-158 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/network-proxy/src/responses.rs:76— codex-rs/network-proxy/src/responses.rs:76-83 | codex-rs/network-proxy/src/responses.rs:92-99 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/core/src/config/edit.rs:114— codex-rs/core/src/config/edit.rs:114-121 | codex-rs/core/src/config/edit.rs:135-142 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/rmcp-client/src/oauth.rs:1236— codex-rs/rmcp-client/src/oauth.rs:1236-1243 | codex-rs/rmcp-client/src/oauth.rs:1323-1332 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/core-plugins/src/manager.rs:1093— codex-rs/core-plugins/src/manager.rs:1093-1103 | codex-rs/core-plugins/src/tool_suggest_metadata.rs:115-122 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/tui/src/external_agent_config_migration/mod.rs:415— codex-rs/tui/src/external_agent_config_migration/mod.rs:415-422 | codex-rs/tui/src/external_agent_config_migration/mod.rs:424-431 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1115— codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1115-1122 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:354-364 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/code-mode-host/src/lib.rs:383— codex-rs/code-mode-host/src/lib.rs:383-390 | codex-rs/code-mode-host/src/peer.rs:391-399 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/protocol/src/models.rs:1885— codex-rs/protocol/src/models.rs:1885-1892 | codex-rs/tui/src/additional_dirs.rs:35-44 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/windows-sandbox-rs/src/helper_materialization.rs:32— codex-rs/windows-sandbox-rs/src/helper_materialization.rs:32-39 | codex-rs/windows-sandbox-rs/src/setup.rs:895-902 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/app-server/src/request_processors/thread_processor.rs:92— codex-rs/app-server/src/request_processors/thread_processor.rs:92-99 | codex-rs/rollout/src/state_db.rs:490-501 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/state/src/runtime/goals.rs:149— codex-rs/state/src/runtime/goals.rs:149-156 | codex-rs/state/src/runtime/threads.rs:185-192 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/external-agent-migration/src/hooks_cla.rs:37— codex-rs/external-agent-migration/src/hooks_cla.rs:37-44 | codex-rs/external-agent-migration/src/hooks_cur.rs:17-25 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/config/src/schema.rs:250— codex-rs/config/src/schema.rs:250-259 | codex-rs/hooks/src/schema.rs:772-779 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/tui/src/bottom_pane/custom_prompt_view.rs:252— codex-rs/tui/src/bottom_pane/custom_prompt_view.rs:252-260 | codex-rs/tui/src/bottom_pane/feedback_note_view.rs:195-202 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1062— codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1062-1069 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:776-784 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) codex-rs/connectors/src/lib.rs:512— codex-rs/connectors/src/lib.rs:512-519 | codex-rs/core/src/mcp_skill_dependencies.rs:348-355 — These two members are one piece of code written twice and then edited apart: 8 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 (7 corresponding lines) · ×24
Edited copy of a member (7 corresponding lines) codex-rs/http-client/src/network_policy.rs:71— codex-rs/http-client/src/network_policy.rs:71-79 | codex-rs/utils/critical-path/src/lib.rs:53-59 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/app-server-client/src/lib.rs:750— codex-rs/app-server-client/src/lib.rs:750-756 | codex-rs/app-server-client/src/lib.rs:847-853 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/app-server-client/src/lib.rs:762— codex-rs/app-server-client/src/lib.rs:762-768 | codex-rs/app-server-client/src/lib.rs:859-865 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/app-server-daemon/src/thread_recovery.rs:10— codex-rs/app-server-daemon/src/thread_recovery.rs:10-16 | codex-rs/core-plugins/src/store.rs:355-365 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/http-client/src/outbound_proxy.rs:615— codex-rs/http-client/src/outbound_proxy.rs:615-622 | codex-rs/http-client/src/outbound_proxy.rs:637-643 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/core/src/config/managed_features.rs:260— codex-rs/core/src/config/managed_features.rs:260-266 | codex-rs/tui/src/debug_config.rs:633-639 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/exec-server/src/client.rs:1686— codex-rs/exec-server/src/client.rs:1686-1692 | codex-rs/exec-server/src/process.rs:101-107 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/core/src/tools/handlers/mcp.rs:622— codex-rs/core/src/tools/handlers/mcp.rs:622-628 | codex-rs/core/src/tools/registry.rs:1179-1185 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) scripts/codex_package/v8.py:201— scripts/codex_package/v8.py:201-208 | .github/scripts/macos-signing/notarize_with_akv.py:369-375 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/file-system/src/lib.rs:192— codex-rs/file-system/src/lib.rs:192-198 | codex-rs/protocol/src/permissions.rs:524-532 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/state/src/extract.rs:211— codex-rs/state/src/extract.rs:211-217 | codex-rs/thread-store/src/local/update_thread_metadata.rs:800-806 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/core-plugins/src/marketplace_add.rs:56— codex-rs/core-plugins/src/marketplace_add.rs:56-62 | codex-rs/core-plugins/src/marketplace_remove.rs:39-47 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/cli/src/doctor.rs:2310— codex-rs/cli/src/doctor.rs:2310-2317 | codex-rs/cli/src/doctor/thread_inventory.rs:580-586 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) scripts/mcp_conformance/codex_conformance_adapter.py:98— scripts/mcp_conformance/codex_conformance_adapter.py:98-104 | scripts/mcp_conformance/review_regressions.py:153-159 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/codex-mcp/src/auth_elicitation.rs:209— codex-rs/codex-mcp/src/auth_elicitation.rs:209-216 | codex-rs/rmcp-client/src/rmcp_client.rs:836-842 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/core-plugins/src/remote_metadata.rs:44— codex-rs/core-plugins/src/remote_metadata.rs:44-50 | codex-rs/utils/path-utils/src/lib.rs:228-234 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/tui/src/app/session_lifecycle.rs:256— codex-rs/tui/src/app/session_lifecycle.rs:256-263 | codex-rs/tui/src/app/thread_goal_actions.rs:360-366 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/app-server/src/request_processors.rs:717— codex-rs/app-server/src/request_processors.rs:717-725 | codex-rs/rollout-trace/src/reducer/tool/agents.rs:762-768 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/config/src/state.rs:465— codex-rs/config/src/state.rs:465-471 | codex-rs/tui/src/chatwidget/status_surfaces.rs:1056-1062 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/app-server-daemon/src/remote_control_client.rs:317— codex-rs/app-server-daemon/src/remote_control_client.rs:317-323 | codex-rs/app-server/src/app_server_tracing.rs:164-170 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/app-server/src/request_processors/projects.rs:303— codex-rs/app-server/src/request_processors/projects.rs:303-309 | codex-rs/exec-server/src/remote.rs:990-998 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/exec-server/src/local_file_system.rs:648— codex-rs/exec-server/src/local_file_system.rs:648-654 | codex-rs/exec-server/src/sandboxed_file_system.rs:371-379 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) codex-rs/core-plugins/src/marketplace.rs:936— codex-rs/core-plugins/src/marketplace.rs:936-942 | codex-rs/core-plugins/src/marketplace_add/source.rs:119-126 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) sdk/python/examples/11_cli_mini_app/async.py:24— sdk/python/examples/11_cli_mini_app/async.py:24-30 | sdk/python/examples/11_cli_mini_app/sync.py:24-30 — These two members are one piece of code written twice and then edited apart: 7 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.
codex_app_server::run_main_with_transport_options (cognitive 195) codex-rs/app-server/src/lib.rs:515— codex_app_server::run_main_with_transport_options has cognitive complexity 195 (threshold 15). Drivers by points: if/else 62 (131 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::request_processors::thread_lifecycle::start_listener (cognitive 149) codex-rs/app-server/src/request_processors/thread_lifecycle.rs:330— codex_app_server::request_processors::thread_lifecycle::start_listener has cognitive complexity 149 (threshold 15). Drivers by points: if/else 41 (102 pts), match/switch 11 (27 pts), boolean chains 12, loops 4 (8 pts) (nesting depth added 81). To reduce it, split the body into named stages: move each independent step 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 123) codex-rs/app-server/src/in_process.rs:463— codex_app_server::in_process::start_uninitialized has cognitive complexity 123 (threshold 15). Drivers by points: if/else 25 (71 pts), match/switch 14 (48 pts), loops 3, boolean chains 1 (nesting depth added 80). To reduce it, split the body into named stages: move each independent step 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 76) codex-rs/app-server/src/bespoke_event_handling.rs:148— codex_app_server::bespoke_event_handling::apply_bespoke_event_handling has cognitive complexity 76 (threshold 15). Drivers by points: if/else 21 (43 pts), match/switch 14 (27 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 36). 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 42) codex-rs/app-server/src/request_processors/thread_lifecycle.rs:1023— codex_app_server::request_processors::thread_lifecycle::handle_pending_thread_resume_request has cognitive complexity 42 (threshold 15). Drivers by points: if/else 24 (32 pts), boolean chains 6, 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.
codex_app_server::request_processors::thread_processor::validate_dynamic_tools (cognitive 33) codex-rs/app-server/src/request_processors/thread_processor.rs:358— 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::config_manager_service_provider_write::provider_edits (cognitive 29) codex-rs/app-server/src/config_manager_service_provider_write.rs:79— codex_app_server::config_manager_service_provider_write::provider_edits has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 6, 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.
codex_app_server::request_processors::config_processor::reload_user_config_inner (cognitive 29) codex-rs/app-server/src/request_processors/config_processor.rs:421— 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 29) codex-rs/app-server/src/request_processors/thread_processor.rs:137— codex_app_server::request_processors::thread_processor::collect_resume_override_mismatches has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 4, 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.
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:119— 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::request_processors::process_exec_processor::collect_spawn_process_output (cognitive 23) codex-rs/app-server/src/request_processors/process_exec_processor.rs:613— codex_app_server::request_processors::process_exec_processor::collect_spawn_process_output has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 2 (4 pts), boolean chains 3, 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_app_server::request_processors::process_exec_processor::run_process (cognitive 20) codex-rs/app-server/src/request_processors/process_exec_processor.rs:489— codex_app_server::request_processors::process_exec_processor::run_process has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 3 (9 pts), if/else 3 (8 pts), boolean chains 2, 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::otel_reloader::spawn (cognitive 19) codex-rs/app-server/src/otel_reloader.rs:45— 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::bespoke_event_handling::on_command_execution_request_approval_response (cognitive 18) codex-rs/app-server/src/bespoke_event_handling.rs:2071— codex_app_server::bespoke_event_handling::on_command_execution_request_approval_response has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 4 (10 pts), if/else 6, boolean chains 2 (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::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:6258— 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:727— 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::thread_sample::collect_response (cognitive 16) codex-rs/app-server/src/thread_sample.rs:404— 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server-protocol/src/protocol/event_mapping.rs:269` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (15 lines × 2) codex-rs/app-server/src/command_exec.rs:592— codex-rs/app-server/src/command_exec.rs:592-606 | codex-rs/app-server/src/request_processors/process_exec_processor.rs:658-672 — 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 8 separate duplicated blocks between them, totalling at least 140 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/codex-api/src/endpoint/realtime_websocket/methods.rs:796— codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:796-810 | codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:828-842 — both copies are in the same file, so extract the 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 `codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:796` 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.
Duplicated block (15 lines × 2) codex-rs/codex-mcp/src/mcp/mod.rs:493— codex-rs/codex-mcp/src/mcp/mod.rs:493-507 | codex-rs/codex-mcp/src/mcp/mod.rs:575-589 — both copies are in the same file, so extract the 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 `codex-rs/codex-mcp/src/mcp/mod.rs:493` 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.
Duplicated block (15 lines × 2) codex-rs/connectors/src/lib.rs:496— codex-rs/connectors/src/lib.rs:496-510 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (15 lines × 2) codex-rs/core-plugins/src/loader.rs:1751— codex-rs/core-plugins/src/loader.rs:1751-1765 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core-plugins/src/startup_sync.rs:927` 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.
Duplicated block (15 lines × 2) codex-rs/core/src/client.rs:1812— codex-rs/core/src/client.rs:1812-1826 | codex-rs/core/src/client.rs:2291-2305 — both copies are in the same file, so extract the 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 `codex-rs/core/src/client.rs:1812` 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.
Duplicated block (15 lines × 2) codex-rs/core/src/session/mod.rs:5091— codex-rs/core/src/session/mod.rs:5091-5105 | codex-rs/core/src/session/mod.rs:5190-5204 — both copies are in the same file, so extract the 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/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 91 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/ext/skills/src/dynamic_skill_selector/fielded_bm25.rs:56` calls `average_field_lengths` and `codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:60` 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 (15 lines × 2) codex-rs/ext/skills/src/state.rs:297— codex-rs/ext/skills/src/state.rs:297-311 | codex-rs/ext/skills/src/state.rs:367-381 — both copies are in the same file, so extract the 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/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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/external-agent-migration/src/sessions/records_cla.rs:28` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/external-agent-migration/src/sessions/records_cla.rs:114` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/hooks/src/events/post_tool_use.rs:101` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `PostToolUseRequest` in one and `PreToolUseRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (15 lines × 2) codex-rs/protocol/src/models.rs:1523— codex-rs/protocol/src/models.rs:1523-1537 | codex-rs/protocol/src/models.rs:1545-1559 — both copies are in the same file, so extract the 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 `codex-rs/protocol/src/models.rs:1523` 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.
Duplicated block (15 lines × 2) codex-rs/tui/src/chatwidget/realtime.rs:958— codex-rs/tui/src/chatwidget/realtime.rs:958-972 | codex-rs/tui/src/chatwidget/realtime.rs:1062-1076 — both copies are in the same file, so extract the 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 first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) fn is_realtime_delegated_agent_item( &mut` in one and `super) fn speak_completed_realtime_delegation( &mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (15 lines × 2) codex-rs/tui/src/tui.rs:1499— codex-rs/tui/src/tui.rs:1499-1513 | codex-rs/tui/src/tui.rs:1642-1656 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/tui.rs:1499` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/tui/src/tui.rs:1638` calls `invalidate_viewport` and `codex-rs/tui/src/tui.rs:1496` does not — after which the two agree again for 3 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 (15 lines × 2) codex-rs/windows-sandbox-rs/src/acl.rs:177— codex-rs/windows-sandbox-rs/src/acl.rs:177-191 | codex-rs/windows-sandbox-rs/src/acl.rs:473-487 — both copies are in the same file, so extract the 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:712-728 — 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 8 separate duplicated blocks between them, totalling at least 140 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server/src/command_exec.rs:641` 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.
Duplicated block (15 lines × 2) codex-rs/app-server/src/bespoke_event_handling.rs:1731— codex-rs/app-server/src/bespoke_event_handling.rs:1731-1745 | codex-rs/app-server/src/bespoke_event_handling.rs:1747-1761 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/hooks/src/events/stop.rs:150` 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.
Session::new (cognitive 153) codex-rs/core/src/session/session.rs:790— Session::new has cognitive complexity 153 (threshold 15). Drivers by points: if/else 69 (82 pts), match/switch 21 (35 pts), boolean chains 27, loops 8 (9 pts) (nesting depth added 28). 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 69) codex-rs/core/src/session/world_state.rs:78— Session::build_world_state_for_step has cognitive complexity 69 (threshold 15). Drivers by points: if/else 35 (42 pts), boolean chains 14, match/switch 5 (8 pts), loops 3 (5 pts) (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.
Session::assemble_initial_context (cognitive 48) codex-rs/core/src/session/mod.rs:5124— Session::assemble_initial_context has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (18 pts), match/switch 4 (11 pts), loops 7 (10 pts), boolean chains 9 (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.
Session::initialize (cognitive 46) codex-rs/core/src/session/mod.rs:699— Session::initialize has cognitive complexity 46 (threshold 15). Drivers by points: if/else 21 (29 pts), boolean chains 9, match/switch 6 (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.
Session::refresh_config (cognitive 35) codex-rs/core/src/session/config_refresh.rs:53— Session::refresh_config has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (24 pts), loops 2 (5 pts), boolean chains 3, match/switch 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.
Session::record_initial_history (cognitive 33) codex-rs/core/src/session/mod.rs:1771— Session::record_initial_history has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (22 pts), match/switch 4 (7 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.
Session::on_task_finished (cognitive 33) codex-rs/core/src/tasks/mod.rs:721— Session::on_task_finished has cognitive complexity 33 (threshold 15). Drivers by points: if/else 19 (21 pts), boolean chains 7, match/switch 3 (4 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.
Session::project_selected_environment_mcp_servers (cognitive 32) codex-rs/core/src/session/mcp_runtime.rs:141— Session::project_selected_environment_mcp_servers has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 4, 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::capture_step_context_inner (cognitive 31) codex-rs/core/src/session/mod.rs:4340— Session::capture_step_context_inner has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18 (20 pts), match/switch 4 (6 pts), boolean chains 3, loops 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.
Session::reload_user_config_layer (cognitive 28) codex-rs/core/src/session/mod.rs:2581— 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_prepared_conversation_items (cognitive 24) codex-rs/core/src/session/mod.rs:4069— 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:339— 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::apply_turn_settings (cognitive 21) codex-rs/core/src/session/step_activation.rs:234— Session::apply_turn_settings has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12, boolean chains 8, 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::refresh_managed_network_proxy_for_current_permission_profile (cognitive 20) codex-rs/core/src/session/mod.rs:1484— 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::maybe_publish_terminal_agent_result (cognitive 20) codex-rs/core/src/session/mod.rs:2812— Session::maybe_publish_terminal_agent_result has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 3, 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.
Session::start_task (cognitive 18) codex-rs/core/src/tasks/mod.rs:295— Session::start_task has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 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::request_user_approval (cognitive 18) codex-rs/core/src/tools/approvals.rs:787— Session::request_user_approval has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 1, match/switch 1 (nesting depth added 5). 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.
Session::update_settings_if (cognitive 17) codex-rs/core/src/session/mod.rs:2171— Session::update_settings_if has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, boolean chains 5, 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::send_event (cognitive 17) codex-rs/core/src/session/mod.rs:2727— Session::send_event 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.
Session::request_approval_with_user_prompt (cognitive 17) codex-rs/core/src/tools/approvals.rs:563— Session::request_approval_with_user_prompt has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), match/switch 3 (4 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.
codex_thread_store::local::update_thread_metadata::apply_metadata_update (cognitive 84) codex-rs/thread-store/src/local/update_thread_metadata.rs:350— codex_thread_store::local::update_thread_metadata::apply_metadata_update has cognitive complexity 84 (threshold 15). Drivers by points: if/else 43 (65 pts), boolean chains 10, match/switch 4 (9 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.
codex_thread_store::local::update_thread_metadata::update_thread_metadata (cognitive 51) codex-rs/thread-store/src/local/update_thread_metadata.rs:38— codex_thread_store::local::update_thread_metadata::update_thread_metadata has cognitive complexity 51 (threshold 15). Drivers by points: if/else 25 (31 pts), boolean chains 14, 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::search_threads::search_threads (cognitive 44) codex-rs/thread-store/src/local/search_threads.rs:36— codex_thread_store::local::search_threads::search_threads has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16 (36 pts), loops 3 (5 pts), match/switch 2, 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_thread_store::local::thread_history_materialization::read_projection_batches (cognitive 40) codex-rs/thread-store/src/local/thread_history_materialization.rs:122— codex_thread_store::local::thread_history_materialization::read_projection_batches has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (22 pts), match/switch 7 (13 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::rollout_migration::legacy_event::user_message_item (cognitive 34) codex-rs/thread-store/src/local/rollout_migration/legacy_event.rs:39— codex_thread_store::local::rollout_migration::legacy_event::user_message_item has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 5 (9 pts), match/switch 2 (6 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_thread_store::local::thread_history::segment_paging::page_item_rows (cognitive 33) codex-rs/thread-store/src/local/thread_history/segment_paging.rs:235— codex_thread_store::local::thread_history::segment_paging::page_item_rows has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 3 (6 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.
codex_thread_store::local::thread_history::search::search_thread_occurrences (cognitive 31) codex-rs/thread-store/src/local/thread_history/search.rs:51— 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::thread_history::realtime_stream::read_page (cognitive 26) codex-rs/thread-store/src/local/thread_history/realtime_stream.rs:119— codex_thread_store::local::thread_history::realtime_stream::read_page has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 6, 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.
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:1306— 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::unarchive_thread::unarchive_thread_with_index (cognitive 24) codex-rs/thread-store/src/local/unarchive_thread.rs:86— codex_thread_store::local::unarchive_thread::unarchive_thread_with_index has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (21 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::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::model_context::load_for_fork (cognitive 22) codex-rs/thread-store/src/local/model_context.rs:98— 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:232— 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::original_history::read (cognitive 19) codex-rs/thread-store/src/local/original_history.rs:32— codex_thread_store::local::original_history::read has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, loops 1 (2 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_thread_store::local::rollout_migration::rollback_plan::user_response_matches_event (cognitive 19) codex-rs/thread-store/src/local/rollout_migration/rollback_plan.rs:572— codex_thread_store::local::rollout_migration::rollback_plan::user_response_matches_event has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 3 (4 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_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:85— 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:107— 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.
codex_windows_sandbox::setup_provisioning::run_setup_full (cognitive 53) codex-rs/windows-sandbox-rs/src/setup_provisioning.rs:975— 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:710— 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:549— 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:166— 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::deny_read_resolver::expand_deny_read_paths (cognitive 20) codex-rs/windows-sandbox-rs/src/deny_read_resolver.rs:54— codex_windows_sandbox::deny_read_resolver::expand_deny_read_paths has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (6 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_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:902— 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::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.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×20
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.
Edited copy of a member (17 corresponding lines) codex-rs/tui/src/markdown_render.rs:1436— codex-rs/tui/src/markdown_render.rs:1436-1456 | codex-rs/tui/src/markdown_render.rs:2586-2602 — 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.
Edited copy of a member (17 corresponding lines) codex-rs/state/src/runtime/threads.rs:296— codex-rs/state/src/runtime/threads.rs:296-312 | codex-rs/state/src/runtime/threads.rs:318-366 — 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.
Edited copy of a member (17 corresponding lines) codex-rs/ext/memories/src/tools/mod.rs:62— codex-rs/ext/memories/src/tools/mod.rs:62-78 | codex-rs/ext/skills/src/tools/mod.rs:381-397 — 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.
Edited copy of a member (17 corresponding lines) codex-rs/external-agent-migration/src/service.rs:660— codex-rs/external-agent-migration/src/service.rs:660-676 | codex-rs/external-agent-migration/src/service.rs:701-718 — 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.
Edited copy of a member (17 corresponding lines) codex-rs/rollout-trace/src/reducer/code_cell.rs:697— codex-rs/rollout-trace/src/reducer/code_cell.rs:697-713 | codex-rs/rollout-trace/src/reducer/tool.rs:470-486 — 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.
Edited copy of a member (17 corresponding lines) codex-rs/windows-sandbox-rs/src/wfp.rs:256— codex-rs/windows-sandbox-rs/src/wfp.rs:256-272 | codex-rs/windows-sandbox-rs/src/wfp.rs:275-293 — 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.
Edited copy of a member (17 corresponding lines) codex-rs/cloud-client/src/lib.rs:302— codex-rs/cloud-client/src/lib.rs:302-318 | codex-rs/cloud-client/src/turns.rs:266-283 — 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.
Edited copy of a member (17 corresponding lines) codex-rs/state/src/runtime/threads.rs:1216— codex-rs/state/src/runtime/threads.rs:1216-1232 | codex-rs/state/src/runtime/threads.rs:1239-1255 — 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.
Edited copy of a member (17 corresponding lines) sdk/python/examples/10_error_handling_and_retry/async.py:36— sdk/python/examples/10_error_handling_and_retry/async.py:36-52 | sdk/python/src/openai_codex/retry.py:20-41 — 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.
Edited copy of a member (17 corresponding lines) codex-rs/ext/skills/src/dynamic_skill_selector/routing_card_lexical.rs:196— codex-rs/ext/skills/src/dynamic_skill_selector/routing_card_lexical.rs:196-212 | codex-rs/ext/skills/src/dynamic_skill_selector/weighted_lexical.rs:157-173 — 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.
Edited copy of a member (17 corresponding lines) codex-rs/tui/src/bottom_pane/multi_select_picker.rs:360— codex-rs/tui/src/bottom_pane/multi_select_picker.rs:360-376 | codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:166-182 — 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.
Edited copy of a member (17 corresponding lines) codex-rs/tui/src/bottom_pane/hooks_browser_view.rs:186— codex-rs/tui/src/bottom_pane/hooks_browser_view.rs:186-205 | codex-rs/tui/src/bottom_pane/hooks_browser_view.rs:207-223 — 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.
Edited copy of a member (17 corresponding lines) codex-rs/config/src/plugin_edit.rs:124— codex-rs/config/src/plugin_edit.rs:124-140 | codex-rs/core/src/config/edit/document_helpers.rs:18-36 — 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.
Edited copy of a member (17 corresponding lines) codex-rs/app-server-daemon/src/backend/pid.rs:690— codex-rs/app-server-daemon/src/backend/pid.rs:690-708 | codex-rs/app-server-daemon/src/backend/pid.rs:738-754 — 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.
Edited copy of a member (17 corresponding lines) codex-rs/thread-store/src/queue_store.rs:101— codex-rs/thread-store/src/queue_store.rs:101-117 | codex-rs/thread-store/src/queue_store.rs:141-157 — 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.
Edited copy of a member (17 corresponding lines) codex-rs/codex-experimental-api-macros/src/lib.rs:226— codex-rs/codex-experimental-api-macros/src/lib.rs:226-242 | codex-rs/tui/src/bottom_pane/mentions_v2/search_catalog.rs:182-203 — 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.
Edited copy of a member (17 corresponding lines) codex-rs/core-plugins/src/command_migration/render.rs:72— codex-rs/core-plugins/src/command_migration/render.rs:72-91 | codex-rs/ext/skills/src/dynamic_skill_selector/weighted_lexical.rs:139-155 — 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.
Edited copy of a member (17 corresponding lines) codex-rs/app-server/src/request_processors/remote_control_processor.rs:45— codex-rs/app-server/src/request_processors/remote_control_processor.rs:45-61 | codex-rs/app-server/src/request_processors/remote_control_processor.rs:67-83 — 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.
Edited copy of a member (17 corresponding lines) codex-rs/rmcp-client/src/bin/test_stdio_server.rs:296— codex-rs/rmcp-client/src/bin/test_stdio_server.rs:296-312 | codex-rs/rmcp-client/src/bin/test_stdio_server.rs:364-380 — 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.
Low cohesion: LocalThreadStore (LCOM4 41) codex-rs/thread-store/src/local/mod.rs:149— LocalThreadStore's methods fall into 41 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 41 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:246— 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:58— 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: SkillCatalogEntry (LCOM4 5) codex-rs/ext/skills/src/catalog.rs:182— SkillCatalogEntry'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: ModelProviderSharedState (LCOM4 5) codex-rs/model-provider/src/shared_state.rs:23— ModelProviderSharedState'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: Config (LCOM4 4) codex-rs/core/src/config/mod.rs:639— Config'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: McpBoards (LCOM4 4) codex-rs/ext/agent-message-board/src/mcp.rs:32— McpBoards'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: SessionTelemetry (LCOM4 4) codex-rs/otel/src/events/session_telemetry.rs:126— SessionTelemetry'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:47— 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:428— 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_stdio_server.rs:47— 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.
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.
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.
TranscriptView::move_copy_target (cognitive 79) codex-rs/tui/src/transcript_view/copy_mode.rs:91— TranscriptView::move_copy_target has cognitive complexity 79 (threshold 15). Drivers by points: if/else 25 (55 pts), boolean chains 10, loops 3 (7 pts), match/switch 2 (7 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.
TranscriptView::handle_select_mode_key (cognitive 47) codex-rs/tui/src/transcript_view/select_mode.rs:185— TranscriptView::handle_select_mode_key has cognitive complexity 47 (threshold 15). Drivers by points: if/else 22 (31 pts), boolean chains 15, 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.
TranscriptView::footer_with_navigation (cognitive 46) codex-rs/tui/src/transcript_view/footer.rs:17— TranscriptView::footer_with_navigation has cognitive complexity 46 (threshold 15). Drivers by points: if/else 29 (39 pts), boolean chains 7 (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.
TranscriptView::handle_disclosure_key (cognitive 43) codex-rs/tui/src/transcript_view/disclosure.rs:212— 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:300— 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::paint_rows (cognitive 42) codex-rs/tui/src/transcript_view.rs:193— TranscriptView::paint_rows has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (29 pts), boolean chains 10, 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::render_selection (cognitive 32) codex-rs/tui/src/transcript_view/selection.rs:869— TranscriptView::render_selection has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 2, 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.
TranscriptView::handle_key (cognitive 26) codex-rs/tui/src/transcript_view/input.rs:194— 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::entry_layout (cognitive 26) codex-rs/tui/src/transcript_view/layout.rs:214— TranscriptView::entry_layout has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 6, 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.
TranscriptView::toggle_activity (cognitive 25) codex-rs/tui/src/transcript_view/disclosure.rs:372— TranscriptView::toggle_activity has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 5, loops 1 (4 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.
TranscriptView::next_search_match (cognitive 23) codex-rs/tui/src/transcript_view/search.rs:677— 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::move_cell_text_cursor (cognitive 22) codex-rs/tui/src/transcript_view/select_mode/table.rs:157— TranscriptView::move_cell_text_cursor has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (5 pts), boolean chains 2, 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.
TranscriptView::handle_search_key (cognitive 19) codex-rs/tui/src/transcript_view/search.rs:185— 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::pointer_down (cognitive 18) codex-rs/tui/src/transcript_view/input.rs:513— TranscriptView::pointer_down has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 7 (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.
TranscriptView::owns_interaction_key (cognitive 17) codex-rs/tui/src/transcript_view/input.rs:156— 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:191— 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::render_parked (cognitive 17) codex-rs/tui/src/transcript_view.rs:396— TranscriptView::render_parked has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6 (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.
TranscriptView::advance_search (cognitive 16) codex-rs/tui/src/transcript_view/search.rs:531— 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.
codex_core_plugins::loader::apply_configured_plugin_mcp_server_policies (cognitive 44) codex-rs/core-plugins/src/loader.rs:1420— 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:937— 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:546— 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:408— 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:1521— 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:260— 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:125— 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:395— 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:95— 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:1578— 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.
ChatComposer::render_with_options (cognitive 113) codex-rs/tui/src/bottom_pane/chat_composer.rs:4659— ChatComposer::render_with_options has cognitive complexity 113 (threshold 15). Drivers by points: if/else 58 (92 pts), boolean chains 18, match/switch 2 (3 pts) (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.
ChatComposer::handle_input_basic_with_time (cognitive 64) codex-rs/tui/src/bottom_pane/chat_composer.rs:3740— ChatComposer::handle_input_basic_with_time has cognitive complexity 64 (threshold 15). Drivers by points: if/else 24 (46 pts), boolean chains 10, match/switch 3 (5 pts), 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.
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:3586— 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:4318— 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_submission_with_time (cognitive 35) codex-rs/tui/src/bottom_pane/chat_composer.rs:3275— 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::handle_restricted_key (cognitive 30) codex-rs/tui/src/bottom_pane/chat_composer/reconnect.rs:61— ChatComposer::handle_restricted_key has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 7, loops 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.
ChatComposer::passive_hints (cognitive 28) codex-rs/tui/src/bottom_pane/chat_composer/passive_hints.rs:248— ChatComposer::passive_hints has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 9 (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.
ChatComposer::sync_popups (cognitive 26) codex-rs/tui/src/bottom_pane/chat_composer.rs:4019— 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:2140— 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:1318— 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:3117— 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:2379— 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:4129— 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_key_event_with_file_popup (cognitive 17) codex-rs/tui/src/bottom_pane/chat_composer.rs:2211— 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.
D30 · Dependency Vulnerabilities· Medium advisory (unsound) · ×16
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×16
Edited copy of a member (20 corresponding lines) codex-rs/protocol/src/models.rs:1522— codex-rs/protocol/src/models.rs:1522-1541 | codex-rs/protocol/src/models.rs:1544-1563 — These two members are one piece of code written twice and then edited apart: 20 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.
Edited copy of a member (20 corresponding lines) codex-rs/core/src/plugins/mentions.rs:41— codex-rs/core/src/plugins/mentions.rs:41-60 | codex-rs/core/src/plugins/mentions.rs:83-106 — These two members are one piece of code written twice and then edited apart: 20 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.
Edited copy of a member (20 corresponding lines) codex-rs/app-server-daemon/src/backend/pid.rs:308— codex-rs/app-server-daemon/src/backend/pid.rs:308-327 | codex-rs/app-server-daemon/src/backend/pid.rs:777-802 — These two members are one piece of code written twice and then edited apart: 20 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.
Edited copy of a member (20 corresponding lines) codex-rs/tui/src/chatwidget/usage.rs:98— codex-rs/tui/src/chatwidget/usage.rs:98-117 | codex-rs/tui/src/chatwidget/usage.rs:328-352 — These two members are one piece of code written twice and then edited apart: 20 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.
Edited copy of a member (20 corresponding lines) codex-rs/tui/src/wrapping.rs:790— codex-rs/tui/src/wrapping.rs:790-809 | codex-rs/tui/src/wrapping.rs:1337-1356 — These two members are one piece of code written twice and then edited apart: 20 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.
Edited copy of a member (20 corresponding lines) codex-rs/tui/src/bottom_pane/status_line_setup.rs:402— codex-rs/tui/src/bottom_pane/status_line_setup.rs:402-421 | codex-rs/tui/src/bottom_pane/title_setup.rs:344-366 — These two members are one piece of code written twice and then edited apart: 20 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.
Edited copy of a member (20 corresponding lines) codex-rs/exec-server/src/remote_file_system.rs:227— codex-rs/exec-server/src/remote_file_system.rs:227-246 | codex-rs/exec-server/src/sandboxed_file_system.rs:222-245 — These two members are one piece of code written twice and then edited apart: 20 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.
Edited copy of a member (20 corresponding lines) codex-rs/app-server/src/request_processors/mcp_processor.rs:855— codex-rs/app-server/src/request_processors/mcp_processor.rs:855-874 | codex-rs/rollout-trace/src/mcp.rs:37-63 — These two members are one piece of code written twice and then edited apart: 20 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.
Edited copy of a member (20 corresponding lines) codex-rs/tui/src/onboarding/onboarding_screen.rs:617— codex-rs/tui/src/onboarding/onboarding_screen.rs:617-643 | codex-rs/tui/src/onboarding/onboarding_screen.rs:645-664 — These two members are one piece of code written twice and then edited apart: 20 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.
Edited copy of a member (20 corresponding lines) sdk/python/src/openai_codex/_goal.py:366— sdk/python/src/openai_codex/_goal.py:366-385 | sdk/python/src/openai_codex/_goal.py:418-437 — These two members are one piece of code written twice and then edited apart: 20 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.
Edited copy of a member (20 corresponding lines) codex-rs/app-server/src/request_processors/persisted_resume_settings.rs:20— codex-rs/app-server/src/request_processors/persisted_resume_settings.rs:20-39 | codex-rs/app-server/src/request_processors/persisted_resume_settings.rs:118-137 — These two members are one piece of code written twice and then edited apart: 20 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.
Edited copy of a member (20 corresponding lines) codex-rs/exec-server/src/remote_file_system.rs:252— codex-rs/exec-server/src/remote_file_system.rs:252-271 | codex-rs/exec-server/src/sandboxed_file_system.rs:251-274 — These two members are one piece of code written twice and then edited apart: 20 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.
Edited copy of a member (20 corresponding lines) codex-rs/rollout/src/recorder.rs:2202— codex-rs/rollout/src/recorder.rs:2202-2221 | codex-rs/rollout/src/recorder.rs:2262-2281 — These two members are one piece of code written twice and then edited apart: 20 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.
Edited copy of a member (20 corresponding lines) codex-rs/tui/src/chatwidget/status_surfaces.rs:118— codex-rs/tui/src/chatwidget/status_surfaces.rs:118-137 | codex-rs/tui/src/chatwidget/status_surfaces.rs:139-158 — These two members are one piece of code written twice and then edited apart: 20 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.
Edited copy of a member (20 corresponding lines) codex-rs/code-mode-host/src/delegate.rs:31— codex-rs/code-mode-host/src/delegate.rs:31-50 | codex-rs/code-mode-host/src/delegate.rs:58-79 — These two members are one piece of code written twice and then edited apart: 20 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.
Edited copy of a member (20 corresponding lines) codex-rs/app-server-test-client/src/lib.rs:870— codex-rs/app-server-test-client/src/lib.rs:870-889 | codex-rs/app-server-test-client/src/lib.rs:896-915 — These two members are one piece of code written twice and then edited apart: 20 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.
Duplicated block (19 lines × 2) codex-rs/analytics/src/reducer.rs:3219— codex-rs/analytics/src/reducer.rs:3219-3237 | codex-rs/analytics/src/reducer.rs:3269-3287 — both copies are in the same file, so extract the 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:967— codex-rs/app-server-protocol/src/protocol/thread_history.rs:967-985 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:1026-1044 — both copies are in the same file, so extract the 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 first that the copies are not typed on the same thing: the declarations holding them bind `payload` to `&McpToolCallBeginEvent` in one and `&McpToolCallEndEvent` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (19 lines × 2) codex-rs/cloud-tasks/src/lib.rs:1963— codex-rs/cloud-tasks/src/lib.rs:1963-1981 | codex-rs/cloud-tasks/src/lib.rs:1984-2002 — both copies are in the same file, so extract the 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 `codex-rs/cloud-tasks/src/lib.rs:1984` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (19 lines × 2) codex-rs/code-mode-runtime/src/cell_actor/mod.rs:303— codex-rs/code-mode-runtime/src/cell_actor/mod.rs:303-321 | codex-rs/code-mode-runtime/src/cell_actor/mod.rs:420-438 — both copies are in the same file, so extract the 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 `codex-rs/code-mode-runtime/src/cell_actor/mod.rs:303` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (19 lines × 2) codex-rs/core/src/session/turn.rs:2506— codex-rs/core/src/session/turn.rs:2506-2524 | codex-rs/rollout-trace/src/protocol_event.rs:512-530 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core/src/session/turn.rs:2506` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/rollout-trace/src/protocol_event.rs:511` calls `ItemCompleted` and `codex-rs/core/src/session/turn.rs:2505` 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 (19 lines × 2) codex-rs/core/src/tools/handlers/mcp_resource.rs:411— codex-rs/core/src/tools/handlers/mcp_resource.rs:411-429 | codex-rs/core/src/tools/handlers/mcp_resource.rs:458-476 — both copies are in the same file, so extract the 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 `codex-rs/core/src/tools/handlers/mcp_resource.rs:411` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core/src/unified_exec/async_watcher.rs:355` 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.
Duplicated block (19 lines × 2) codex-rs/guardian-context/src/preparation/transcript.rs:70— codex-rs/guardian-context/src/preparation/transcript.rs:70-88 | codex-rs/guardian-context/src/preparation/transcript.rs:97-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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/hooks/src/engine/dispatcher.rs:81` 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.
Duplicated block (19 lines × 2) codex-rs/rollout/src/list.rs:506— codex-rs/rollout/src/list.rs:506-524 | codex-rs/rollout/src/list.rs:638-656 — both copies are in the same file, so extract the 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 `codex-rs/rollout/src/list.rs:506` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (19 lines × 2) codex-rs/tui/src/bottom_pane/chat_composer/slash_input.rs:558— codex-rs/tui/src/bottom_pane/chat_composer/slash_input.rs:558-576 | codex-rs/tui/src/chatwidget/slash_dispatch.rs:1406-1424 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (19 lines × 2) codex-rs/tui/src/bottom_pane/approval_overlay.rs:731— codex-rs/tui/src/bottom_pane/approval_overlay.rs:731-749 | codex-rs/tui/src/bottom_pane/approval_overlay.rs:775-793 — both copies are in the same file, so extract the 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/exec/src/lib.rs:1639— codex-rs/exec/src/lib.rs:1639-1657 | codex-rs/exec/src/lib.rs:1663-1681 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `response` to `&ThreadStartResponse` in one and `&ThreadResumeResponse` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
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.
Duplicated block (19 lines × 2) codex-rs/core/src/tools/handlers/mcp.rs:275— codex-rs/core/src/tools/handlers/mcp.rs:275-293 | codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs:138-156 — 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.
Session::new (cyclomatic 113) codex-rs/core/src/session/session.rs:790— Session::new has cyclomatic complexity 113 (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 48) codex-rs/core/src/session/world_state.rs:78— Session::build_world_state_for_step 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.
Session::assemble_initial_context (cyclomatic 38) codex-rs/core/src/session/mod.rs:5124— Session::assemble_initial_context has cyclomatic complexity 38 (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::initialize (cyclomatic 34) codex-rs/core/src/session/mod.rs:699— Session::initialize 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.
Session::on_task_finished (cyclomatic 28) codex-rs/core/src/tasks/mod.rs:721— Session::on_task_finished 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.
Session::refresh_config (cyclomatic 25) codex-rs/core/src/session/config_refresh.rs:53— Session::refresh_config 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.
Session::capture_step_context_inner (cyclomatic 24) codex-rs/core/src/session/mod.rs:4340— Session::capture_step_context_inner 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.
Session::record_initial_history (cyclomatic 21) codex-rs/core/src/session/mod.rs:1771— Session::record_initial_history 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.
Session::apply_turn_settings (cyclomatic 21) codex-rs/core/src/session/step_activation.rs:234— Session::apply_turn_settings 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:339— 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:4069— 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::request_approval_with_user_prompt (cyclomatic 18) codex-rs/core/src/tools/approvals.rs:563— Session::request_approval_with_user_prompt 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.
Session::project_selected_environment_mcp_servers (cyclomatic 17) codex-rs/core/src/session/mcp_runtime.rs:141— Session::project_selected_environment_mcp_servers 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.
Session::update_settings_if (cyclomatic 17) codex-rs/core/src/session/mod.rs:2171— Session::update_settings_if 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.
Session::start_task (cyclomatic 16) codex-rs/core/src/tasks/mod.rs:295— Session::start_task 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_exec_server::noise_relay::harness::noise_harness_connection_from_websocket_with_readiness (cognitive 130) codex-rs/exec-server/src/noise_relay/harness.rs:94— codex_exec_server::noise_relay::harness::noise_harness_connection_from_websocket_with_readiness has cognitive complexity 130 (threshold 15). Drivers by points: if/else 26 (77 pts), match/switch 15 (43 pts), boolean chains 8, loops 2 (nesting depth added 79). To reduce it, split the body into named stages: move each independent step 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::run_multiplexed_environment (cognitive 123) codex-rs/exec-server/src/relay.rs:513— codex_exec_server::relay::run_multiplexed_environment has cognitive complexity 123 (threshold 15). Drivers by points: if/else 22 (72 pts), match/switch 15 (44 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 82). To reduce it, split the body into named stages: move each independent step 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::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:1074— 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::server::missing_watch::watch_missing (cognitive 26) codex-rs/exec-server/src/server/missing_watch.rs:87— codex_exec_server::server::missing_watch::watch_missing has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 4 (8 pts), loops 4 (5 pts), boolean chains 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.
codex_exec_server::client::handle_server_notification (cognitive 24) codex-rs/exec-server/src/client.rs:1921— 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::process_sandbox::prepare_exec_request_with_telemetry (cognitive 21) codex-rs/exec-server/src/process_sandbox.rs:109— codex_exec_server::process_sandbox::prepare_exec_request_with_telemetry has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (15 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.
codex_exec_server::process_sandbox::prepare_managed_network (cognitive 19) codex-rs/exec-server/src/process_sandbox.rs:305— codex_exec_server::process_sandbox::prepare_managed_network has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (14 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.
codex_exec_server::shell_snapshot::capture_snapshot (cognitive 19) codex-rs/exec-server/src/shell_snapshot.rs:393— 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.
codex_rollout::metadata::backfill_sessions_with_lease (cognitive 60) codex-rs/rollout/src/metadata.rs:207— 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::list::read_head_summary (cognitive 43) codex-rs/rollout/src/list.rs:977— codex_rollout::list::read_head_summary has cognitive complexity 43 (threshold 15). Drivers by points: if/else 9 (27 pts), match/switch 3 (8 pts), boolean chains 7, 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::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::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::list::visit_rollout_filenames (cognitive 28) codex-rs/rollout/src/list.rs:1470— codex_rollout::list::visit_rollout_filenames has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (3 pts), boolean chains 2, match/switch 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_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:1273— 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::metadata::collect_rollout_paths (cognitive 23) codex-rs/rollout/src/metadata.rs:449— 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:1116— 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::recorder::fill_missing_thread_item_metadata (cognitive 18) codex-rs/rollout/src/recorder.rs:1433— codex_rollout::recorder::fill_missing_thread_item_metadata has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, 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.
codex_rollout::state_db::list_threads_db (cognitive 18) codex-rs/rollout/src/state_db.rs:352— codex_rollout::state_db::list_threads_db has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 4 (5 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server-protocol/src/protocol/event_mapping.rs:285` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server-protocol/src/protocol/event_mapping.rs:302` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core-plugins/src/startup_sync.rs:949` 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.
Duplicated block (16 lines × 2) codex-rs/core/src/mcp_tool_call.rs:1141— codex-rs/core/src/mcp_tool_call.rs:1141-1156 | codex-rs/core/src/mcp_tool_call.rs:1189-1204 — both copies are in the same file, so extract the 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 `codex-rs/core/src/mcp_tool_call.rs:1141` 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.
Duplicated block (16 lines × 2) codex-rs/exec-server/src/noise_relay/harness.rs:372— codex-rs/exec-server/src/noise_relay/harness.rs:372-387 | codex-rs/exec-server/src/noise_relay/harness.rs:540-555 — both copies are in the same file, so extract the 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:902— codex-rs/exec/src/lib.rs:902-917 | codex-rs/tui/src/lib.rs:2604-2619 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/exec/src/lib.rs:902` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/tui/src/lib.rs:2603` calls `restore_terminal_before_fatal_exit` and `codex-rs/exec/src/lib.rs:901` 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/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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/ext/skills/src/dynamic_skill_selector/routing_card_lexical.rs:37` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/history_cell/approvals.rs:287` 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.
Duplicated block (16 lines × 2) codex-rs/tui/src/tui.rs:1441— codex-rs/tui/src/tui.rs:1441-1456 | codex-rs/tui/src/tui.rs:1597-1612 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/tui.rs:1441` 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.
Duplicated block (16 lines × 2) codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:164— codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:164-179 | codex-rs/ext/skills/src/dynamic_skill_selector/fielded_bm25.rs:189-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 91 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (16 lines × 2) codex-rs/tui/src/unarchive_prompt.rs:192— codex-rs/tui/src/unarchive_prompt.rs:192-207 | codex-rs/tui/src/update_prompt.rs:247-262 — 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 `codex-rs/tui/src/unarchive_prompt.rs:192` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/hooks/src/events/compact.rs:95` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `PreCompactRequest` in one and `PostCompactRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
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:329-344 — 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 5 separate duplicated blocks between them, totalling at least 82 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:104` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server-test-client/src/lib.rs:874` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
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.
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:569— 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 25) codex-rs/network-proxy/src/socks5.rs:201— codex_network_proxy::socks5::handle_socks5_tcp has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (10 pts), match/switch 8 (10 pts), boolean chains 5 (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_network_proxy::network_policy::evaluate_host_policy_for_dial (cognitive 24) codex-rs/network-proxy/src/network_policy.rs:372— codex_network_proxy::network_policy::evaluate_host_policy_for_dial has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 3, match/switch 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_network_proxy::proxy::apply_proxy_env_overrides (cognitive 21) codex-rs/network-proxy/src/proxy.rs:774— codex_network_proxy::proxy::apply_proxy_env_overrides has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 2 (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_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::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:189— 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_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.
codex_config::loader::load_config_layers_state (cognitive 49) codex-rs/config/src/loader/mod.rs:147— codex_config::loader::load_config_layers_state has cognitive complexity 49 (threshold 15). Drivers by points: if/else 24 (36 pts), boolean chains 6, match/switch 2 (4 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.
codex_config::loader::sanitize_project_config (cognitive 45) codex-rs/config/src/loader/mod.rs:1345— 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::requirements_layers::stack::populate_merged_regular_fields_with_sources (cognitive 42) codex-rs/config/src/requirements_layers/stack.rs:248— 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 33) codex-rs/config/src/merge.rs:81— codex_config::merge::merge_toml_values_at_path has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (21 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:1857— 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:1238— 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:192— 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::strict_config::ignored_config_warning (cognitive 18) codex-rs/config/src/strict_config.rs:229— codex_config::strict_config::ignored_config_warning has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 4 (5 pts), match/switch 2 (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.
codex_config::tui_keymap::normalize_keybinding_stroke (cognitive 17) codex-rs/config/src/tui_keymap.rs:647— 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:793— 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.
Change-coupling hub: REDACTED → doctor.rs, api_bridge.rs, responses.rs, metrics.rs, execution.rs codex-rs/response-debug-context/src/lib.rs— `codex-rs/response-debug-context/src/lib.rs` changes together with 5 other files — `codex-rs/cli/src/doctor.rs`, `codex-rs/codex-api/src/api_bridge.rs`, `codex-rs/codex-api/src/sse/responses.rs`, `codex-rs/ext/guardian-v2/src/async_scorer/metrics.rs`, `codex-rs/ext/guardian-v2/src/async_scorer/sampler/execution.rs` — none of which declares a dependency on it: one file is the hub of 5 separate couplings, not 5 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 5.
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: section.rs → prompt.rs, extension.rs, transcript.rs codex-rs/guardian-context/src/section.rs— `codex-rs/guardian-context/src/section.rs` changes together with 3 other files — `codex-rs/core/src/guardian/prompt.rs`, `codex-rs/ext/guardian-v2/src/async_scorer/extension.rs`, `codex-rs/ext/guardian-v2/src/async_scorer/transcript.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: 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 → auto_compact_window.rs, protocol_event.rs, policy.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/state/auto_compact_window.rs`, `codex-rs/rollout-trace/src/protocol_event.rs`, `codex-rs/rollout/src/policy.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: chatwidget.rs → pending_interactive_replay.rs, thread_session_state.rs, pending_input_preview.rs, slash_commands.rs codex-rs/tui/src/chatwidget.rs— `codex-rs/tui/src/chatwidget.rs` changes together with 4 other files — `codex-rs/tui/src/app/pending_interactive_replay.rs`, `codex-rs/tui/src/app/thread_session_state.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 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: 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: tests.rs → environment_context.rs, prompt_debug.rs, review.rs, auto_compact_window.rs, thread_metadata_sync.rs codex-rs/core/src/session/tests.rs— `codex-rs/core/src/session/tests.rs` changes together with 5 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/core/src/state/auto_compact_window.rs`, `codex-rs/thread-store/src/thread_metadata_sync.rs` — none of which declares a dependency on it: one file is the hub of 5 separate couplings, not 5 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 5.
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: 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.
Change-coupling hub: plugin_mentions.rs → tests.rs, plugins.rs, remote.rs, tests.rs codex-rs/tui/src/app/plugin_mentions.rs— `codex-rs/tui/src/app/plugin_mentions.rs` changes together with 4 other files — `codex-rs/app-server-protocol/src/protocol/v2/tests.rs`, `codex-rs/app-server/src/request_processors/plugins.rs`, `codex-rs/core-plugins/src/remote.rs`, `codex-rs/core-plugins/src/remote/share/tests.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: 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.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×14
Edited copy of a member (22 corresponding lines) codex-rs/tui/src/markdown_render.rs:2098— codex-rs/tui/src/markdown_render.rs:2098-2119 | codex-rs/tui/src/markdown_render/table_key_value.rs:283-304 — These two members are one piece of code written twice and then edited apart: 22 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.
Edited copy of a member (22 corresponding lines) codex-rs/external-agent-migration/src/detect/sessions/connectors_cla.rs:209— codex-rs/external-agent-migration/src/detect/sessions/connectors_cla.rs:209-230 | codex-rs/external-agent-migration/src/detect/sessions/cur.rs:59-84 — These two members are one piece of code written twice and then edited apart: 22 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.
Edited copy of a member (22 corresponding lines) codex-rs/http-client/src/custom_ca.rs:692— codex-rs/http-client/src/custom_ca.rs:692-716 | codex-rs/network-proxy/src/certs.rs:522-543 — These two members are one piece of code written twice and then edited apart: 22 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.
Edited copy of a member (22 corresponding lines) codex-rs/codex-api/src/endpoint/realtime_websocket/protocol_v2.rs:142— codex-rs/codex-api/src/endpoint/realtime_websocket/protocol_v2.rs:142-166 | codex-rs/codex-api/src/endpoint/realtime_websocket/protocol_v2.rs:168-189 — These two members are one piece of code written twice and then edited apart: 22 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.
Edited copy of a member (22 corresponding lines) codex-rs/cli/src/doctor/output.rs:813— codex-rs/cli/src/doctor/output.rs:813-838 | codex-rs/cli/src/doctor/output.rs:1073-1094 — These two members are one piece of code written twice and then edited apart: 22 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.
Edited copy of a member (22 corresponding lines) codex-rs/cloud-client/src/activation.rs:253— codex-rs/cloud-client/src/activation.rs:253-274 | codex-rs/cloud-client/src/lib.rs:339-361 — These two members are one piece of code written twice and then edited apart: 22 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.
Edited copy of a member (22 corresponding lines) codex-rs/tui/src/chatwidget/plugin_catalog.rs:2030— codex-rs/tui/src/chatwidget/plugin_catalog.rs:2030-2051 | codex-rs/tui/src/external_agent_config_migration/model.rs:118-142 — These two members are one piece of code written twice and then edited apart: 22 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.
Edited copy of a member (22 corresponding lines) codex-rs/tui/src/history_cell/session.rs:351— codex-rs/tui/src/history_cell/session.rs:351-372 | codex-rs/tui/src/status/helpers.rs:148-169 — These two members are one piece of code written twice and then edited apart: 22 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.
Edited copy of a member (22 corresponding lines) codex-rs/code-mode-runtime/src/service.rs:197— codex-rs/code-mode-runtime/src/service.rs:197-218 | codex-rs/code-mode-runtime/src/service.rs:223-248 — These two members are one piece of code written twice and then edited apart: 22 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.
Edited copy of a member (22 corresponding lines) codex-rs/login/src/auth/storage.rs:593— codex-rs/login/src/auth/storage.rs:593-619 | codex-rs/login/src/auth/storage.rs:621-642 — These two members are one piece of code written twice and then edited apart: 22 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.
Edited copy of a member (22 corresponding lines) codex-rs/app-server/src/request_processors/thread_queue_processor.rs:82— codex-rs/app-server/src/request_processors/thread_queue_processor.rs:82-103 | codex-rs/app-server/src/request_processors/thread_queue_processor.rs:145-173 — These two members are one piece of code written twice and then edited apart: 22 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.
Edited copy of a member (22 corresponding lines) codex-rs/core/src/tools/handlers/send_message_to_user_async.rs:36— codex-rs/core/src/tools/handlers/send_message_to_user_async.rs:36-57 | codex-rs/ext/goal/src/spec.rs:60-94 — These two members are one piece of code written twice and then edited apart: 22 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.
Edited copy of a member (22 corresponding lines) codex-rs/exec-server/src/connection.rs:199— codex-rs/exec-server/src/connection.rs:199-221 | codex-rs/exec-server/src/connection.rs:223-244 — These two members are one piece of code written twice and then edited apart: 22 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.
Edited copy of a member (22 corresponding lines) codex-rs/network-proxy/src/network_policy.rs:130— codex-rs/network-proxy/src/network_policy.rs:130-154 | codex-rs/protocol/src/mcp.rs:424-445 — These two members are one piece of code written twice and then edited apart: 22 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.
codex_cli::dispatch_cli (cyclomatic 102) codex-rs/cli/src/main.rs:1063— codex_cli::dispatch_cli has cyclomatic complexity 102 (threshold 15). To reduce it, separate the cases: extract each independent 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 41) codex-rs/cli/src/doctor.rs:1534— codex_cli::doctor::mcp_check_from_servers 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.
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 30) codex-rs/cli/src/debug_sandbox.rs:208— codex_cli::debug_sandbox::run_command_under_sandbox 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.
codex_cli::doctor::stored_auth_issues (cyclomatic 26) codex-rs/cli/src/doctor.rs:1417— 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 22) codex-rs/cli/src/mcp_cmd.rs:969— codex_cli::mcp_cmd::run_get 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.
codex_cli::plugin_cmd::render_plugin_list (cyclomatic 20) codex-rs/cli/src/plugin_cmd.rs:337— 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:691— 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.
TranscriptView::handle_select_mode_key (cyclomatic 52) codex-rs/tui/src/transcript_view/select_mode.rs:185— TranscriptView::handle_select_mode_key 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.
TranscriptView::move_copy_target (cyclomatic 38) codex-rs/tui/src/transcript_view/copy_mode.rs:91— TranscriptView::move_copy_target 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.
TranscriptView::handle_mouse_with_mode (cyclomatic 31) codex-rs/tui/src/transcript_view/input.rs:300— 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::paint_rows (cyclomatic 30) codex-rs/tui/src/transcript_view.rs:193— TranscriptView::paint_rows 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.
TranscriptView::footer_with_navigation (cyclomatic 29) codex-rs/tui/src/transcript_view/footer.rs:17— TranscriptView::footer_with_navigation 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.
TranscriptView::handle_disclosure_key (cyclomatic 28) codex-rs/tui/src/transcript_view/disclosure.rs:212— 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::handle_search_key (cyclomatic 21) codex-rs/tui/src/transcript_view/search.rs:185— 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::entry_layout (cyclomatic 20) codex-rs/tui/src/transcript_view/layout.rs:214— TranscriptView::entry_layout 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.
TranscriptView::handle_key (cyclomatic 19) codex-rs/tui/src/transcript_view/input.rs:194— 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::move_select_cursor (cyclomatic 19) codex-rs/tui/src/transcript_view/select_mode/motion.rs:9— TranscriptView::move_select_cursor 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.
TranscriptView::owns_interaction_key (cyclomatic 18) codex-rs/tui/src/transcript_view/input.rs:156— 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.
TranscriptView::toggle_activity (cyclomatic 16) codex-rs/tui/src/transcript_view/disclosure.rs:372— TranscriptView::toggle_activity 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.
TranscriptView::pointer_down (cyclomatic 16) codex-rs/tui/src/transcript_view/input.rs:513— TranscriptView::pointer_down 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.
TextArea::apply_vim_editor_action (cognitive 43) codex-rs/tui/src/bottom_pane/textarea/vim_commands.rs:345— 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:843— 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:100— 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::input_with_keymap (cognitive 23) codex-rs/tui/src/bottom_pane/textarea.rs:674— TextArea::input_with_keymap has cognitive complexity 23 (threshold 15). Drivers by points: if/else 21 (22 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::move_cursor_up (cognitive 23) codex-rs/tui/src/bottom_pane/textarea.rs:1497— 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::apply_vim_operator (cognitive 22) codex-rs/tui/src/bottom_pane/textarea.rs:1094— 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:1568— 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:485— 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::apply_vim_insert_action (cognitive 18) codex-rs/tui/src/bottom_pane/textarea/vim_commands.rs:243— TextArea::apply_vim_insert_action has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 8 (9 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.
TextArea::replace_element_payload_by_id (cognitive 18) codex-rs/tui/src/bottom_pane/textarea.rs:1750— TextArea::replace_element_payload_by_id 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· Edited copy of a member (18 corresponding lines) · ×13
Edited copy of a member (18 corresponding lines) codex-rs/tui/src/bottom_pane/list_selection_view.rs:1148— codex-rs/tui/src/bottom_pane/list_selection_view.rs:1148-1167 | codex-rs/tui/src/bottom_pane/list_selection_view.rs:1169-1186 — These two members are one piece of code written twice and then edited apart: 18 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.
Edited copy of a member (18 corresponding lines) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:920— codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:920-937 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:394-417 — These two members are one piece of code written twice and then edited apart: 18 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.
Edited copy of a member (18 corresponding lines) codex-rs/code-mode/src/grpc_session/mod.rs:488— codex-rs/code-mode/src/grpc_session/mod.rs:488-508 | codex-rs/code-mode/src/remote_session.rs:413-430 — These two members are one piece of code written twice and then edited apart: 18 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.
Edited copy of a member (18 corresponding lines) codex-rs/cloud-client/src/lib.rs:130— codex-rs/cloud-client/src/lib.rs:130-147 | codex-rs/cloud-client/src/lib.rs:279-299 — These two members are one piece of code written twice and then edited apart: 18 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.
Edited copy of a member (18 corresponding lines) codex-rs/app-server-protocol/src/export.rs:731— codex-rs/app-server-protocol/src/export.rs:731-748 | codex-rs/app-server-protocol/src/export.rs:2042-2060 — These two members are one piece of code written twice and then edited apart: 18 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.
Edited copy of a member (18 corresponding lines) codex-rs/windows-sandbox-rs/src/file_write.rs:122— codex-rs/windows-sandbox-rs/src/file_write.rs:122-145 | codex-rs/windows-sandbox-rs/src/no_reparse_dir.rs:205-222 — These two members are one piece of code written twice and then edited apart: 18 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.
Edited copy of a member (18 corresponding lines) codex-rs/exec-server/src/remote_file_system.rs:109— codex-rs/exec-server/src/remote_file_system.rs:109-126 | codex-rs/exec-server/src/sandboxed_file_system.rs:147-168 — These two members are one piece of code written twice and then edited apart: 18 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.
Edited copy of a member (18 corresponding lines) codex-rs/code-mode-host/src/lib.rs:235— codex-rs/code-mode-host/src/lib.rs:235-252 | codex-rs/code-mode/src/remote_session/connection.rs:541-560 — These two members are one piece of code written twice and then edited apart: 18 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.
Edited copy of a member (18 corresponding lines) codex-rs/network-proxy/src/windows_proxy_ingress.rs:339— codex-rs/network-proxy/src/windows_proxy_ingress.rs:339-356 | codex-rs/network-proxy/src/windows_tcp_attribution.rs:139-157 — These two members are one piece of code written twice and then edited apart: 18 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.
Edited copy of a member (18 corresponding lines) codex-rs/code-mode-host/src/grpc/conversions.rs:48— codex-rs/code-mode-host/src/grpc/conversions.rs:48-65 | codex-rs/code-mode/src/grpc_session/conversion.rs:33-51 — These two members are one piece of code written twice and then edited apart: 18 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.
Edited copy of a member (18 corresponding lines) codex-rs/app-server/src/request_processors/thread_processor.rs:6621— codex-rs/app-server/src/request_processors/thread_processor.rs:6621-6638 | codex-rs/app-server/src/request_processors/thread_processor.rs:6643-6665 — These two members are one piece of code written twice and then edited apart: 18 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.
Edited copy of a member (18 corresponding lines) codex-rs/protocol/src/models.rs:236— codex-rs/protocol/src/models.rs:236-253 | codex-rs/protocol/src/models.rs:367-384 — These two members are one piece of code written twice and then edited apart: 18 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.
Edited copy of a member (18 corresponding lines) codex-rs/app-server/src/command_exec.rs:638— codex-rs/app-server/src/command_exec.rs:638-655 | codex-rs/app-server/src/request_processors/process_exec_processor.rs:709-728 — These two members are one piece of code written twice and then edited apart: 18 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.
codex_app_server::run_main_with_transport_options (cyclomatic 112) codex-rs/app-server/src/lib.rs:515— codex_app_server::run_main_with_transport_options has cyclomatic complexity 112 (threshold 15). To reduce it, separate the cases: extract each independent 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 106) codex-rs/app-server/src/bespoke_event_handling.rs:148— codex_app_server::bespoke_event_handling::apply_bespoke_event_handling has cyclomatic complexity 106 (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::thread_lifecycle::start_listener (cyclomatic 75) codex-rs/app-server/src/request_processors/thread_lifecycle.rs:330— codex_app_server::request_processors::thread_lifecycle::start_listener 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.
codex_app_server::in_process::start_uninitialized (cyclomatic 53) codex-rs/app-server/src/in_process.rs:463— codex_app_server::in_process::start_uninitialized 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.
codex_app_server::request_processors::thread_lifecycle::handle_pending_thread_resume_request (cyclomatic 28) codex-rs/app-server/src/request_processors/thread_lifecycle.rs:1023— codex_app_server::request_processors::thread_lifecycle::handle_pending_thread_resume_request 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_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::collect_resume_override_mismatches (cyclomatic 25) codex-rs/app-server/src/request_processors/thread_processor.rs:137— codex_app_server::request_processors::thread_processor::collect_resume_override_mismatches 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_app_server::request_processors::thread_processor::validate_dynamic_tools (cyclomatic 24) codex-rs/app-server/src/request_processors/thread_processor.rs:358— 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::config_manager_service_provider_write::provider_edits (cyclomatic 21) codex-rs/app-server/src/config_manager_service_provider_write.rs:79— codex_app_server::config_manager_service_provider_write::provider_edits 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_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::bespoke_event_handling::on_command_execution_request_approval_response (cyclomatic 18) codex-rs/app-server/src/bespoke_event_handling.rs:2071— codex_app_server::bespoke_event_handling::on_command_execution_request_approval_response 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_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.
ChatComposer::render_with_options (cyclomatic 70) codex-rs/tui/src/bottom_pane/chat_composer.rs:4659— ChatComposer::render_with_options 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.
ChatComposer::handle_input_basic_with_time (cyclomatic 40) codex-rs/tui/src/bottom_pane/chat_composer.rs:3740— ChatComposer::handle_input_basic_with_time 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.
ChatComposer::handle_key_event_without_popup (cyclomatic 34) codex-rs/tui/src/bottom_pane/chat_composer.rs:3586— 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::passive_hints (cyclomatic 23) codex-rs/tui/src/bottom_pane/chat_composer/passive_hints.rs:248— ChatComposer::passive_hints 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.
ChatComposer::sync_popups (cyclomatic 21) codex-rs/tui/src/bottom_pane/chat_composer.rs:4019— 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::handle_restricted_key (cyclomatic 20) codex-rs/tui/src/bottom_pane/chat_composer/reconnect.rs:61— ChatComposer::handle_restricted_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.
ChatComposer::mention_items (cyclomatic 20) codex-rs/tui/src/bottom_pane/chat_composer.rs:4318— 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:3275— 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:2379— 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:3117— 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.
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.
Writer::pop_link (cognitive 51) codex-rs/tui/src/markdown_render.rs:2289— 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:1885— 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:694— 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:1794— 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:2015— 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::end_codeblock (cognitive 24) codex-rs/tui/src/markdown_render.rs:1196— Writer::end_codeblock has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (7 pts), boolean chains 3, 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.
Writer::render_table_lines (cognitive 23) codex-rs/tui/src/markdown_render.rs:1469— Writer::render_table_lines has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 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.
Writer::html (cognitive 21) codex-rs/tui/src/markdown_render.rs:987— 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:1703— 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::text (cognitive 19) codex-rs/tui/src/markdown_render.rs:907— 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::prefix_spans (cognitive 18) codex-rs/tui/src/markdown_render.rs:2645— 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:1084— 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.
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:2530-2546 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (17 lines × 2) codex-rs/core/src/unified_exec/process_manager.rs:688— codex-rs/core/src/unified_exec/process_manager.rs:688-704 | codex-rs/core/src/unified_exec/process_manager.rs:710-726 — both copies are in the same file, so extract the 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 `codex-rs/core/src/unified_exec/process_manager.rs:688` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/core/src/unified_exec/process_manager.rs:728` calls `Err` and `codex-rs/core/src/unified_exec/process_manager.rs:706` 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) codex-rs/ext/goal/src/api.rs:180— codex-rs/ext/goal/src/api.rs:180-196 | codex-rs/ext/goal/src/api.rs:303-319 — both copies are in the same file, so extract the 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/ext/memories/src/schema.rs:24— codex-rs/ext/memories/src/schema.rs:24-40 | codex-rs/ext/skills/src/tools/schema.rs:24-40 — before extracting anything, compare `codex-rs/ext/memories/src/schema.rs` and `codex-rs/ext/skills/src/tools/schema.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 40 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 (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:834-850 — 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 `codex-rs/rmcp-client/src/executor_process_transport.rs:510` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/shell-command/src/parse_command.rs:1483` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/shell-command/src/parse_command.rs:2049` calls `retain` and `codex-rs/shell-command/src/parse_command.rs:1501` does not — after which the two agree again for 3 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/feedback/src/lib.rs:143— codex-rs/feedback/src/lib.rs:143-159 | codex-rs/feedback/src/lib.rs:167-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/feedback/src/lib.rs:143` 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.
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:710— codex-rs/rmcp-client/src/bin/test_stdio_server.rs:710-726 | codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs:306-322 — 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 4 separate duplicated blocks between them, totalling at least 50 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/rmcp-client/src/bin/test_stdio_server.rs:710` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
codex_exec_server::noise_relay::harness::noise_harness_connection_from_websocket_with_readiness (cyclomatic 66) codex-rs/exec-server/src/noise_relay/harness.rs:94— codex_exec_server::noise_relay::harness::noise_harness_connection_from_websocket_with_readiness has cyclomatic complexity 66 (threshold 15). To reduce it, separate the cases: extract each independent 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 52) codex-rs/exec-server/src/relay.rs:513— codex_exec_server::relay::run_multiplexed_environment 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_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::server::missing_watch::watch_missing (cyclomatic 23) codex-rs/exec-server/src/server/missing_watch.rs:87— codex_exec_server::server::missing_watch::watch_missing 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.
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 17) codex-rs/exec-server/src/process_sandbox.rs:109— codex_exec_server::process_sandbox::prepare_exec_request_with_telemetry 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_exec_server::process_sandbox::prepare_managed_network (cyclomatic 17) codex-rs/exec-server/src/process_sandbox.rs:305— codex_exec_server::process_sandbox::prepare_managed_network 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_exec_server::client::handle_server_notification (cyclomatic 16) codex-rs/exec-server/src/client.rs:1921— 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.
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.
codex_skills_extension::host_roots::repo_agents_skill_roots (cognitive 39) codex-rs/ext/skills/src/host_roots.rs:192— codex_skills_extension::host_roots::repo_agents_skill_roots has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (19 pts), match/switch 4 (13 pts), loops 2 (4 pts), boolean chains 3 (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_skills_extension::loader::discovery::discover_skills (cognitive 25) codex-rs/ext/skills/src/loader/discovery.rs:55— codex_skills_extension::loader::discovery::discover_skills has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 6, match/switch 3 (4 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_skills_extension::loader::host_merge::load_and_merge_host_skill_roots_with_request_snapshots (cognitive 23) codex-rs/ext/skills/src/loader/host_merge.rs:43— codex_skills_extension::loader::host_merge::load_and_merge_host_skill_roots_with_request_snapshots has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4, match/switch 2 (4 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_skills_extension::catalog_delta::build_catalog_update (cognitive 22) codex-rs/ext/skills/src/catalog_delta.rs:186— codex_skills_extension::catalog_delta::build_catalog_update has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 7, loops 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.
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:428— 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::loader::host::load_skills_under_root (cognitive 18) codex-rs/ext/skills/src/loader/host.rs:146— codex_skills_extension::loader::host::load_skills_under_root has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 7 (9 pts), if/else 5 (7 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::catalog::apply_plugin_denials (cognitive 17) codex-rs/ext/skills/src/catalog.rs:378— 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_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.
Duplicated block (18 lines × 2) codex-rs/app-server-protocol/src/protocol/v2/config.rs:117— codex-rs/app-server-protocol/src/protocol/v2/config.rs:117-134 | codex-rs/config/src/config_layer_source.rs:69-86 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (18 lines × 2) codex-rs/app-server-transport/src/transport/remote_control/mod.rs:827— codex-rs/app-server-transport/src/transport/remote_control/mod.rs:827-844 | codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:339-356 — 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 `codex-rs/app-server-transport/src/transport/remote_control/mod.rs:827` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (18 lines × 2) codex-rs/core-plugins/src/marketplace_upgrade/git.rs:297— codex-rs/core-plugins/src/marketplace_upgrade/git.rs:297-314 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core-plugins/src/marketplace_upgrade/git.rs:297` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/core-plugins/src/marketplace_upgrade/git.rs:296` calls `elapsed` and `codex-rs/core-plugins/src/startup_sync.rs:716` 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) codex-rs/core/src/client.rs:433— codex-rs/core/src/client.rs:433-450 | codex-rs/core/src/client.rs:451-468 — both copies are in the same file, so extract the 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/hooks/src/events/session_start.rs:191— 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/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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/hooks/src/events/session_start.rs:191` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (18 lines × 2) codex-rs/tui/src/bottom_pane/approval_overlay.rs:804— codex-rs/tui/src/bottom_pane/approval_overlay.rs:804-821 | codex-rs/tui/src/bottom_pane/user_verification.rs:280-297 — 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/approval_overlay.rs:804` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `&ApprovalRequest` in one and `&UserVerificationRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (18 lines × 2) codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:896— codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:896-913 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:920-937 — both copies are in the same file, so extract the 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:499— codex-rs/thread-store/src/local/thread_history.rs:499-516 | codex-rs/thread-store/src/local/thread_history.rs:518-537 — both copies are in the same file, so extract the 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 `codex-rs/thread-store/src/local/thread_history.rs:499` 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.
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.
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:1505— 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:4184— 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:393— 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:460— 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:277— 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:431— 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:435— 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.
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.
codex_thread_store::local::update_thread_metadata::apply_metadata_update (cyclomatic 55) codex-rs/thread-store/src/local/update_thread_metadata.rs:350— codex_thread_store::local::update_thread_metadata::apply_metadata_update 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.
codex_thread_store::local::update_thread_metadata::update_thread_metadata (cyclomatic 43) codex-rs/thread-store/src/local/update_thread_metadata.rs:38— codex_thread_store::local::update_thread_metadata::update_thread_metadata 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_thread_store::local::thread_history_materialization::read_projection_batches (cyclomatic 25) codex-rs/thread-store/src/local/thread_history_materialization.rs:122— codex_thread_store::local::thread_history_materialization::read_projection_batches 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_thread_store::local::thread_history::segment_paging::page_item_rows (cyclomatic 24) codex-rs/thread-store/src/local/thread_history/segment_paging.rs:235— codex_thread_store::local::thread_history::segment_paging::page_item_rows 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::search_threads::search_threads (cyclomatic 23) codex-rs/thread-store/src/local/search_threads.rs:36— codex_thread_store::local::search_threads::search_threads 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::thread_history::realtime_stream::read_page (cyclomatic 22) codex-rs/thread-store/src/local/thread_history/realtime_stream.rs:119— codex_thread_store::local::thread_history::realtime_stream::read_page 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.
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::rollout_migration::legacy_event::user_message_item (cyclomatic 19) codex-rs/thread-store/src/local/rollout_migration/legacy_event.rs:39— codex_thread_store::local::rollout_migration::legacy_event::user_message_item 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:154— 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.
codex_thread_store::local::unarchive_thread::unarchive_thread_with_index (cyclomatic 16) codex-rs/thread-store/src/local/unarchive_thread.rs:86— codex_thread_store::local::unarchive_thread::unarchive_thread_with_index 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.
ThreadRequestProcessor::thread_fork_inner (cognitive 131) codex-rs/app-server/src/request_processors/thread_processor.rs:5297— ThreadRequestProcessor::thread_fork_inner has cognitive complexity 131 (threshold 15). Drivers by points: if/else 68 (83 pts), boolean chains 33, match/switch 7 (13 pts), loops 1 (2 pts) (nesting depth added 22). 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 120) codex-rs/app-server/src/request_processors/thread_processor.rs:3959— ThreadRequestProcessor::thread_resume_inner has cognitive complexity 120 (threshold 15). Drivers by points: if/else 46 (73 pts), match/switch 16 (31 pts), boolean chains 16 (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.
ThreadRequestProcessor::resume_running_thread (cognitive 61) codex-rs/app-server/src/request_processors/thread_processor.rs:4669— ThreadRequestProcessor::resume_running_thread has cognitive complexity 61 (threshold 15). Drivers by points: if/else 22 (37 pts), boolean chains 12, match/switch 4 (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.
ThreadRequestProcessor::list_threads_common (cognitive 29) codex-rs/app-server/src/request_processors/thread_processor.rs:6054— ThreadRequestProcessor::list_threads_common has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 3, loops 2 (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.
ThreadRequestProcessor::thread_revert_response (cognitive 27) codex-rs/app-server/src/request_processors/thread_processor.rs:2262— ThreadRequestProcessor::thread_revert_response has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (18 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::thread_metadata_update_response_inner (cognitive 23) codex-rs/app-server/src/request_processors/thread_processor.rs:2053— 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:1450— 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:2932— 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::thread_list_response_inner (cognitive 17) codex-rs/app-server/src/request_processors/thread_processor.rs:2753— ThreadRequestProcessor::thread_list_response_inner has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), match/switch 4 (5 pts), boolean chains 3, 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.
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.
codex_sandboxing::seatbelt::seatbelt_regex_for_glob (cognitive 48) REDACTED:683— 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:818— codex_sandboxing::seatbelt::create_seatbelt_command_args_with_profile has cognitive complexity 37 (threshold 15). Drivers by points: if/else 19 (26 pts), loops 4 (10 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::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:472— 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_elevated_filesystem_overrides (cognitive 24) codex-rs/sandboxing/src/windows.rs:209— 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:592— 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:305— 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::windows::resolve_windows_restricted_token_filesystem_overrides (cognitive 19) codex-rs/sandboxing/src/windows.rs:78— codex_sandboxing::windows::resolve_windows_restricted_token_filesystem_overrides has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, 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.
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 CVE · ×10
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×10
Edited copy of a member (19 corresponding lines) codex-rs/network-proxy/src/runtime.rs:796— codex-rs/network-proxy/src/runtime.rs:796-818 | codex-rs/network-proxy/src/runtime.rs:1265-1283 — These two members are one piece of code written twice and then edited apart: 19 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.
Edited copy of a member (19 corresponding lines) codex-rs/config-schema/src/main.rs:25— codex-rs/config-schema/src/main.rs:25-43 | codex-rs/hooks/src/bin/write_hooks_schema_fixtures.rs:11-29 — These two members are one piece of code written twice and then edited apart: 19 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.
Edited copy of a member (19 corresponding lines) codex-rs/tui/src/ide_context/windows_pipe.rs:97— codex-rs/tui/src/ide_context/windows_pipe.rs:97-115 | codex-rs/tui/src/ide_context/windows_pipe.rs:119-137 — These two members are one piece of code written twice and then edited apart: 19 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.
Edited copy of a member (19 corresponding lines) codex-rs/cli/src/doctor.rs:2987— codex-rs/cli/src/doctor.rs:2987-3005 | codex-rs/cli/src/doctor.rs:3013-3031 — These two members are one piece of code written twice and then edited apart: 19 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.
Edited copy of a member (19 corresponding lines) codex-rs/core/src/thread_manager.rs:1606— codex-rs/core/src/thread_manager.rs:1606-1625 | codex-rs/core/src/thread_manager.rs:1651-1669 — These two members are one piece of code written twice and then edited apart: 19 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.
Edited copy of a member (19 corresponding lines) scripts/mcp_conformance/review_regressions.py:95— scripts/mcp_conformance/review_regressions.py:95-113 | scripts/mcp_conformance/run_codex_compliance.py:466-484 — These two members are one piece of code written twice and then edited apart: 19 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.
Edited copy of a member (19 corresponding lines) codex-rs/tui/src/app_backtrack.rs:321— codex-rs/tui/src/app_backtrack.rs:321-341 | codex-rs/tui/src/app_backtrack.rs:344-362 — These two members are one piece of code written twice and then edited apart: 19 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.
Edited copy of a member (19 corresponding lines) codex-rs/core-plugins/src/marketplace_upgrade/git.rs:219— codex-rs/core-plugins/src/marketplace_upgrade/git.rs:219-237 | codex-rs/core-plugins/src/startup_sync.rs:640-663 — These two members are one piece of code written twice and then edited apart: 19 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.
Edited copy of a member (19 corresponding lines) codex-rs/rollout-trace/src/inference.rs:269— codex-rs/rollout-trace/src/inference.rs:269-287 | codex-rs/rollout-trace/src/inference.rs:299-317 — These two members are one piece of code written twice and then edited apart: 19 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.
Edited copy of a member (19 corresponding lines) codex-rs/app-server-test-client/src/plugin_analytics_capture.rs:55— codex-rs/app-server-test-client/src/plugin_analytics_capture.rs:55-73 | codex-rs/app-server-test-client/src/plugin_analytics_smoke.rs:408-429 — These two members are one piece of code written twice and then edited apart: 19 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 (6 corresponding lines) · ×10
Edited copy of a member (6 corresponding lines) codex-rs/core-plugins/src/tool_suggest_metadata.rs:164— codex-rs/core-plugins/src/tool_suggest_metadata.rs:164-169 | codex-rs/ext/skills/src/host_service.rs:488-493 — These two members are one piece of code written twice and then edited apart: 6 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.
Edited copy of a member (6 corresponding lines) codex-rs/tui/src/multi_agents.rs:494— codex-rs/tui/src/multi_agents.rs:494-499 | codex-rs/tui/src/status/format.rs:46-51 — These two members are one piece of code written twice and then edited apart: 6 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.
Edited copy of a member (6 corresponding lines) codex-rs/cli/src/desktop_app/mac.rs:151— codex-rs/cli/src/desktop_app/mac.rs:151-157 | codex-rs/cli/src/desktop_app/windows.rs:69-74 — These two members are one piece of code written twice and then edited apart: 6 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.
Edited copy of a member (6 corresponding lines) codex-rs/login/src/oauth_session.rs:427— codex-rs/login/src/oauth_session.rs:427-432 | codex-rs/login/src/oauth_session_login.rs:241-246 — These two members are one piece of code written twice and then edited apart: 6 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.
Edited copy of a member (6 corresponding lines) codex-rs/app-server/src/lib.rs:1520— codex-rs/app-server/src/lib.rs:1520-1525 | codex-rs/cli/src/state_db_recovery.rs:24-30 — These two members are one piece of code written twice and then edited apart: 6 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.
Edited copy of a member (6 corresponding lines) codex-rs/core-plugins/src/manager.rs:1146— codex-rs/core-plugins/src/manager.rs:1146-1151 | codex-rs/core-plugins/src/tool_suggest_metadata.rs:171-176 — These two members are one piece of code written twice and then edited apart: 6 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.
Edited copy of a member (6 corresponding lines) codex-rs/rollout/src/compression.rs:1266— codex-rs/rollout/src/compression.rs:1266-1271 | codex-rs/thread-store/src/local/thread_history_materialization.rs:413-422 — These two members are one piece of code written twice and then edited apart: 6 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.
Edited copy of a member (6 corresponding lines) codex-rs/config/src/config_toml.rs:639— codex-rs/config/src/config_toml.rs:639-644 | codex-rs/execpolicy/src/rule.rs:29-34 — These two members are one piece of code written twice and then edited apart: 6 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.
Edited copy of a member (6 corresponding lines) codex-rs/app-server-protocol/src/protocol/v2/config.rs:612— codex-rs/app-server-protocol/src/protocol/v2/config.rs:612-617 | codex-rs/config/src/browser_computer_use_requirements.rs:87-92 — These two members are one piece of code written twice and then edited apart: 6 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.
Edited copy of a member (6 corresponding lines) codex-rs/core/src/tools/handlers/tool_search.rs:139— codex-rs/core/src/tools/handlers/tool_search.rs:139-144 | codex-rs/thread-store/src/in_memory.rs:494-499 — These two members are one piece of code written twice and then edited apart: 6 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.
ThreadRequestProcessor::thread_fork_inner (cyclomatic 102) codex-rs/app-server/src/request_processors/thread_processor.rs:5297— ThreadRequestProcessor::thread_fork_inner has cyclomatic complexity 102 (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 69) codex-rs/app-server/src/request_processors/thread_processor.rs:3959— ThreadRequestProcessor::thread_resume_inner has cyclomatic complexity 69 (threshold 15). To reduce it, separate the cases: extract each independent 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 35) codex-rs/app-server/src/request_processors/thread_processor.rs:4669— ThreadRequestProcessor::resume_running_thread 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.
ThreadRequestProcessor::thread_list_response_inner (cyclomatic 24) codex-rs/app-server/src/request_processors/thread_processor.rs:2753— ThreadRequestProcessor::thread_list_response_inner 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.
ThreadRequestProcessor::thread_revert_response (cyclomatic 22) codex-rs/app-server/src/request_processors/thread_processor.rs:2262— ThreadRequestProcessor::thread_revert_response 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.
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:1450— 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:2053— 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.
ThreadRequestProcessor::list_threads_common (cyclomatic 17) codex-rs/app-server/src/request_processors/thread_processor.rs:6054— ThreadRequestProcessor::list_threads_common 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_cloud_tasks::run_cloud (cognitive 757) codex-rs/cloud-tasks/src/lib.rs:827— codex_cloud_tasks::run_cloud has cognitive complexity 757 (threshold 15). Drivers by points: if/else 125 (595 pts), match/switch 25 (127 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:2154— 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:331— 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:231— 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:490— 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:50— 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.
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::info::remotes::get_git_remote_urls_with_progress (cognitive 25) codex-rs/git-utils/src/info/remotes.rs:52— codex_git_utils::info::remotes::get_git_remote_urls_with_progress has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 4, loops 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.
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:416— 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:566— 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:672— 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:495— 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.
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.
PluginsManager::plugins_for_config (cognitive 36) codex-rs/core-plugins/src/manager.rs:944— 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 27) codex-rs/core-plugins/src/manager.rs:2994— PluginsManager::maybe_start_plugin_startup_tasks_for_config has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 4 (9 pts), loops 1 (4 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.
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:3484— 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::read_plugin_detail_for_marketplace_plugin (cognitive 19) codex-rs/core-plugins/src/manager.rs:2793— 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:3236— 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.
PluginsManager::write_remote_installed_plugins_cache_snapshot (cognitive 17) codex-rs/core-plugins/src/manager.rs:1589— PluginsManager::write_remote_installed_plugins_cache_snapshot has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 6, 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.
PluginsManager::schedule_non_curated_plugin_cache_refresh (cognitive 17) codex-rs/core-plugins/src/manager.rs:3351— PluginsManager::schedule_non_curated_plugin_cache_refresh has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, 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::run_non_curated_plugin_cache_refresh_loop (cognitive 17) codex-rs/core-plugins/src/manager.rs:3654— PluginsManager::run_non_curated_plugin_cache_refresh_loop has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (6 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.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×9
Members sharing a duplicated core (4 members, 50+ identical tokens) codex-rs/analytics/src/events.rs:1545— codex-rs/analytics/src/events.rs:1545-1562 | codex-rs/core/src/hook_runtime.rs:1027-1074 | 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:538— codex-rs/app-server-daemon/src/backend/pid.rs:538-550 | codex-rs/app-server-daemon/src/backend/pid.rs:553-565 | codex-rs/app-server-daemon/src/backend/pid.rs:568-580 | codex-rs/app-server-daemon/src/backend/pid.rs:583-595 — 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:369— codex-rs/app-server/src/request_processors/apps_processor.rs:369-380 | codex-rs/app-server/src/request_processors/mcp_processor.rs:123-134 | codex-rs/app-server/src/request_processors/thread_processor.rs:1103-1115 | codex-rs/app-server/src/request_processors/turn_processor.rs:457-469 — 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:2357— codex-rs/core-plugins/src/remote.rs:2357-2373 | codex-rs/core-plugins/src/remote.rs:2379-2391 | codex-rs/core-plugins/src/remote.rs:2400-2424 | codex-rs/core-plugins/src/remote/share.rs:384-396 — 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/otel/src/events/session_telemetry.rs:735— codex-rs/otel/src/events/session_telemetry.rs:735-767 | codex-rs/otel/src/events/session_telemetry.rs:821-867 | codex-rs/otel/src/events/session_telemetry.rs:887-934 | codex-rs/otel/src/events/session_telemetry.rs:942-974 — 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:2211— codex-rs/tui/src/bottom_pane/chat_composer.rs:2211-2294 | codex-rs/tui/src/bottom_pane/chat_composer.rs:2297-2377 | codex-rs/tui/src/bottom_pane/chat_composer.rs:2382-2499 | 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:571-637 | codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:283-339 — 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:172— codex-rs/windows-sandbox-rs/src/acl.rs:172-235 | codex-rs/windows-sandbox-rs/src/acl.rs:369-408 | codex-rs/windows-sandbox-rs/src/acl.rs:410-453 | codex-rs/windows-sandbox-rs/src/acl.rs:468-511 — 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· Edited copy of a member (27 corresponding lines) · ×9
Edited copy of a member (27 corresponding lines) codex-rs/core/src/hook_runtime.rs:551— codex-rs/core/src/hook_runtime.rs:551-577 | codex-rs/core/src/hook_runtime.rs:593-619 — These two members are one piece of code written twice and then edited apart: 27 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.
Edited copy of a member (27 corresponding lines) codex-rs/codex-mcp/src/binding_clients.rs:107— codex-rs/codex-mcp/src/binding_clients.rs:107-133 | codex-rs/codex-mcp/src/binding_clients.rs:138-164 — These two members are one piece of code written twice and then edited apart: 27 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.
Edited copy of a member (27 corresponding lines) codex-rs/tui/src/bottom_pane/experimental_features_view.rs:332— codex-rs/tui/src/bottom_pane/experimental_features_view.rs:332-362 | codex-rs/tui/src/bottom_pane/memories_settings_view.rs:279-305 — These two members are one piece of code written twice and then edited apart: 27 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.
Edited copy of a member (27 corresponding lines) codex-rs/code-mode-runtime/src/runtime/callbacks.rs:163— codex-rs/code-mode-runtime/src/runtime/callbacks.rs:163-193 | codex-rs/code-mode-runtime/src/runtime/callbacks.rs:284-310 — These two members are one piece of code written twice and then edited apart: 27 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.
Edited copy of a member (27 corresponding lines) codex-rs/app-server/src/command_exec.rs:388— codex-rs/app-server/src/command_exec.rs:388-415 | codex-rs/app-server/src/request_processors/process_exec_processor.rs:429-455 — These two members are one piece of code written twice and then edited apart: 27 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.
Edited copy of a member (27 corresponding lines) codex-rs/tui/src/bottom_pane/mod.rs:1563— codex-rs/tui/src/bottom_pane/mod.rs:1563-1592 | codex-rs/tui/src/bottom_pane/mod.rs:1651-1677 — These two members are one piece of code written twice and then edited apart: 27 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.
Edited copy of a member (27 corresponding lines) codex-rs/windows-sandbox-rs/src/token.rs:210— codex-rs/windows-sandbox-rs/src/token.rs:210-236 | codex-rs/windows-sandbox-rs/src/token_user.rs:18-44 — These two members are one piece of code written twice and then edited apart: 27 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.
Edited copy of a member (27 corresponding lines) codex-rs/app-server-client/src/lib.rs:604— codex-rs/app-server-client/src/lib.rs:604-633 | codex-rs/app-server-client/src/remote.rs:604-630 — These two members are one piece of code written twice and then edited apart: 27 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.
Edited copy of a member (27 corresponding lines) codex-rs/app-server-test-client/src/plugin_analytics_capture.rs:12— codex-rs/app-server-test-client/src/plugin_analytics_capture.rs:12-43 | codex-rs/app-server-test-client/src/plugin_analytics_smoke.rs:380-406 — These two members are one piece of code written twice and then edited apart: 27 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.
Duplicated block (20 lines × 2) codex-rs/app-server-client/src/lib.rs:509— codex-rs/app-server-client/src/lib.rs:509-528 | codex-rs/app-server-client/src/lib.rs:693-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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (20 lines × 2) codex-rs/app-server/src/command_exec.rs:527— codex-rs/app-server/src/command_exec.rs:527-546 | codex-rs/app-server/src/request_processors/process_exec_processor.rs:568-587 — 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 8 separate duplicated blocks between them, totalling at least 140 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server/src/command_exec.rs:527` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/cli/src/doctor/thread_inventory.rs:199` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/cli/src/doctor/thread_inventory.rs:197` calls `remediation` and `codex-rs/cli/src/doctor/thread_inventory.rs:416` 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 (20 lines × 2) codex-rs/core-plugins/src/remote.rs:964— codex-rs/core-plugins/src/remote.rs:964-983 | codex-rs/core-plugins/src/remote.rs:991-1010 — both copies are in the same file, so extract the 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 `codex-rs/core-plugins/src/remote.rs:964` 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.
Duplicated block (20 lines × 2) codex-rs/exec/src/lib.rs:1597— codex-rs/exec/src/lib.rs:1597-1616 | codex-rs/tui/src/app_server_session.rs:2577-2596 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `cwd` to `&Path` in one and `&std::path::Path` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (20 lines × 2) codex-rs/thread-store/src/local/thread_history/segment_paging.rs:358— codex-rs/thread-store/src/local/thread_history/segment_paging.rs:358-377 | codex-rs/thread-store/src/local/thread_history/segment_paging.rs:418-437 — both copies are in the same file, so extract the 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 `codex-rs/thread-store/src/local/thread_history/segment_paging.rs:358` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (20 lines × 2) codex-rs/tui/src/bottom_pane/chat_composer.rs:4350— codex-rs/tui/src/bottom_pane/chat_composer.rs:4350-4369 | 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/windows-sandbox-rs/src/setup_provisioning/firewall.rs:96— codex-rs/windows-sandbox-rs/src/setup_provisioning/firewall.rs:96-115 | codex-rs/windows-sandbox-rs/src/setup_provisioning/firewall.rs:184-203 — both copies are in the same file, so extract the 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 `codex-rs/windows-sandbox-rs/src/setup_provisioning/firewall.rs:96` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/apply-patch/src/lib.rs:523` 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.
Duplicated block (7 lines × 3) codex-rs/core/src/hook_runtime.rs:553— codex-rs/core/src/hook_runtime.rs:553-559 | codex-rs/core/src/hook_runtime.rs:595-601 | codex-rs/core/src/hook_runtime.rs:716-722 — 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/src/tools/orchestrator.rs:179— codex-rs/core/src/tools/orchestrator.rs:179-185 | codex-rs/core/src/tools/orchestrator.rs:215-221 | codex-rs/core/src/tools/orchestrator.rs:528-534 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core/src/tools/orchestrator.rs:179` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/core/src/tools/orchestrator.rs:222` calls `clone` and `codex-rs/core/src/tools/orchestrator.rs:186` 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/ext/memories/src/tools/list.rs:95` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (7 lines × 3) codex-rs/network-proxy/src/http_proxy.rs:825— codex-rs/network-proxy/src/http_proxy.rs:825-831 | codex-rs/network-proxy/src/http_proxy.rs:876-882 | codex-rs/network-proxy/src/http_proxy.rs:989-995 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/network-proxy/src/http_proxy.rs:825` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 3) codex-rs/tui/src/app/plugin_mentions.rs:76— codex-rs/tui/src/app/plugin_mentions.rs:76-82 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/app/plugin_mentions.rs:76` 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.
Duplicated block (7 lines × 3) codex-rs/tui/src/keymap.rs:1219— codex-rs/tui/src/keymap.rs:1219-1225 | codex-rs/tui/src/keymap.rs:1228-1234 | codex-rs/tui/src/keymap.rs:1263-1269 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/keymap.rs:1219` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (7 lines × 3) codex-rs/utils/pty/src/pipe.rs:269— codex-rs/utils/pty/src/pipe.rs:269-275 | codex-rs/utils/pty/src/pty.rs:278-284 | codex-rs/utils/pty/src/pty.rs:438-444 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/utils/pty/src/pipe.rs:269` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 3) codex-rs/core-plugins/src/marketplace_upgrade/git.rs:317— codex-rs/core-plugins/src/marketplace_upgrade/git.rs:317-323 | codex-rs/core-plugins/src/startup_sync.rs:738-744 | codex-rs/tui/src/app/history_ui.rs:476-486 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core-plugins/src/marketplace_upgrade/git.rs:317` 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.
Duplicated block (7 lines × 3) codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:106— codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:106-112 | codex-rs/rmcp-client/src/bin/test_stdio_server.rs:846-852 | codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs:331-337 — before extracting anything, compare `codex-rs/rmcp-client/src/bin/rmcp_test_server.rs` and `codex-rs/rmcp-client/src/bin/test_stdio_server.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:106` 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.
codex_config::requirements_layers::stack::populate_merged_regular_fields_with_sources (cyclomatic 42) codex-rs/config/src/requirements_layers/stack.rs:248— codex_config::requirements_layers::stack::populate_merged_regular_fields_with_sources 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_config::loader::load_config_layers_state (cyclomatic 31) codex-rs/config/src/loader/mod.rs:147— codex_config::loader::load_config_layers_state 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_config::loader::sanitize_project_config (cyclomatic 29) codex-rs/config/src/loader/mod.rs:1345— 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::merge::merge_toml_values_at_path (cyclomatic 20) codex-rs/config/src/merge.rs:81— codex_config::merge::merge_toml_values_at_path 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::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::strict_config::ignored_config_warning (cyclomatic 18) codex-rs/config/src/strict_config.rs:229— codex_config::strict_config::ignored_config_warning 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.
codex_config::loader::validate_project_mitm_profiles (cyclomatic 17) codex-rs/config/src/loader/mod.rs:1238— 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:647— 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.
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.
codex_windows_sandbox::setup_provisioning::run_setup_full (cyclomatic 35) codex-rs/windows-sandbox-rs/src/setup_provisioning.rs:975— 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:710— 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:549— 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:166— 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.
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 30) codex-rs/network-proxy/src/http_proxy.rs:569— codex_network_proxy::http_proxy::http_plain_proxy 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.
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 25) codex-rs/network-proxy/src/socks5.rs:201— codex_network_proxy::socks5::handle_socks5_tcp has cyclomatic complexity 25 (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:189— 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.
codex_linux_sandbox::bwrap::create_filesystem_args (cognitive 70) codex-rs/linux-sandbox/src/bwrap.rs:405— 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 58) codex-rs/linux-sandbox/src/linux_run_main.rs:144— codex_linux_sandbox::linux_run_main::run_main has cognitive complexity 58 (threshold 15). Drivers by points: if/else 26 (44 pts), boolean chains 12, 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::managed_tcp_stack::run (cognitive 46) codex-rs/linux-sandbox/src/managed_tcp_stack.rs:228— codex_linux_sandbox::managed_tcp_stack::run has cognitive complexity 46 (threshold 15). Drivers by points: if/else 16 (40 pts), boolean chains 3, loops 2 (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.
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::proxy_routing::activate_proxy_routes_in_netns (cognitive 20) codex-rs/linux-sandbox/src/proxy_routing.rs:134— codex_linux_sandbox::proxy_routing::activate_proxy_routes_in_netns has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 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_linux_sandbox::bwrap::glob_files (cognitive 18) codex-rs/linux-sandbox/src/bwrap.rs:931— codex_linux_sandbox::bwrap::glob_files has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 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_linux_sandbox::bwrap::expand_unreadable_globs (cognitive 16) codex-rs/linux-sandbox/src/bwrap.rs:836— codex_linux_sandbox::bwrap::expand_unreadable_globs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 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_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:252— 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::http_client_adapter::legacy_discovery_fallback_response (cognitive 16) codex-rs/rmcp-client/src/http_client_adapter.rs:834— 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.
D30 · Dependency Vulnerabilities· Medium vulnerability · ×8
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
D4 · Code Duplication· Edited copy of a member (24 corresponding lines) · ×8
Edited copy of a member (24 corresponding lines) codex-rs/exec/src/lib.rs:1964— codex-rs/exec/src/lib.rs:1964-1987 | codex-rs/tui/src/worktree_startup.rs:96-120 — 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.
Edited copy of a member (24 corresponding lines) codex-rs/core/src/context/world_state/managed_developer_instructions.rs:129— codex-rs/core/src/context/world_state/managed_developer_instructions.rs:129-158 | codex-rs/core/src/context/world_state/persistent_mode.rs:94-117 — 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.
Edited copy of a member (24 corresponding lines) codex-rs/tui/src/chatwidget/realtime_settings.rs:60— codex-rs/tui/src/chatwidget/realtime_settings.rs:60-83 | codex-rs/tui/src/chatwidget/realtime_settings.rs:85-113 — 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.
Edited copy of a member (24 corresponding lines) codex-rs/codex-api/src/endpoint/session.rs:90— codex-rs/codex-api/src/endpoint/session.rs:90-114 | codex-rs/codex-api/src/endpoint/session.rs:132-155 — 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.
Edited copy of a member (24 corresponding lines) codex-rs/runtime-agent-instance/src/manager.rs:135— codex-rs/runtime-agent-instance/src/manager.rs:135-158 | codex-rs/runtime-agent-instance/src/manager.rs:165-193 — 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.
Edited copy of a member (24 corresponding lines) codex-rs/tui/src/ide_context/ipc.rs:413— codex-rs/tui/src/ide_context/ipc.rs:413-436 | codex-rs/tui/src/ide_context/ipc.rs:566-591 — 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.
Edited copy of a member (24 corresponding lines) codex-rs/cli/src/main.rs:2730— codex-rs/cli/src/main.rs:2730-2754 | codex-rs/cli/src/main.rs:2764-2787 — 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.
Edited copy of a member (24 corresponding lines) codex-rs/network-proxy/src/runtime.rs:137— codex-rs/network-proxy/src/runtime.rs:137-162 | codex-rs/protocol/src/mcp.rs:470-493 — 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 (21 corresponding lines) · ×8
Edited copy of a member (21 corresponding lines) codex-rs/ext/skills/src/sources.rs:188— codex-rs/ext/skills/src/sources.rs:188-208 | codex-rs/ext/skills/src/sources.rs:213-233 — These two members are one piece of code written twice and then edited apart: 21 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.
Edited copy of a member (21 corresponding lines) codex-rs/tui/src/app/background_requests.rs:297— codex-rs/tui/src/app/background_requests.rs:297-319 | codex-rs/tui/src/app/connector_mentions.rs:33-53 — These two members are one piece of code written twice and then edited apart: 21 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.
Edited copy of a member (21 corresponding lines) codex-rs/rmcp-client/src/oauth.rs:1249— codex-rs/rmcp-client/src/oauth.rs:1249-1269 | codex-rs/windows-sandbox-rs/src/identity.rs:135-158 — These two members are one piece of code written twice and then edited apart: 21 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.
Edited copy of a member (21 corresponding lines) codex-rs/app-server/src/config_manager.rs:305— codex-rs/app-server/src/config_manager.rs:305-325 | codex-rs/app-server/src/config_manager.rs:332-354 — These two members are one piece of code written twice and then edited apart: 21 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.
Edited copy of a member (21 corresponding lines) codex-rs/tui/src/chatwidget/plugin_catalog.rs:944— codex-rs/tui/src/chatwidget/plugin_catalog.rs:944-964 | codex-rs/tui/src/keymap_setup/picker.rs:320-345 — These two members are one piece of code written twice and then edited apart: 21 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.
Edited copy of a member (21 corresponding lines) scripts/stage_npm_packages.py:333— scripts/stage_npm_packages.py:333-353 | scripts/stage_npm_packages.py:382-404 — These two members are one piece of code written twice and then edited apart: 21 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.
Edited copy of a member (21 corresponding lines) codex-rs/login/src/auth/bedrock_access_keys.rs:42— codex-rs/login/src/auth/bedrock_access_keys.rs:42-63 | codex-rs/login/src/auth/bedrock_api_key.rs:36-56 — These two members are one piece of code written twice and then edited apart: 21 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.
Edited copy of a member (21 corresponding lines) codex-rs/tui/src/chatwidget/plugin_catalog.rs:1405— codex-rs/tui/src/chatwidget/plugin_catalog.rs:1405-1429 | codex-rs/tui/src/chatwidget/plugin_catalog.rs:1876-1896 — These two members are one piece of code written twice and then edited apart: 21 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 (4 corresponding lines) · ×8
Edited copy of a member (4 corresponding lines) codex-rs/tui/src/app/agent_status_feed.rs:216— codex-rs/tui/src/app/agent_status_feed.rs:216-220 | codex-rs/tui/src/clipboard_paste.rs:246-249 — These two members are one piece of code written twice and then edited apart: 4 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.
Edited copy of a member (4 corresponding lines) codex-rs/login/src/auth/agent_identity.rs:310— codex-rs/login/src/auth/agent_identity.rs:310-316 | codex-rs/tui/src/startup_draft.rs:92-95 — These two members are one piece of code written twice and then edited apart: 4 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.
Edited copy of a member (4 corresponding lines) codex-rs/config/src/config_requirements.rs:1713— codex-rs/config/src/config_requirements.rs:1713-1716 | codex-rs/config/src/host_name.rs:44-47 — These two members are one piece of code written twice and then edited apart: 4 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.
Edited copy of a member (4 corresponding lines) codex-rs/core/src/tools/handlers/current_time.rs:38— codex-rs/core/src/tools/handlers/current_time.rs:38-41 | codex-rs/core/src/tools/handlers/get_context_remaining.rs:48-51 — These two members are one piece of code written twice and then edited apart: 4 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.
Edited copy of a member (4 corresponding lines) codex-rs/external-agent-migration/src/hooks_common.rs:219— codex-rs/external-agent-migration/src/hooks_common.rs:219-224 | codex-rs/utils/path-uri/src/config_path.rs:170-173 — These two members are one piece of code written twice and then edited apart: 4 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.
Edited copy of a member (4 corresponding lines) codex-rs/tui/src/bottom_pane/mentions_v2/search_catalog.rs:240— codex-rs/tui/src/bottom_pane/mentions_v2/search_catalog.rs:240-243 | codex-rs/tui/src/onboarding/provider_setup.rs:60-64 — These two members are one piece of code written twice and then edited apart: 4 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.
Edited copy of a member (4 corresponding lines) codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:94— codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:94-97 | codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs:277-280 — These two members are one piece of code written twice and then edited apart: 4 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.
Edited copy of a member (4 corresponding lines) codex-rs/rmcp-client/src/bin/test_stdio_server.rs:682— codex-rs/rmcp-client/src/bin/test_stdio_server.rs:682-685 | codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs:286-289 — These two members are one piece of code written twice and then edited apart: 4 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.
codex_code_mode_runtime::cell_actor::run_cell (cognitive 81) codex-rs/code-mode-runtime/src/cell_actor/mod.rs:113— codex_code_mode_runtime::cell_actor::run_cell has cognitive complexity 81 (threshold 15). Drivers by points: if/else 21 (57 pts), match/switch 7 (17 pts), boolean chains 6, loops 1 (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_code_mode_runtime::ui::workers::execute (cognitive 27) codex-rs/code-mode-runtime/src/ui/workers.rs:160— codex_code_mode_runtime::ui::workers::execute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 3 (7 pts), boolean chains 1, 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_code_mode_runtime::output::output_render::insert_loss_notices (cognitive 25) codex-rs/code-mode-runtime/src/output/output_render.rs:86— codex_code_mode_runtime::output::output_render::insert_loss_notices has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 2, loops 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_code_mode_runtime::runtime::run_runtime (cognitive 22) codex-rs/code-mode-runtime/src/runtime/mod.rs:182— 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::ui::workers::run (cognitive 22) codex-rs/code-mode-runtime/src/ui/workers.rs:48— codex_code_mode_runtime::ui::workers::run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 3 (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_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 18) codex-rs/code-mode-runtime/src/runtime/value.rs:78— codex_code_mode_runtime::runtime::value::normalize_output_image has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 2, 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.
codex_app_server_protocol::export::build_schema_bundle (cognitive 41) codex-rs/app-server-protocol/src/export.rs:1028— 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:1886— 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:1790— 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:1686— 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:1722— 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:1845— 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.
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::registered_runtime::provision (cognitive 29) codex-rs/windows-sandbox-service/src/registered_runtime.rs:92— codex_windows_sandbox_service::registered_runtime::provision has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (5 pts), match/switch 1 (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_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::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.
codex_mcp::mcp::auth::compute_auth_status (cognitive 32) codex-rs/codex-mcp/src/mcp/auth.rs:258— 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 30) codex-rs/codex-mcp/src/rmcp_client.rs:1443— codex_mcp::rmcp_client::make_rmcp_client has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 4, 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.
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::rmcp_client::start_server_task (cognitive 20) codex-rs/codex-mcp/src/rmcp_client.rs:1140— codex_mcp::rmcp_client::start_server_task has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 4, match/switch 2 (3 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.
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:948— 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::tools::normalize_tools_for_model_with_prefix (cognitive 16) codex-rs/codex-mcp/src/tools.rs:134— codex_mcp::tools::normalize_tools_for_model_with_prefix has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), loops 6, match/switch 2 (3 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_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:266— 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:1575— 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.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×7
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.
Edited copy of a member (25 corresponding lines) codex-rs/rmcp-client/src/ema_http_client.rs:299— codex-rs/rmcp-client/src/ema_http_client.rs:299-323 | codex-rs/rmcp-client/src/ema_http_client.rs:328-355 — 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.
Edited copy of a member (25 corresponding lines) codex-rs/tui/src/bottom_pane/textarea.rs:1974— codex-rs/tui/src/bottom_pane/textarea.rs:1974-1998 | codex-rs/tui/src/bottom_pane/textarea.rs:2000-2024 — 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.
Edited copy of a member (25 corresponding lines) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:795— codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:795-819 | codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:827-856 — 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.
Edited copy of a member (25 corresponding lines) codex-rs/app-server/src/request_processors/thread_attachments.rs:107— codex-rs/app-server/src/request_processors/thread_attachments.rs:107-137 | codex-rs/app-server/src/request_processors/thread_sections.rs:33-57 — 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.
Edited copy of a member (25 corresponding lines) codex-rs/core-plugins/src/remote.rs:2512— codex-rs/core-plugins/src/remote.rs:2512-2540 | codex-rs/core-plugins/src/remote/share.rs:509-533 — 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.
Edited copy of a member (25 corresponding lines) codex-rs/guardian-context/src/preparation/transcript.rs:67— codex-rs/guardian-context/src/preparation/transcript.rs:67-91 | codex-rs/guardian-context/src/preparation/transcript.rs:94-118 — 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 (35 corresponding lines) · ×7
Edited copy of a member (35 corresponding lines) codex-rs/tui/src/wrapping.rs:242— codex-rs/tui/src/wrapping.rs:242-280 | codex-rs/tui/src/wrapping.rs:288-322 — These two members are one piece of code written twice and then edited apart: 35 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.
Edited copy of a member (35 corresponding lines) codex-rs/tui/src/bottom_pane/chat_composer/sparkle.rs:188— codex-rs/tui/src/bottom_pane/chat_composer/sparkle.rs:188-232 | codex-rs/tui/src/bottom_pane/chat_composer/sparkle.rs:263-297 — These two members are one piece of code written twice and then edited apart: 35 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.
Edited copy of a member (35 corresponding lines) codex-rs/core/src/context_manager/normalize.rs:349— codex-rs/core/src/context_manager/normalize.rs:349-390 | codex-rs/core/src/context_manager/normalize.rs:397-431 — These two members are one piece of code written twice and then edited apart: 35 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.
Edited copy of a member (35 corresponding lines) codex-rs/windows-sandbox-rs/src/setup.rs:859— codex-rs/windows-sandbox-rs/src/setup.rs:859-893 | codex-rs/windows-sandbox-rs/src/winutil.rs:76-112 — These two members are one piece of code written twice and then edited apart: 35 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.
Edited copy of a member (35 corresponding lines) codex-rs/linux-sandbox/src/bwrap.rs:1024— codex-rs/linux-sandbox/src/bwrap.rs:1024-1058 | codex-rs/linux-sandbox/src/bwrap.rs:1323-1361 — These two members are one piece of code written twice and then edited apart: 35 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.
Edited copy of a member (35 corresponding lines) codex-rs/protocol/src/models/executed_tool_calls.rs:197— codex-rs/protocol/src/models/executed_tool_calls.rs:197-232 | codex-rs/protocol/src/models/executed_tool_calls.rs:238-272 — These two members are one piece of code written twice and then edited apart: 35 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.
Edited copy of a member (35 corresponding lines) codex-rs/code-mode/src/grpc_session/generation.rs:83— codex-rs/code-mode/src/grpc_session/generation.rs:83-117 | codex-rs/code-mode/src/remote_session/connection/driver/cell_ids.rs:58-92 — These two members are one piece of code written twice and then edited apart: 35 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 (23 corresponding lines) · ×7
Edited copy of a member (23 corresponding lines) codex-rs/external-agent-migration/src/mcp.rs:266— codex-rs/external-agent-migration/src/mcp.rs:266-303 | codex-rs/external-agent-migration/src/mcp.rs:308-330 — These two members are one piece of code written twice and then edited apart: 23 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.
Edited copy of a member (23 corresponding lines) codex-rs/thread-store/src/local/update_thread_metadata.rs:776— codex-rs/thread-store/src/local/update_thread_metadata.rs:776-798 | codex-rs/thread-store/src/thread_metadata_sync.rs:421-446 — These two members are one piece of code written twice and then edited apart: 23 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.
Edited copy of a member (23 corresponding lines) codex-rs/exec-server-cli/src/exec_server_auth.rs:259— codex-rs/exec-server-cli/src/exec_server_auth.rs:259-284 | codex-rs/model-provider/src/amazon_bedrock/auth.rs:319-341 — These two members are one piece of code written twice and then edited apart: 23 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.
Edited copy of a member (23 corresponding lines) codex-rs/cli/src/doctor.rs:2787— codex-rs/cli/src/doctor.rs:2787-2811 | codex-rs/codex-client/src/provider.rs:55-77 — These two members are one piece of code written twice and then edited apart: 23 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.
Edited copy of a member (23 corresponding lines) codex-rs/code-mode-runtime/src/cell_actor/conversions.rs:9— codex-rs/code-mode-runtime/src/cell_actor/conversions.rs:9-35 | codex-rs/code-mode-runtime/src/service.rs:381-403 — These two members are one piece of code written twice and then edited apart: 23 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.
Edited copy of a member (23 corresponding lines) codex-rs/install-context/src/lib.rs:151— codex-rs/install-context/src/lib.rs:151-173 | codex-rs/install-context/src/lib.rs:207-229 — These two members are one piece of code written twice and then edited apart: 23 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.
Edited copy of a member (23 corresponding lines) codex-rs/tui/src/chatwidget/connectors.rs:230— codex-rs/tui/src/chatwidget/connectors.rs:230-258 | codex-rs/tui/src/chatwidget/usage.rs:304-326 — These two members are one piece of code written twice and then edited apart: 23 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 (5 corresponding lines) · ×7
Edited copy of a member (5 corresponding lines) codex-rs/core/src/codex_thread.rs:780— codex-rs/core/src/codex_thread.rs:780-784 | codex-rs/core/src/session/mod.rs:3195-3202 — These two members are one piece of code written twice and then edited apart: 5 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.
Edited copy of a member (5 corresponding lines) codex-rs/exec-server/src/no_follow/unix.rs:357— codex-rs/exec-server/src/no_follow/unix.rs:357-361 | codex-rs/exec-server/src/no_follow/windows.rs:447-451 — These two members are one piece of code written twice and then edited apart: 5 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.
Edited copy of a member (5 corresponding lines) codex-rs/connectors/src/plugin_config.rs:42— codex-rs/connectors/src/plugin_config.rs:42-46 | codex-rs/tui/src/status_indicator_widget.rs:156-160 — These two members are one piece of code written twice and then edited apart: 5 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.
Edited copy of a member (5 corresponding lines) codex-rs/tui/src/bottom_pane/chat_composer/passive_hints.rs:235— codex-rs/tui/src/bottom_pane/chat_composer/passive_hints.rs:235-239 | codex-rs/tui/src/bottom_pane/footer.rs:904-908 — These two members are one piece of code written twice and then edited apart: 5 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.
Edited copy of a member (5 corresponding lines) codex-rs/app-server/src/request_processors/catalog_processor.rs:262— codex-rs/app-server/src/request_processors/catalog_processor.rs:262-266 | codex-rs/app-server/src/request_processors/thread_processor.rs:1036-1040 — These two members are one piece of code written twice and then edited apart: 5 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.
Edited copy of a member (5 corresponding lines) codex-rs/app-server-transport/src/transport/remote_control/segment.rs:439— codex-rs/app-server-transport/src/transport/remote_control/segment.rs:439-443 | codex-rs/rollout/src/persistence_metrics.rs:232-236 — These two members are one piece of code written twice and then edited apart: 5 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.
Edited copy of a member (5 corresponding lines) codex-rs/connectors/src/lib.rs:521— codex-rs/connectors/src/lib.rs:521-526 | codex-rs/external-agent-migration/src/sessions/mod.rs:57-61 — These two members are one piece of code written twice and then edited apart: 5 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core/src/plugins/mentions.rs:84` 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. 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 (14–15 lines × 2) codex-rs/core/src/tools/orchestrator.rs:374— codex-rs/core/src/tools/orchestrator.rs:374-387 | codex-rs/core/src/tools/orchestrator.rs:582-596 — both copies are in the same file, so extract the 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 `codex-rs/core/src/tools/orchestrator.rs:374` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/core/src/tools/orchestrator.rs:599` calls `network_approval_spec` and `codex-rs/core/src/tools/orchestrator.rs:389` 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 (14–15 lines × 2) codex-rs/execpolicy/src/error.rs:83— codex-rs/execpolicy/src/error.rs:83-96 | codex-rs/execpolicy/src/parser.rs:261-275 — 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/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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/ext/skills/src/dynamic_skill_selector/lru_plus_character_routing.rs:50` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/external-agent-migration/src/sessions/records_cla.rs:65` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
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:237-250 — 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 `codex-rs/linux-sandbox/src/bundled_bwrap.rs:83` 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. 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 (14–15 lines × 2) codex-rs/tui/src/markdown_render.rs:2099— codex-rs/tui/src/markdown_render.rs:2099-2112 | codex-rs/tui/src/markdown_render/table_key_value.rs:284-298 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/markdown_render.rs:2099` 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. 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 (11–12 lines × 2) codex-rs/analytics/src/events.rs:1566— codex-rs/analytics/src/events.rs:1566-1577 | codex-rs/core/src/hook_runtime.rs:1045-1055 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/analytics/src/events.rs:1566` 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. 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 (11–12 lines × 2) codex-rs/core/src/realtime_conversation.rs:1223— codex-rs/core/src/realtime_conversation.rs:1223-1233 | codex-rs/core/src/realtime_conversation.rs:1291-1302 — both copies are in the same file, so extract the 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 `codex-rs/core/src/realtime_conversation.rs:1223` 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.
Duplicated block (11–12 lines × 2) codex-rs/ext/goal/src/runtime.rs:349— codex-rs/ext/goal/src/runtime.rs:349-360 | codex-rs/ext/goal/src/runtime.rs:463-473 — both copies are in the same file, so extract the 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. 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 (11–12 lines × 2) codex-rs/rollout-trace/src/protocol_event.rs:368— codex-rs/rollout-trace/src/protocol_event.rs:368-378 | codex-rs/rollout-trace/src/protocol_event.rs:451-462 — both copies are in the same file, so extract the 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/chat_composer_history.rs:638` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server/src/in_process_bootstrap.rs:111` 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. 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 (9–10 lines × 2) codex-rs/cloud-tasks/src/lib.rs:1865— codex-rs/cloud-tasks/src/lib.rs:1865-1873 | codex-rs/cloud-tasks/src/lib.rs:1903-1912 — both copies are in the same file, so extract the 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 `codex-rs/cloud-tasks/src/lib.rs:1865` 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.
Duplicated block (9–10 lines × 2) codex-rs/core/src/unified_exec/process_manager.rs:522— codex-rs/core/src/unified_exec/process_manager.rs:522-531 | codex-rs/core/src/unified_exec/process_manager.rs:894-902 — both copies are in the same file, so extract the 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 `codex-rs/core/src/unified_exec/process_manager.rs:522` 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.
Duplicated block (9–10 lines × 2) codex-rs/exec/src/lib.rs:1004— codex-rs/exec/src/lib.rs:1004-1013 | codex-rs/exec/src/lib.rs:1027-1035 — both copies are in the same file, so extract the 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:854— codex-rs/ext/skills/src/render.rs:854-862 | codex-rs/ext/skills/src/render.rs:1053-1062 — both copies are in the same file, so extract the 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 `codex-rs/ext/skills/src/render.rs:1053` 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.
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.
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.
TextArea::apply_vim_editor_action (cyclomatic 47) codex-rs/tui/src/bottom_pane/textarea/vim_commands.rs:345— TextArea::apply_vim_editor_action 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.
TextArea::handle_vim_normal (cyclomatic 31) codex-rs/tui/src/bottom_pane/textarea.rs:843— 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:674— 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:100— 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_insert_action (cyclomatic 16) codex-rs/tui/src/bottom_pane/textarea/vim_commands.rs:243— TextArea::apply_vim_insert_action has cyclomatic complexity 16 (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.
TextArea::apply_vim_operator (cyclomatic 16) codex-rs/tui/src/bottom_pane/textarea.rs:1094— 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.
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.
Writer::start_tag (cyclomatic 26) codex-rs/tui/src/markdown_render.rs:694— 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:606— 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:779— 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:2289— 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_lines (cyclomatic 16) codex-rs/tui/src/markdown_render.rs:1469— Writer::render_table_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.
Writer::render_table_row (cyclomatic 16) codex-rs/tui/src/markdown_render.rs:1885— 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.
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.
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.
codex_api::endpoint::responses_websocket::run_websocket_response_stream (cognitive 86) codex-rs/codex-api/src/endpoint/responses_websocket.rs:841— codex_api::endpoint::responses_websocket::run_websocket_response_stream has cognitive complexity 86 (threshold 15). Drivers by points: if/else 18 (59 pts), match/switch 6 (15 pts), boolean chains 8, loops 2 (4 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_api::api_bridge::map_api_error_details (cognitive 62) codex-rs/codex-api/src/api_bridge.rs:60— codex_api::api_bridge::map_api_error_details has cognitive complexity 62 (threshold 15). Drivers by points: if/else 20 (46 pts), match/switch 4 (11 pts), boolean chains 5 (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_api::files::upload_openai_file (cognitive 49) codex-rs/codex-api/src/files.rs:133— codex_api::files::upload_openai_file has cognitive complexity 49 (threshold 15). Drivers by points: if/else 20 (34 pts), match/switch 4 (8 pts), loops 3 (5 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_api::sse::responses::process_responses_event (cognitive 49) codex-rs/codex-api/src/sse/responses.rs:400— 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::sse::responses::process_sse_with_treatment (cognitive 34) codex-rs/codex-api/src/sse/responses.rs:609— codex_api::sse::responses::process_sse_with_treatment has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (19 pts), match/switch 5 (11 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_api::endpoint::realtime_websocket::methods::websocket_url_from_api_url (cognitive 22) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:1241— 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.
AnalyticsReducer::ingest_notification (cognitive 63) codex-rs/analytics/src/reducer.rs:2068— 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 33) codex-rs/analytics/src/reducer.rs:1768— AnalyticsReducer::ingest_server_request has cognitive complexity 33 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 3, 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.
AnalyticsReducer::ingest (cognitive 25) codex-rs/analytics/src/reducer.rs:614— AnalyticsReducer::ingest has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 4 (9 pts) (nesting depth added 15). 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:920— 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:1167— 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:1458— 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.
D4 · Code Duplication· Edited copy of a member (33 corresponding lines) · ×6
Edited copy of a member (33 corresponding lines) codex-rs/tui/src/external_agent_config_migration/mod.rs:433— codex-rs/tui/src/external_agent_config_migration/mod.rs:433-469 | codex-rs/tui/src/external_agent_config_migration/mod.rs:471-503 — These two members are one piece of code written twice and then edited apart: 33 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.
Edited copy of a member (33 corresponding lines) codex-rs/core-plugins/src/remote.rs:1941— codex-rs/core-plugins/src/remote.rs:1941-1973 | codex-rs/core-plugins/src/remote.rs:2036-2068 — These two members are one piece of code written twice and then edited apart: 33 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.
Edited copy of a member (33 corresponding lines) codex-rs/core/src/image_preparation.rs:336— codex-rs/core/src/image_preparation.rs:336-372 | codex-rs/core/src/image_preparation.rs:379-411 — These two members are one piece of code written twice and then edited apart: 33 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.
Edited copy of a member (33 corresponding lines) codex-rs/app-server/src/lib.rs:399— codex-rs/app-server/src/lib.rs:399-436 | codex-rs/tui/src/app/startup_prompts.rs:69-101 — These two members are one piece of code written twice and then edited apart: 33 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.
Edited copy of a member (33 corresponding lines) codex-rs/tools/src/json_schema/traversal.rs:17— codex-rs/tools/src/json_schema/traversal.rs:17-49 | codex-rs/tools/src/json_schema/traversal.rs:55-87 — These two members are one piece of code written twice and then edited apart: 33 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.
Edited copy of a member (33 corresponding lines) codex-rs/config/src/loader/mod.rs:1713— codex-rs/config/src/loader/mod.rs:1713-1745 | codex-rs/config/src/loader/mod.rs:1750-1784 — These two members are one piece of code written twice and then edited apart: 33 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 copies of one member (3 members, 11+ corresponding lines) · ×6
Edited copies of one member (3 members, 11+ corresponding lines) codex-rs/tui/src/ide_context/ipc.rs:373— codex-rs/tui/src/ide_context/ipc.rs:373-384 | codex-rs/tui/src/ide_context/ipc.rs:387-398 | codex-rs/utils/pty/src/pty.rs:512-522 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) codex-rs/utils/pty/src/child.rs:42— codex-rs/utils/pty/src/child.rs:42-52 | codex-rs/utils/pty/src/child.rs:55-70 | codex-rs/utils/pty/src/child.rs:105-120 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) codex-rs/core/src/realtime_conversation.rs:2074— codex-rs/core/src/realtime_conversation.rs:2074-2084 | codex-rs/core/src/realtime_conversation.rs:2206-2217 | codex-rs/core/src/realtime_conversation.rs:2223-2234 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) codex-rs/core/src/config/edit.rs:923— codex-rs/core/src/config/edit.rs:923-933 | codex-rs/core/src/config/edit.rs:935-945 | codex-rs/core/src/config/edit.rs:947-957 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) codex-rs/agent-message-board-client/src/client.rs:108— codex-rs/agent-message-board-client/src/client.rs:108-118 | codex-rs/agent-message-board-client/src/client.rs:120-134 | codex-rs/agent-message-board-client/src/client.rs:140-151 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) codex-rs/analytics/src/reducer.rs:3749— codex-rs/analytics/src/reducer.rs:3749-3762 | codex-rs/analytics/src/reducer.rs:3766-3779 | codex-rs/analytics/src/reducer.rs:3809-3819 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (22 lines × 2) codex-rs/app-server/src/command_exec.rs:457— codex-rs/app-server/src/command_exec.rs:457-478 | codex-rs/app-server/src/request_processors/process_exec_processor.rs:491-512 — 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 8 separate duplicated blocks between them, totalling at least 140 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server/src/command_exec.rs:457` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `params` to `RunCommandParams` in one and `RunProcessParams` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (22 lines × 2) codex-rs/core/src/mcp_tool_call.rs:1178— codex-rs/core/src/mcp_tool_call.rs:1178-1199 | codex-rs/core/src/tools/handlers/mcp_resource.rs:447-468 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core/src/mcp_tool_call.rs:1178` 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.
Duplicated block (22 lines × 2) codex-rs/rollout-trace/src/reducer/conversation.rs:314— codex-rs/rollout-trace/src/reducer/conversation.rs:314-335 | codex-rs/rollout-trace/src/reducer/conversation.rs:441-462 — both copies are in the same file, so extract the 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 `codex-rs/rollout-trace/src/reducer/conversation.rs:314` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `context` to `ReconcileItems<'_>` in one and `DetachedReconcileItems<'_>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (22 lines × 2) codex-rs/rollout/src/list.rs:547— codex-rs/rollout/src/list.rs:547-568 | codex-rs/rollout/src/list.rs:671-692 — both copies are in the same file, so extract the 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 `codex-rs/rollout/src/list.rs:547` 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.
Duplicated block (22 lines × 2) codex-rs/tui/src/bottom_pane/multi_select_picker.rs:521— codex-rs/tui/src/bottom_pane/multi_select_picker.rs:521-542 | codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:207-228 — 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 99 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/multi_select_picker.rs:521` 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.
Duplicated block (22 lines × 2) codex-rs/config/src/config_requirements.rs:2303— codex-rs/config/src/config_requirements.rs:2303-2324 | codex-rs/config/src/config_requirements.rs:2333-2354 — both copies are in the same file, so extract the 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 `codex-rs/config/src/config_requirements.rs:2303` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/config/src/config_requirements.rs:2356` calls `read_only` and `codex-rs/config/src/config_requirements.rs:2326` 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 (10–11 lines × 2) codex-rs/codex-api/src/endpoint/realtime_call.rs:119— codex-rs/codex-api/src/endpoint/realtime_call.rs:119-128 | codex-rs/codex-api/src/endpoint/realtime_call.rs:205-215 — both copies are in the same file, so extract the 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 `codex-rs/codex-api/src/endpoint/realtime_call.rs:119` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (10–11 lines × 2) codex-rs/protocol/src/protocol.rs:2777— codex-rs/protocol/src/protocol.rs:2777-2787 | codex-rs/tui/src/token_usage.rs:59-68 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (10–11 lines × 2) codex-rs/tui/src/app/history_ui.rs:211— codex-rs/tui/src/app/history_ui.rs:211-220 | codex-rs/tui/src/app/history_ui.rs:227-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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. 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 (10–11 lines × 2) codex-rs/tui/src/markdown_render/inline_directives.rs:73— codex-rs/tui/src/markdown_render/inline_directives.rs:73-83 | codex-rs/tui/src/markdown_render/math.rs:49-58 — before extracting anything, compare `codex-rs/tui/src/markdown_render/inline_directives.rs` and `codex-rs/tui/src/markdown_render/math.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 40 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/markdown_render/inline_directives.rs:73` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/tui/src/markdown_render/math.rs:59` calls `iter`, `peekable`, `sort_unstable_by_key` and `codex-rs/tui/src/markdown_render/inline_directives.rs:84` 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/worktree_browser.rs:119` 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.
Duplicated block (10–11 lines × 2) codex-rs/windows-sandbox-rs/src/acl.rs:801— codex-rs/windows-sandbox-rs/src/acl.rs:801-810 | codex-rs/windows-sandbox-rs/src/acl.rs:1134-1144 — both copies are in the same file, so extract the 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 × 3) codex-rs/core-plugins/src/marketplace_upgrade/git.rs:286— codex-rs/core-plugins/src/marketplace_upgrade/git.rs:286-294 | 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/core-plugins/src/marketplace_upgrade/git.rs:296` calls `elapsed` and `codex-rs/core-plugins/src/startup_sync.rs:718` 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 (9 lines × 3) 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 | tools/argument-comment-lint/src/comment_parser.rs:17-25 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (9 lines × 3) codex-rs/tui/src/bottom_pane/app_link_view.rs:437— codex-rs/tui/src/bottom_pane/app_link_view.rs:437-445 | codex-rs/tui/src/bottom_pane/app_link_view.rs:447-455 | codex-rs/tui/src/bottom_pane/app_link_view.rs:457-465 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (9 lines × 3) codex-rs/core/src/config/edit.rs:925— codex-rs/core/src/config/edit.rs:925-933 | codex-rs/core/src/config/edit.rs:937-945 | codex-rs/core/src/config/edit.rs:949-957 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core/src/config/edit.rs:925` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/hooks/src/events/permission_request.rs:252` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/hooks/src/events/pre_tool_use.rs:272` calls `Some`, `clone` and `codex-rs/hooks/src/events/permission_request.rs:262` 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 (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.
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/backend-client/src/client.rs:415— codex-rs/backend-client/src/client.rs:415-422 | codex-rs/backend-client/src/client.rs:439-447 — both copies are in the same file, so extract the 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.
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. 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 (8–9 lines × 2) codex-rs/tui/src/markdown_render.rs:1940— codex-rs/tui/src/markdown_render.rs:1940-1947 | codex-rs/tui/src/markdown_render/table_key_value.rs:268-276 — 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. 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/tui/event_stream.rs:242` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (8–9 lines × 2) codex-rs/windows-sandbox-rs/src/acl.rs:193— codex-rs/windows-sandbox-rs/src/acl.rs:193-201 | codex-rs/windows-sandbox-rs/src/acl.rs:385-392 — both copies are in the same file, so extract the 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. 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.
codex_api::api_bridge::map_api_error_details (cyclomatic 58) codex-rs/codex-api/src/api_bridge.rs:60— codex_api::api_bridge::map_api_error_details 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.
codex_api::endpoint::responses_websocket::run_websocket_response_stream (cyclomatic 42) codex-rs/codex-api/src/endpoint/responses_websocket.rs:841— codex_api::endpoint::responses_websocket::run_websocket_response_stream has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent 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:400— 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 28) codex-rs/codex-api/src/files.rs:133— codex_api::files::upload_openai_file 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_api::sse::responses::process_sse_with_treatment (cyclomatic 19) codex-rs/codex-api/src/sse/responses.rs:609— codex_api::sse::responses::process_sse_with_treatment 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_linux_sandbox::bwrap::create_filesystem_args (cyclomatic 40) codex-rs/linux-sandbox/src/bwrap.rs:405— 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 37) codex-rs/linux-sandbox/src/linux_run_main.rs:144— codex_linux_sandbox::linux_run_main::run_main has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent 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.
codex_linux_sandbox::managed_tcp_stack::run (cyclomatic 20) codex-rs/linux-sandbox/src/managed_tcp_stack.rs:228— codex_linux_sandbox::managed_tcp_stack::run 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_linux_sandbox::seccomp::install_network_seccomp_filter_on_current_thread (cyclomatic 16) codex-rs/linux-sandbox/src/seccomp.rs:186— codex_linux_sandbox::seccomp::install_network_seccomp_filter_on_current_thread has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to one function item inside it that branches. 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::metadata::backfill_sessions_with_lease (cyclomatic 31) codex-rs/rollout/src/metadata.rs:207— 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 29) codex-rs/rollout/src/list.rs:977— codex_rollout::list::read_head_summary 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_rollout::recorder::fill_missing_thread_item_metadata (cyclomatic 19) codex-rs/rollout/src/recorder.rs:1433— codex_rollout::recorder::fill_missing_thread_item_metadata 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_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:1273— 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_sandboxing::seatbelt::seatbelt_regex_for_glob (cyclomatic 26) REDACTED:683— 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::seatbelt::create_seatbelt_command_args_with_profile (cyclomatic 19) REDACTED:818— codex_sandboxing::seatbelt::create_seatbelt_command_args_with_profile 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::windows::resolve_windows_restricted_token_filesystem_overrides (cyclomatic 16) codex-rs/sandboxing/src/windows.rs:78— codex_sandboxing::windows::resolve_windows_restricted_token_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.
codex_sandboxing::windows::resolve_windows_elevated_filesystem_overrides (cyclomatic 16) codex-rs/sandboxing/src/windows.rs:209— 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.
AuthModeWidget::render_pick_mode (cyclomatic 21) codex-rs/tui/src/onboarding/auth.rs:551— AuthModeWidget::render_pick_mode 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.
AuthModeWidget::handle_key_event (cyclomatic 20) codex-rs/tui/src/onboarding/auth.rs:206— AuthModeWidget::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.
AuthModeWidget::handle_sign_in_option (cyclomatic 19) codex-rs/tui/src/onboarding/auth.rs:495— AuthModeWidget::handle_sign_in_option 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.
AuthModeWidget::render_ref (cyclomatic 18) codex-rs/tui/src/onboarding/auth.rs:1231— AuthModeWidget::render_ref 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.
AuthModeWidget::handle_gcp_key_event (cyclomatic 16) codex-rs/tui/src/onboarding/gcp.rs:137— AuthModeWidget::handle_gcp_key_event 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.
AgentsOverviewView::render_center_rows (cognitive 90) codex-rs/tui/src/app/agent_center/rows.rs:38— AgentsOverviewView::render_center_rows has cognitive complexity 90 (threshold 15). Drivers by points: if/else 47 (73 pts), boolean chains 10, match/switch 3 (6 pts), loops 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.
AgentsOverviewView::handle_key_event (cognitive 67) codex-rs/tui/src/app/agents_overview_view.rs:696— AgentsOverviewView::handle_key_event has cognitive complexity 67 (threshold 15). Drivers by points: if/else 33 (51 pts), boolean chains 9, 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::center_footer_hints (cognitive 17) codex-rs/tui/src/app/agent_center/hints.rs:130— AgentsOverviewView::center_footer_hints has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3 (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.
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.
codex_guardian_context::preparation::prepare_sections (cognitive 76) codex-rs/guardian-context/src/preparation/mod.rs:172— codex_guardian_context::preparation::prepare_sections has cognitive complexity 76 (threshold 15). Drivers by points: if/else 19 (61 pts), loops 6 (9 pts), boolean chains 6 (nesting depth added 45). 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_guardian_context::transcript::collect_transcript_for_review (cognitive 74) codex-rs/guardian-context/src/transcript.rs:158— codex_guardian_context::transcript::collect_transcript_for_review has cognitive complexity 74 (threshold 15). Drivers by points: if/else 18 (48 pts), match/switch 7 (20 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.
codex_guardian_context::preparation::root::prepare_root_context (cognitive 37) codex-rs/guardian-context/src/preparation/root.rs:289— codex_guardian_context::preparation::root::prepare_root_context has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 6, match/switch 3 (5 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_guardian_context::allocation::collect_demand (cognitive 22) codex-rs/guardian-context/src/allocation.rs:384— codex_guardian_context::allocation::collect_demand has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 3 (6 pts), loops 3 (5 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.
codex_guardian_context::retained_instructions::render_retained_instructions (cognitive 16) codex-rs/guardian-context/src/retained_instructions.rs:95— codex_guardian_context::retained_instructions::render_retained_instructions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 1 (2 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_exec::run_exec_session (cognitive 74) codex-rs/exec/src/lib.rs:919— 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 67) codex-rs/exec/src/lib.rs:273— codex_exec::run_main has cognitive complexity 67 (threshold 15). Drivers by points: if/else 34 (46 pts), match/switch 9 (13 pts), boolean chains 6, 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.
codex_exec::resolve_resume_thread_id (cognitive 54) codex-rs/exec/src/lib.rs:1993— 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::maybe_backfill_turn_completed_items (cognitive 30) codex-rs/exec/src/lib.rs:1816— codex_exec::maybe_backfill_turn_completed_items has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 3 (8 pts), loops 3 (7 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_exec::daybreak::program_for_turn (cognitive 21) codex-rs/exec/src/daybreak.rs:17— 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.
LocalAgentControl::ensure_v2_agent_loaded (cognitive 73) codex-rs/core/src/agent/control/spawn.rs:247— LocalAgentControl::ensure_v2_agent_loaded has cognitive complexity 73 (threshold 15). Drivers by points: if/else 36 (53 pts), match/switch 5 (10 pts), boolean chains 7, loops 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.
LocalAgentControl::spawn_agent_internal (cognitive 62) codex-rs/core/src/agent/control/spawn.rs:659— LocalAgentControl::spawn_agent_internal has cognitive complexity 62 (threshold 15). Drivers by points: if/else 23 (42 pts), boolean chains 11, match/switch 7 (9 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.
LocalAgentControl::maybe_start_completion_watcher (cognitive 29) codex-rs/core/src/agent/control.rs:465— 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:1070— 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:28— 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.
RemoteControlWebsocket::connect (cognitive 51) codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:697— 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 51) codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:979— RemoteControlWebsocket::run_server_writer_inner has cognitive complexity 51 (threshold 15). Drivers by points: if/else 8 (27 pts), match/switch 8 (18 pts), loops 4 (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.
RemoteControlWebsocket::run_websocket_reader_inner (cognitive 34) codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:1179— 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:460— 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:598— 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.
AppServerSession::submit_user_message (cognitive 34) codex-rs/tui/src/app_server_session/user_message_submission.rs:190— AppServerSession::submit_user_message has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 4 (9 pts), boolean chains 6, loops 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.
AppServerSession::hydrate_initial_thread_history (cognitive 29) codex-rs/tui/src/app_server_session/history.rs:358— AppServerSession::hydrate_initial_thread_history has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 5, 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.
AppServerSession::fork_thread_at_with_presentation (cognitive 25) codex-rs/tui/src/app_server_session.rs:1423— AppServerSession::fork_thread_at_with_presentation has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 6, match/switch 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.
AppServerSession::side_chat_prompt (cognitive 23) codex-rs/tui/src/app_server_session/side_chat_history.rs:324— AppServerSession::side_chat_prompt has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 3 (10 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.
AppServerSession::resume_thread_with_permission_overrides (cognitive 19) codex-rs/tui/src/app_server_session/rollout_history.rs:217— AppServerSession::resume_thread_with_permission_overrides has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10, boolean chains 8, 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.
codex_login::server::process_request (cognitive 31) codex-rs/login/src/server.rs:349— 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::auth::manager::load_auth (cognitive 26) codex-rs/login/src/auth/manager.rs:1606— codex_login::auth::manager::load_auth has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 4, 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.
codex_login::server::bind_server (cognitive 26) codex-rs/login/src/server.rs:641— 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:181— 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:1441— 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.
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:311-339 — 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 8 separate duplicated blocks between them, totalling at least 140 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server/src/command_exec.rs:270` 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.
Duplicated block (29 lines × 2) codex-rs/app-server/src/lib.rs:400— codex-rs/app-server/src/lib.rs:400-428 | 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:1619— codex-rs/config/src/config_requirements.rs:1619-1647 | codex-rs/ext/guardian-v2/src/async_scorer/classification.rs:118-146 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/config/src/config_requirements.rs:1619` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/external-agent-migration/src/sessions/records_cla.rs:201` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (29 lines × 2) codex-rs/state/src/runtime/memories.rs:883— codex-rs/state/src/runtime/memories.rs:883-911 | codex-rs/state/src/runtime/memories.rs:960-988 — both copies are in the same file, so extract the 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.
Duplicated block (21 lines × 2) codex-rs/cli/src/mcp_cmd.rs:739— codex-rs/cli/src/mcp_cmd.rs:739-759 | codex-rs/cli/src/mcp_cmd.rs:978-998 — both copies are in the same file, so extract the 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 `codex-rs/cli/src/mcp_cmd.rs:739` 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.
Duplicated block (21 lines × 2) codex-rs/rollout-trace/src/protocol_event.rs:396— codex-rs/rollout-trace/src/protocol_event.rs:396-416 | codex-rs/rollout-trace/src/protocol_event.rs:478-498 — both copies are in the same file, so extract the 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, `codex-rs/rollout-trace/src/protocol_event.rs:476` calls `McpToolCallBegin`, `McpToolCallEnd` and `codex-rs/rollout-trace/src/protocol_event.rs:395` 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 (21 lines × 2) codex-rs/rollout/src/list.rs:625— codex-rs/rollout/src/list.rs:625-645 | codex-rs/rollout/src/list.rs:689-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/rollout/src/list.rs:625` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (21 lines × 2) codex-rs/windows-sandbox-rs/src/lib.rs:831— codex-rs/windows-sandbox-rs/src/lib.rs:831-851 | codex-rs/windows-sandbox-rs/src/lib.rs:852-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 (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.
Outbound HTTP without resilience codex-rs/http-client/src/client_builder.rs:373— `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:399— `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.
codex_cloud_tasks::run_cloud (cyclomatic 221) codex-rs/cloud-tasks/src/lib.rs:827— codex_cloud_tasks::run_cloud has cyclomatic complexity 221 (threshold 15). To reduce it, separate the cases: extract each independent 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:2154— 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:331— 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.
ContextManager::reconstruct_rollout (cyclomatic 62) codex-rs/core/src/session/rollout_reconstruction.rs:214— ContextManager::reconstruct_rollout 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.
ContextManager::restore_review_context (cyclomatic 21) codex-rs/core/src/context_manager/history.rs:430— 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:115— 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:972— 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.
AnalyticsReducer::ingest (cyclomatic 50) codex-rs/analytics/src/reducer.rs:614— AnalyticsReducer::ingest 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.
AnalyticsReducer::ingest_notification (cyclomatic 43) codex-rs/analytics/src/reducer.rs:2068— 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 22) codex-rs/analytics/src/reducer.rs:1768— AnalyticsReducer::ingest_server_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.
AnalyticsReducer::ingest_code_mode_tool_call (cyclomatic 16) codex-rs/analytics/src/reducer.rs:920— 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.
codex_exec::run_main (cyclomatic 49) codex-rs/exec/src/lib.rs:273— codex_exec::run_main 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_exec::run_exec_session (cyclomatic 48) codex-rs/exec/src/lib.rs:919— 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::should_process_notification (cyclomatic 29) codex-rs/exec/src/lib.rs:1752— 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:1993— 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.
MathParser::command (cyclomatic 45) codex-rs/tui/src/markdown_render/math/render.rs:225— MathParser::command has cyclomatic complexity 45 (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::grid (cyclomatic 40) codex-rs/tui/src/markdown_render/math/render/structured.rs:161— MathParser::grid 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.
MathParser::structured_command (cyclomatic 16) codex-rs/tui/src/markdown_render/math/render/structured.rs:86— MathParser::structured_command 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.
MathParser::sequence (cyclomatic 16) codex-rs/tui/src/markdown_render/math/render.rs:118— 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.
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.
codex_git_utils::info::remotes::get_git_remote_urls_with_progress (cyclomatic 19) codex-rs/git-utils/src/info/remotes.rs:52— codex_git_utils::info::remotes::get_git_remote_urls_with_progress 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.
AppServerSession::submit_user_message (cyclomatic 25) codex-rs/tui/src/app_server_session/user_message_submission.rs:190— AppServerSession::submit_user_message 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.
AppServerSession::fork_thread_at_with_presentation (cyclomatic 23) codex-rs/tui/src/app_server_session.rs:1423— AppServerSession::fork_thread_at_with_presentation 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.
AppServerSession::hydrate_initial_thread_history (cyclomatic 20) codex-rs/tui/src/app_server_session/history.rs:358— AppServerSession::hydrate_initial_thread_history 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.
AppServerSession::resume_thread_with_permission_overrides (cyclomatic 19) codex-rs/tui/src/app_server_session/rollout_history.rs:217— AppServerSession::resume_thread_with_permission_overrides 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_skills_extension::host_roots::repo_agents_skill_roots (cyclomatic 24) codex-rs/ext/skills/src/host_roots.rs:192— codex_skills_extension::host_roots::repo_agents_skill_roots 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_skills_extension::loader::discovery::discover_skills (cyclomatic 18) codex-rs/ext/skills/src/loader/discovery.rs:55— codex_skills_extension::loader::discovery::discover_skills 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_skills_extension::loader::host::load_skills_under_root (cyclomatic 18) codex-rs/ext/skills/src/loader/host.rs:146— codex_skills_extension::loader::host::load_skills_under_root 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_skills_extension::catalog_delta::build_catalog_update (cyclomatic 17) codex-rs/ext/skills/src/catalog_delta.rs:186— codex_skills_extension::catalog_delta::build_catalog_update 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.
RemoteControlWebsocket::run_server_writer_inner (cyclomatic 23) codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:979— RemoteControlWebsocket::run_server_writer_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.
RemoteControlWebsocket::connect (cyclomatic 22) codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:697— 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:1179— 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 (cyclomatic 16) codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:460— 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.
codex_core_plugins::remote::fetch_remote_marketplaces (cyclomatic 19) codex-rs/core-plugins/src/remote.rs:937— 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:546— 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:1420— 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.
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:834— 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.
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:944— 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.
PluginsManager::write_remote_installed_plugins_cache_snapshot (cyclomatic 17) codex-rs/core-plugins/src/manager.rs:1589— PluginsManager::write_remote_installed_plugins_cache_snapshot 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.
PluginsManager::schedule_non_curated_plugin_cache_refresh (cyclomatic 17) codex-rs/core-plugins/src/manager.rs:3351— PluginsManager::schedule_non_curated_plugin_cache_refresh 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.
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.
RequestUserInputOverlay::handle_key_event (cognitive 89) codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:1203— 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:585— 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:1087— 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.
ContextManager::reconstruct_rollout (cognitive 87) codex-rs/core/src/session/rollout_reconstruction.rs:214— ContextManager::reconstruct_rollout has cognitive complexity 87 (threshold 15). Drivers by points: if/else 28 (64 pts), match/switch 7 (12 pts), boolean chains 7, loops 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.
ContextManager::restore_review_context (cognitive 28) codex-rs/core/src/context_manager/history.rs:430— 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:972— 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:115— 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.
MathParser::grid (cognitive 75) codex-rs/tui/src/markdown_render/math/render/structured.rs:161— MathParser::grid has cognitive complexity 75 (threshold 15). Drivers by points: if/else 28 (56 pts), loops 5 (9 pts), boolean chains 6, match/switch 2 (4 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.
MathParser::sequence (cognitive 26) codex-rs/tui/src/markdown_render/math/render.rs:118— 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::structured_command (cognitive 25) codex-rs/tui/src/markdown_render/math/render/structured.rs:86— MathParser::structured_command has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (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.
MathParser::command (cognitive 24) codex-rs/tui/src/markdown_render/math/render.rs:225— MathParser::command has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 5 (9 pts), boolean chains 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.
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:387— 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.
codex_app_server_client::cloud_backend::run_worker_with_prepared (cognitive 52) codex-rs/app-server-client/src/cloud_backend/mod.rs:312— codex_app_server_client::cloud_backend::run_worker_with_prepared has cognitive complexity 52 (threshold 15). Drivers by points: match/switch 10 (25 pts), if/else 9 (21 pts), boolean chains 5, loops 1 (nesting depth added 27). 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_client::cloud_backend::advance_prepared_resume (cognitive 48) codex-rs/app-server-client/src/cloud_backend/mod.rs:556— codex_app_server_client::cloud_backend::advance_prepared_resume has cognitive complexity 48 (threshold 15). Drivers by points: if/else 8 (29 pts), match/switch 6 (17 pts), boolean chains 2 (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.
codex_app_server_client::cloud_backend::handle_request (cognitive 18) codex-rs/app-server-client/src/cloud_backend/mod.rs:655— codex_app_server_client::cloud_backend::handle_request has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 4 (5 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_client::cloud_backend::requests::cloud_message (cognitive 18) codex-rs/app-server-client/src/cloud_backend/requests.rs:325— codex_app_server_client::cloud_backend::requests::cloud_message has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 4 (10 pts), if/else 4 (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.
ComposedContext::enforce_budget (cognitive 49) codex-rs/guardian-context/src/enforcement.rs:255— ComposedContext::enforce_budget has cognitive complexity 49 (threshold 15). Drivers by points: if/else 16 (34 pts), loops 6 (11 pts), boolean chains 4 (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.
ComposedContext::prepare_elastic_entries (cognitive 28) codex-rs/guardian-context/src/preparation/elastic.rs:27— ComposedContext::prepare_elastic_entries has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (21 pts), loops 2 (4 pts), match/switch 1 (2 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.
ComposedContext::into_annotated_messages (cognitive 17) codex-rs/guardian-context/src/composition.rs:625— ComposedContext::into_annotated_messages 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.
ComposedContext::prune_omission_notices (cognitive 16) codex-rs/guardian-context/src/retained_instructions.rs:269— ComposedContext::prune_omission_notices has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4 (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.
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.
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 44) codex-rs/app-server/src/request_processors/plugins.rs:560— PluginRequestProcessor::plugin_list_response has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17, boolean chains 12, match/switch 6 (12 pts), 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.
PluginRequestProcessor::plugin_read_response (cognitive 20) codex-rs/app-server/src/request_processors/plugins.rs:1034— 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:1915— 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.
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.
ExecCell::exploring_display_lines (cognitive 41) codex-rs/tui/src/exec_cell/render.rs:362— 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:503— 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.
PickerState::handle_key (cognitive 38) codex-rs/tui/src/resume_picker.rs:1615— 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::route_key_chord (cognitive 25) codex-rs/tui/src/resume_picker.rs:1394— PickerState::route_key_chord has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 4, 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.
PickerState::handle_background_event (cognitive 21) codex-rs/tui/src/resume_picker.rs:1872— PickerState::handle_background_event has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 4 (7 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.
PickerState::ingest_page (cognitive 19) codex-rs/tui/src/resume_picker.rs:2037— PickerState::ingest_page has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 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_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.
AuthModeWidget::handle_api_key_entry_key_event (cognitive 26) codex-rs/tui/src/onboarding/auth.rs:921— AuthModeWidget::handle_api_key_entry_key_event has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (21 pts), match/switch 1 (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.
AuthModeWidget::render_pick_mode (cognitive 24) codex-rs/tui/src/onboarding/auth.rs:551— AuthModeWidget::render_pick_mode has cognitive complexity 24 (threshold 15). Drivers by points: if/else 17 (19 pts), boolean chains 2, 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.
AuthModeWidget::handle_key_event (cognitive 20) codex-rs/tui/src/onboarding/auth.rs:206— AuthModeWidget::handle_key_event has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 3, 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.
AuthModeWidget::handle_sign_in_option (cognitive 20) codex-rs/tui/src/onboarding/auth.rs:495— AuthModeWidget::handle_sign_in_option has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 3, match/switch 1 (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_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::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· Edited copy of a member (30 corresponding lines) · ×4
Edited copy of a member (30 corresponding lines) codex-rs/core/src/hook_runtime.rs:280— codex-rs/core/src/hook_runtime.rs:280-312 | codex-rs/core/src/hook_runtime.rs:324-353 — These two members are one piece of code written twice and then edited apart: 30 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.
Edited copy of a member (30 corresponding lines) codex-rs/shell-command/src/parse_command.rs:1706— codex-rs/shell-command/src/parse_command.rs:1706-1735 | codex-rs/shell-command/src/parse_command.rs:1753-1785 — These two members are one piece of code written twice and then edited apart: 30 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.
Edited copy of a member (30 corresponding lines) codex-rs/config/src/config_requirements.rs:670— codex-rs/config/src/config_requirements.rs:670-699 | codex-rs/tui/src/bottom_pane/app_link_view.rs:269-299 — These two members are one piece of code written twice and then edited apart: 30 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.
Edited copy of a member (30 corresponding lines) codex-rs/app-server-test-client/src/lib.rs:802— codex-rs/app-server-test-client/src/lib.rs:802-831 | codex-rs/app-server-test-client/src/lib.rs:943-979 — These two members are one piece of code written twice and then edited apart: 30 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 (28 corresponding lines) · ×4
Edited copy of a member (28 corresponding lines) codex-rs/app-server-protocol/src/protocol/v2/turn.rs:519— codex-rs/app-server-protocol/src/protocol/v2/turn.rs:519-546 | codex-rs/app-server-protocol/src/protocol/v2/turn.rs:550-582 — These two members are one piece of code written twice and then edited apart: 28 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.
Edited copy of a member (28 corresponding lines) codex-rs/hooks/src/engine/dispatcher.rs:80— codex-rs/hooks/src/engine/dispatcher.rs:80-107 | codex-rs/hooks/src/engine/dispatcher.rs:248-275 — These two members are one piece of code written twice and then edited apart: 28 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.
Edited copy of a member (28 corresponding lines) codex-rs/core/src/mcp_tool_call.rs:1140— codex-rs/core/src/mcp_tool_call.rs:1140-1167 | codex-rs/core/src/tools/handlers/mcp_resource.rs:410-437 — These two members are one piece of code written twice and then edited apart: 28 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.
Edited copy of a member (28 corresponding lines) codex-rs/rollout-trace/src/protocol_event.rs:174— codex-rs/rollout-trace/src/protocol_event.rs:174-201 | codex-rs/rollout-trace/src/protocol_event.rs:232-267 — These two members are one piece of code written twice and then edited apart: 28 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 (31 corresponding lines) · ×4
Edited copy of a member (31 corresponding lines) codex-rs/tui/src/streaming/controller.rs:294— codex-rs/tui/src/streaming/controller.rs:294-330 | codex-rs/tui/src/streaming/controller.rs:343-373 — These two members are one piece of code written twice and then edited apart: 31 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.
Edited copy of a member (31 corresponding lines) sdk/python/src/openai_codex/_run.py:69— sdk/python/src/openai_codex/_run.py:69-99 | sdk/python/src/openai_codex/_run.py:105-135 — These two members are one piece of code written twice and then edited apart: 31 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.
Edited copy of a member (31 corresponding lines) sdk/python/src/openai_codex/api.py:634— sdk/python/src/openai_codex/api.py:634-664 | sdk/python/src/openai_codex/api.py:740-771 — These two members are one piece of code written twice and then edited apart: 31 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.
Edited copy of a member (31 corresponding lines) codex-rs/exec/src/lib.rs:887— codex-rs/exec/src/lib.rs:887-917 | codex-rs/tui/src/lib.rs:2588-2619 — These two members are one piece of code written twice and then edited apart: 31 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 copies of one member (3 members, 13+ corresponding lines) · ×4
Edited copies of one member (3 members, 13+ corresponding lines) codex-rs/history/src/lib.rs:493— codex-rs/history/src/lib.rs:493-505 | codex-rs/history/src/lib.rs:523-535 | codex-rs/history/src/lib.rs:588-600 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 13+ corresponding lines) codex-rs/code-mode-runtime/src/runtime/callbacks.rs:84— codex-rs/code-mode-runtime/src/runtime/callbacks.rs:84-99 | codex-rs/code-mode-runtime/src/runtime/callbacks.rs:116-128 | codex-rs/code-mode-runtime/src/runtime/callbacks.rs:134-147 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 13+ corresponding lines) codex-rs/tui/src/app/provider.rs:373— codex-rs/tui/src/app/provider.rs:373-393 | codex-rs/tui/src/bottom_pane/popup_consts.rs:28-40 | codex-rs/tui/src/chatwidget/usage.rs:578-593 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 13+ corresponding lines) codex-rs/hooks/src/events/permission_request.rs:74— codex-rs/hooks/src/events/permission_request.rs:74-89 | codex-rs/hooks/src/events/post_tool_use.rs:61-73 | codex-rs/hooks/src/events/pre_tool_use.rs:62-74 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 12+ corresponding lines) · ×4
Edited copies of one member (3 members, 12+ corresponding lines) codex-rs/tui/src/render/renderable.rs:191— codex-rs/tui/src/render/renderable.rs:191-204 | codex-rs/tui/src/render/renderable.rs:217-230 | codex-rs/tui/src/render/renderable.rs:232-243 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 12+ corresponding lines) codex-rs/core/src/context/environment_context.rs:199— codex-rs/core/src/context/environment_context.rs:199-210 | codex-rs/hooks/src/engine/discovery.rs:488-501 | codex-rs/login/src/server.rs:1020-1033 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 12+ corresponding lines) codex-rs/app-server-transport/src/transport/websocket.rs:102— codex-rs/app-server-transport/src/transport/websocket.rs:102-113 | codex-rs/exec-server/src/server/transport.rs:227-238 | codex-rs/otel-trace-websocket/src/lib.rs:120-131 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 12+ corresponding lines) codex-rs/app-server-protocol/src/protocol/v2/thread.rs:864— codex-rs/app-server-protocol/src/protocol/v2/thread.rs:864-875 | codex-rs/app-server/src/request_processors/thread_goal_processor.rs:525-536 | codex-rs/ext/goal/src/tool.rs:510-521 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 10+ corresponding lines) · ×4
Edited copies of one member (3 members, 10+ corresponding lines) codex-rs/tui/src/app/plugin_mentions.rs:73— codex-rs/tui/src/app/plugin_mentions.rs:73-82 | codex-rs/tui/src/chatwidget/plugin_catalog.rs:1803-1815 | codex-rs/tui/src/chatwidget/plugin_catalog.rs:1840-1849 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) codex-rs/state/src/runtime/remote_control.rs:112— codex-rs/state/src/runtime/remote_control.rs:112-130 | codex-rs/state/src/runtime/threads.rs:79-105 | codex-rs/state/src/runtime/threads.rs:436-445 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) codex-rs/git-utils/src/info.rs:795— codex-rs/git-utils/src/info.rs:795-804 | codex-rs/tui/src/branch_summary.rs:103-112 | codex-rs/tui/src/branch_summary.rs:395-404 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) codex-rs/hooks/src/events/compact.rs:62— codex-rs/hooks/src/events/compact.rs:62-71 | codex-rs/hooks/src/events/session_end.rs:39-48 | codex-rs/hooks/src/events/user_prompt_submit.rs:53-62 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server/src/request_processors/command_exec_processor.rs:157` 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.
Duplicated block (13–14 lines × 2) codex-rs/core/src/guardian/review_session.rs:734— codex-rs/core/src/guardian/review_session.rs:734-747 | codex-rs/core/src/guardian/review_session.rs:777-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core/src/guardian/review_session.rs:734` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/list_selection_view.rs:1149` 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. 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 (13–14 lines × 2) codex-rs/tui/src/bottom_pane/textarea.rs:1891— codex-rs/tui/src/bottom_pane/textarea.rs:1891-1903 | codex-rs/tui/src/bottom_pane/textarea.rs:1908-1921 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/bottom_pane/textarea.rs:1891` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/state/src/runtime/thread_attachments.rs:36` 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.
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:329-339 — 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 4 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/experimental_features_view.rs:420` 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.
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.
Config::load_config_with_layer_stack (cyclomatic 117) codex-rs/core/src/config/mod.rs:3392— Config::load_config_with_layer_stack has cyclomatic complexity 117 (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 23) codex-rs/core/src/config/runtime_refresh.rs:40— Config::resolve_runtime_refresh 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.
Config::to_mcp_config_with_loaded_plugins (cyclomatic 19) codex-rs/core/src/config/mod.rs:1949— Config::to_mcp_config_with_loaded_plugins 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.
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.
AgentsOverviewView::handle_key_event (cyclomatic 59) codex-rs/tui/src/app/agents_overview_view.rs:696— AgentsOverviewView::handle_key_event has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent 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 53) codex-rs/tui/src/app/agent_center/rows.rs:38— AgentsOverviewView::render_center_rows 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.
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.
RequestUserInputOverlay::handle_key_event (cyclomatic 56) codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:1203— 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:585— 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.
PickerState::handle_key (cyclomatic 47) codex-rs/tui/src/resume_picker.rs:1615— 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 20) codex-rs/tui/src/resume_picker.rs:1872— PickerState::handle_background_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.
PickerState::route_key_chord (cyclomatic 18) codex-rs/tui/src/resume_picker.rs:1394— PickerState::route_key_chord 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.
LocalAgentControl::ensure_v2_agent_loaded (cyclomatic 44) codex-rs/core/src/agent/control/spawn.rs:247— LocalAgentControl::ensure_v2_agent_loaded has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent 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::spawn_agent_internal (cyclomatic 40) codex-rs/core/src/agent/control/spawn.rs:659— LocalAgentControl::spawn_agent_internal 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.
LocalAgentControl::maybe_start_completion_watcher (cyclomatic 22) codex-rs/core/src/agent/control.rs:465— 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.
codex_guardian_context::transcript::collect_transcript_for_review (cyclomatic 43) codex-rs/guardian-context/src/transcript.rs:158— codex_guardian_context::transcript::collect_transcript_for_review 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_guardian_context::preparation::prepare_sections (cyclomatic 32) codex-rs/guardian-context/src/preparation/mod.rs:172— codex_guardian_context::preparation::prepare_sections 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_guardian_context::preparation::root::prepare_root_context (cyclomatic 25) codex-rs/guardian-context/src/preparation/root.rs:289— codex_guardian_context::preparation::root::prepare_root_context 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_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:387— 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.
UnifiedExecProcessManager::write_stdin_inner (cyclomatic 26) codex-rs/core/src/unified_exec/process_manager.rs:904— UnifiedExecProcessManager::write_stdin_inner 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.
UnifiedExecProcessManager::exec_command_inner (cyclomatic 22) codex-rs/core/src/unified_exec/process_manager.rs:533— 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:1569— 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.
codex_mcp::mcp::auth::compute_auth_status (cyclomatic 21) codex-rs/codex-mcp/src/mcp/auth.rs:258— 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 17) codex-rs/codex-mcp/src/rmcp_client.rs:1140— codex_mcp::rmcp_client::start_server_task 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_mcp::rmcp_client::make_rmcp_client (cyclomatic 17) codex-rs/codex-mcp/src/rmcp_client.rs:1443— codex_mcp::rmcp_client::make_rmcp_client 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.
ExecCell::command_display_lines_with_hidden_details (cyclomatic 21) codex-rs/tui/src/exec_cell/render.rs:503— 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:362— 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.
McpRequestProcessor::mcp_server_oauth_login_response (cyclomatic 19) codex-rs/app-server/src/request_processors/mcp_processor.rs:136— 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::read_mcp_resource (cyclomatic 18) codex-rs/app-server/src/request_processors/mcp_processor.rs:621— McpRequestProcessor::read_mcp_resource 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.
McpRequestProcessor::list_mcp_server_status_response (cyclomatic 16) codex-rs/app-server/src/request_processors/mcp_processor.rs:408— McpRequestProcessor::list_mcp_server_status_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.
McpConnectionSet::new (cognitive 188) codex-rs/codex-mcp/src/connection_manager.rs:416— McpConnectionSet::new has cognitive complexity 188 (threshold 15). Drivers by points: if/else 56 (113 pts), boolean chains 34, match/switch 12 (33 pts), loops 5 (8 pts) (nesting depth added 81). 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 67) codex-rs/codex-mcp/src/connection_manager/tool_catalog.rs:293— McpConnectionSet::capture_binding_with_metadata has cognitive complexity 67 (threshold 15). Drivers by points: if/else 29 (47 pts), boolean chains 15, 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:122— 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.
Config::load_config_with_layer_stack (cognitive 146) codex-rs/core/src/config/mod.rs:3392— Config::load_config_with_layer_stack has cognitive complexity 146 (threshold 15). Drivers by points: if/else 77 (97 pts), boolean chains 35, match/switch 11 (12 pts), loops 2 (nesting depth added 21). 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::to_mcp_config_with_loaded_plugins (cognitive 29) codex-rs/core/src/config/mod.rs:1949— Config::to_mcp_config_with_loaded_plugins has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 5, loops 4 (5 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.
Config::resolve_runtime_refresh (cognitive 28) codex-rs/core/src/config/runtime_refresh.rs:40— Config::resolve_runtime_refresh has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 9, 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.
AccountRequestProcessor::read_account (cognitive 77) codex-rs/app-server/src/request_processors/account_processor/workspace_routing.rs:309— AccountRequestProcessor::read_account has cognitive complexity 77 (threshold 15). Drivers by points: if/else 21 (57 pts), match/switch 5 (9 pts), boolean chains 8, loops 1 (3 pts) (nesting depth added 42). 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:1117— 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.
AccountRequestProcessor::gateway_oauth_login (cognitive 19) codex-rs/app-server/src/request_processors/account_processor/gateway_oauth.rs:99— AccountRequestProcessor::gateway_oauth_login has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 4 (7 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.
RuntimeKeymap::resolve (cognitive 64) codex-rs/tui/src/keymap.rs:707— RuntimeKeymap::resolve has cognitive complexity 64 (threshold 15). Drivers by points: boolean chains 30, if/else 22 (28 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:2173— 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.
PidBackend::start_inner (cognitive 63) codex-rs/app-server-daemon/src/backend/pid_start.rs:22— PidBackend::start_inner has cognitive complexity 63 (threshold 15). Drivers by points: if/else 24 (45 pts), match/switch 9 (15 pts), boolean chains 2, 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.
PidBackend::stop_with_grace (cognitive 36) codex-rs/app-server-daemon/src/backend/pid.rs:172— 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.
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::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.
codex_connectors::merge_directory_app (cognitive 61) codex-rs/connectors/src/lib.rs:307— 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.
codex_connectors::app_tool_policy::apps_config_overlays (cognitive 19) codex-rs/connectors/src/app_tool_policy.rs:139— codex_connectors::app_tool_policy::apps_config_overlays has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 2, loops 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.
ExternalAgentConfigService::import (cognitive 61) codex-rs/external-agent-migration/src/service.rs:209— 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.
BottomPane::renderable_for_views (cognitive 56) codex-rs/tui/src/bottom_pane/mod.rs:2466— 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 47) codex-rs/tui/src/bottom_pane/mod.rs:898— BottomPane::handle_key_event_with_activation_key has cognitive complexity 47 (threshold 15). Drivers by points: if/else 23 (36 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:1091— 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.
LocalThreadStore::migrate_rollout_path (cognitive 52) codex-rs/thread-store/src/local/rollout_migration.rs:419— 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 25) codex-rs/thread-store/src/local/rollout_lineage.rs:86— LocalThreadStore::resolve_rollout_lineage_with_mode has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 3 (7 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.
LocalThreadStore::migrate_one_rollout (cognitive 25) codex-rs/thread-store/src/local/rollout_migration.rs:650— 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.
UnifiedExecProcessManager::write_stdin_inner (cognitive 49) codex-rs/core/src/unified_exec/process_manager.rs:904— UnifiedExecProcessManager::write_stdin_inner has cognitive complexity 49 (threshold 15). Drivers by points: if/else 24 (41 pts), boolean chains 4, match/switch 2 (4 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.
UnifiedExecProcessManager::exec_command_inner (cognitive 33) codex-rs/core/src/unified_exec/process_manager.rs:533— 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:1569— 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.
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.
McpToolCallCell::compact_mcp_lines (cognitive 44) codex-rs/tui/src/history_cell/mcp_preview.rs:37— 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:236— 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:147— 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.
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.
codex_guardian_reviewer::completion::complete_review (cognitive 37) codex-rs/ext/guardian-reviewer/src/completion.rs:39— codex_guardian_reviewer::completion::complete_review has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (28 pts), match/switch 6 (9 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_guardian_reviewer::execution::wait_for_guardian_review (cognitive 27) codex-rs/ext/guardian-reviewer/src/execution.rs:69— 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::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.
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.
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.
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.
AppLinkView::activate_selected_action (cognitive 33) codex-rs/tui/src/bottom_pane/app_link_view.rs:422— 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:490— 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:561— 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.
codex_state::runtime::threads::push_thread_filters_with_preview (cognitive 30) codex-rs/state/src/runtime/threads.rs:1563— codex_state::runtime::threads::push_thread_filters_with_preview has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 6 (9 pts), loops 3 (6 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.
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:479— 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.
RmcpClient::create_pending_transport (cognitive 29) codex-rs/rmcp-client/src/rmcp_client.rs:1391— 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:1053— 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.
McpRequestProcessor::mcp_server_oauth_login_response (cognitive 28) codex-rs/app-server/src/request_processors/mcp_processor.rs:136— 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.
McpRequestProcessor::list_mcp_server_status_response (cognitive 28) codex-rs/app-server/src/request_processors/mcp_processor.rs:408— McpRequestProcessor::list_mcp_server_status_response has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 7 (9 pts), loops 1 (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.
McpRequestProcessor::read_mcp_resource (cognitive 17) codex-rs/app-server/src/request_processors/mcp_processor.rs:621— McpRequestProcessor::read_mcp_resource has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 5, match/switch 2 (3 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.
Daemon::try_restart_if_running (cognitive 26) codex-rs/app-server-daemon/src/lib.rs:559— 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:885— 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:811— 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.
TranscriptOverlay::handle_key (cognitive 23) codex-rs/tui/src/pager_overlay/transcript.rs:445— 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::render (cognitive 21) codex-rs/tui/src/pager_overlay/transcript.rs:76— TranscriptOverlay::render has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (19 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.
TranscriptOverlay::handle_event (cognitive 19) codex-rs/tui/src/pager_overlay/transcript.rs:183— 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.
WorkerRuntime::run_with_backend_availability (cognitive 20) codex-rs/app-server/src/turn_cost_worker.rs:220— 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:315— 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.
TooManyFunctions: codex_tui::render::highlight codex-rs/tui/src/render/highlight.rs:84— TooManyFunctions — 36 free functions. The bar is 30 free functions; this is 6 over it, 1.20× 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::multi_agents codex-rs/tui/src/multi_agents.rs:77— 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::style codex-rs/tui/src/style.rs:32— TooManyFunctions — 32 free functions. The bar is 30 free functions; this is 2 over it, 1.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.
D4 · Code Duplication· Edited copy of a member (43 corresponding lines) · ×3
Edited copy of a member (43 corresponding lines) codex-rs/tui/src/bottom_pane/multi_select_picker.rs:238— codex-rs/tui/src/bottom_pane/multi_select_picker.rs:238-280 | codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:99-142 — These two members are one piece of code written twice and then edited apart: 43 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.
Edited copy of a member (43 corresponding lines) codex-rs/cloud-tasks/src/lib.rs:712— codex-rs/cloud-tasks/src/lib.rs:712-765 | codex-rs/cloud-tasks/src/lib.rs:773-815 — These two members are one piece of code written twice and then edited apart: 43 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.
Edited copy of a member (43 corresponding lines) codex-rs/protocol/src/permissions.rs:841— codex-rs/protocol/src/permissions.rs:841-883 | codex-rs/protocol/src/permissions.rs:2437-2503 — These two members are one piece of code written twice and then edited apart: 43 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 (37 corresponding lines) · ×3
Edited copy of a member (37 corresponding lines) codex-rs/external-agent-migration/src/service.rs:573— codex-rs/external-agent-migration/src/service.rs:573-620 | codex-rs/external-agent-migration/src/service.rs:622-658 — These two members are one piece of code written twice and then edited apart: 37 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.
Edited copy of a member (37 corresponding lines) codex-rs/config/src/state.rs:524— codex-rs/config/src/state.rs:524-564 | codex-rs/config/src/state.rs:626-662 — These two members are one piece of code written twice and then edited apart: 37 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.
Edited copy of a member (37 corresponding lines) codex-rs/core-plugins/src/marketplace_add/metadata.rs:55— codex-rs/core-plugins/src/marketplace_add/metadata.rs:55-92 | codex-rs/core-plugins/src/marketplace_add/metadata.rs:98-134 — These two members are one piece of code written twice and then edited apart: 37 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 (36 corresponding lines) · ×3
Edited copy of a member (36 corresponding lines) codex-rs/codex-mcp/src/mcp/mod.rs:762— codex-rs/codex-mcp/src/mcp/mod.rs:762-797 | codex-rs/codex-mcp/src/mcp/mod.rs:801-837 — These two members are one piece of code written twice and then edited apart: 36 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.
Edited copy of a member (36 corresponding lines) codex-rs/network-proxy/src/windows_tcp_attribution.rs:98— codex-rs/network-proxy/src/windows_tcp_attribution.rs:98-133 | codex-rs/network-proxy/src/windows_tcp_attribution.rs:224-259 — These two members are one piece of code written twice and then edited apart: 36 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.
Edited copy of a member (36 corresponding lines) codex-rs/app-server/src/app_info.rs:23— codex-rs/app-server/src/app_info.rs:23-58 | codex-rs/tui/src/app_info.rs:18-53 — These two members are one piece of code written twice and then edited apart: 36 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 (39 corresponding lines) · ×3
Edited copy of a member (39 corresponding lines) codex-rs/core/src/client.rs:3287— codex-rs/core/src/client.rs:3287-3336 | codex-rs/core/src/client.rs:3353-3391 — These two members are one piece of code written twice and then edited apart: 39 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.
Edited copy of a member (39 corresponding lines) codex-rs/app-server-protocol/src/protocol/thread_history.rs:652— codex-rs/app-server-protocol/src/protocol/thread_history.rs:652-690 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:692-730 — These two members are one piece of code written twice and then edited apart: 39 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.
Edited copy of a member (39 corresponding lines) codex-rs/core/src/mcp_tool_call.rs:1177— codex-rs/core/src/mcp_tool_call.rs:1177-1215 | codex-rs/core/src/tools/handlers/mcp_resource.rs:446-484 — These two members are one piece of code written twice and then edited apart: 39 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 (42 corresponding lines) · ×3
Edited copy of a member (42 corresponding lines) codex-rs/codex-mcp/src/mcp/mod.rs:487— codex-rs/codex-mcp/src/mcp/mod.rs:487-528 | codex-rs/codex-mcp/src/mcp/mod.rs:557-618 — These two members are one piece of code written twice and then edited apart: 42 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.
Edited copy of a member (42 corresponding lines) codex-rs/hooks/src/events/interrupt.rs:61— codex-rs/hooks/src/events/interrupt.rs:61-115 | codex-rs/hooks/src/events/session_end.rs:53-94 — These two members are one piece of code written twice and then edited apart: 42 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.
Edited copy of a member (42 corresponding lines) codex-rs/app-server/src/app_info.rs:64— codex-rs/app-server/src/app_info.rs:64-108 | codex-rs/chatgpt/src/connectors.rs:276-317 — These two members are one piece of code written twice and then edited apart: 42 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 (26 corresponding lines) · ×3
Edited copy of a member (26 corresponding lines) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1291— codex-rs/app-server-protocol/src/protocol/thread_history.rs:1291-1316 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:1340-1365 — These two members are one piece of code written twice and then edited apart: 26 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.
Edited copy of a member (26 corresponding lines) codex-rs/app-server/src/command_exec.rs:325— codex-rs/app-server/src/command_exec.rs:325-353 | codex-rs/app-server/src/request_processors/process_exec_processor.rs:372-397 — These two members are one piece of code written twice and then edited apart: 26 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.
Edited copy of a member (26 corresponding lines) codex-rs/rollout-trace/src/reducer/code_cell.rs:250— codex-rs/rollout-trace/src/reducer/code_cell.rs:250-277 | codex-rs/rollout-trace/src/reducer/code_cell.rs:320-345 — These two members are one piece of code written twice and then edited apart: 26 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 (29 corresponding lines) · ×3
Edited copy of a member (29 corresponding lines) codex-rs/ext/memories/src/schema.rs:14— codex-rs/ext/memories/src/schema.rs:14-42 | codex-rs/ext/skills/src/tools/schema.rs:14-42 — These two members are one piece of code written twice and then edited apart: 29 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.
Edited copy of a member (29 corresponding lines) codex-rs/cli/src/login.rs:260— codex-rs/cli/src/login.rs:260-288 | codex-rs/cli/src/login.rs:293-328 — These two members are one piece of code written twice and then edited apart: 29 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.
Edited copy of a member (29 corresponding lines) codex-rs/model-provider-info/src/lib.rs:670— codex-rs/model-provider-info/src/lib.rs:670-699 | codex-rs/model-provider-info/src/lib.rs:917-945 — These two members are one piece of code written twice and then edited apart: 29 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 copies of one member (3 members, 17+ corresponding lines) · ×3
Edited copies of one member (3 members, 17+ corresponding lines) codex-rs/model-provider/src/shared_state.rs:54— codex-rs/model-provider/src/shared_state.rs:54-70 | codex-rs/model-provider/src/shared_state.rs:146-165 | codex-rs/model-provider/src/shared_state.rs:170-189 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 17+ corresponding lines) codex-rs/rollout-trace/src/code_cell.rs:106— codex-rs/rollout-trace/src/code_cell.rs:106-122 | codex-rs/rollout-trace/src/code_cell.rs:142-158 | codex-rs/rollout-trace/src/compaction.rs:193-211 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 17+ corresponding lines) codex-rs/exec-server/src/sandboxed_file_system.rs:176— codex-rs/exec-server/src/sandboxed_file_system.rs:176-192 | codex-rs/exec-server/src/sandboxed_file_system.rs:199-215 | codex-rs/exec-server/src/sandboxed_file_system.rs:304-321 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 8+ corresponding lines) · ×3
Edited copies of one member (3 members, 8+ corresponding lines) codex-rs/memories/write/src/workspace.rs:169— codex-rs/memories/write/src/workspace.rs:169-177 | codex-rs/windows-sandbox-rs/src/identity.rs:160-171 | codex-rs/windows-sandbox-rs/src/setup_error.rs:163-170 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) codex-rs/core/src/codex_thread.rs:376— codex-rs/core/src/codex_thread.rs:376-383 | codex-rs/core/src/codex_thread.rs:387-394 | codex-rs/core/src/codex_thread.rs:791-798 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) codex-rs/websocket-client/src/lib.rs:339— codex-rs/websocket-client/src/lib.rs:339-346 | codex-rs/websocket-client/src/lib.rs:363-370 | codex-rs/websocket-client/src/lib.rs:375-382 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 16+ corresponding lines) · ×3
Edited copies of one member (3 members, 16+ corresponding lines) codex-rs/core/src/tools/lifecycle.rs:78— codex-rs/core/src/tools/lifecycle.rs:78-93 | codex-rs/core/src/tools/lifecycle.rs:102-117 | codex-rs/core/src/tools/lifecycle.rs:156-171 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 16+ corresponding lines) codex-rs/tui/src/app_server_session.rs:2900— codex-rs/tui/src/app_server_session.rs:2900-2916 | codex-rs/tui/src/app_server_session.rs:2922-2937 | codex-rs/tui/src/app_server_session.rs:2944-2960 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 16+ corresponding lines) sdk/python/src/openai_codex/api.py:449— sdk/python/src/openai_codex/api.py:449-464 | sdk/python/src/openai_codex/api.py:597-616 | sdk/python/src/openai_codex/api.py:703-722 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 7+ corresponding lines) · ×3
Edited copies of one member (3 members, 7+ corresponding lines) codex-rs/app-server-protocol/src/export.rs:337— codex-rs/app-server-protocol/src/export.rs:337-348 | codex-rs/app-server-protocol/src/export.rs:407-413 | codex-rs/app-server-protocol/src/export.rs:1607-1615 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) codex-rs/ext/memories/src/local.rs:86— codex-rs/ext/memories/src/local.rs:86-92 | codex-rs/sandboxing/src/sandbox_integrity/contents.rs:89-95 | codex-rs/utils/path-utils/src/lib.rs:20-26 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) codex-rs/app-server-client/src/path.rs:50— codex-rs/app-server-client/src/path.rs:50-58 | codex-rs/core-plugins/src/marketplace_add/source.rs:140-147 | codex-rs/utils/absolute-path/src/lib.rs:179-185 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 5+ corresponding lines) · ×3
Edited copies of one member (3 members, 5+ corresponding lines) codex-rs/tui/src/bottom_pane/file_search_popup.rs:86— codex-rs/tui/src/bottom_pane/file_search_popup.rs:86-90 | codex-rs/tui/src/bottom_pane/mentions_v2/popup.rs:75-79 | codex-rs/tui/src/bottom_pane/skill_popup.rs:127-131 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 5+ corresponding lines) codex-rs/tui/src/bottom_pane/file_search_popup.rs:93— codex-rs/tui/src/bottom_pane/file_search_popup.rs:93-97 | codex-rs/tui/src/bottom_pane/mentions_v2/popup.rs:81-85 | codex-rs/tui/src/bottom_pane/skill_popup.rs:133-137 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 5+ corresponding lines) codex-rs/external-agent-migration/src/memory.rs:151— codex-rs/external-agent-migration/src/memory.rs:151-155 | codex-rs/external-agent-migration/src/utils.rs:90-94 | codex-rs/thread-store/src/local/rollout_migration.rs:1377-1381 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/cli/src/doctor/output/detail.rs:235` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/shell-command/src/parse_command.rs:2592` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (31 lines × 2) codex-rs/tui/src/app.rs:410— codex-rs/tui/src/app.rs:410-440 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/app.rs:410` 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.
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:345-372 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/skills/src/mentions.rs:110` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (28 lines × 2) codex-rs/tui/src/app/startup.rs:783— codex-rs/tui/src/app/startup.rs:783-810 | codex-rs/tui/src/app/startup.rs:895-922 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/app/startup.rs:783` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (28 lines × 2) codex-rs/tui/src/bottom_pane/multi_select_picker.rs:253— codex-rs/tui/src/bottom_pane/multi_select_picker.rs:253-280 | codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:115-142 — 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 99 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/multi_select_picker.rs:253` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (26 lines × 2) codex-rs/ext/goal/src/runtime.rs:560— codex-rs/ext/goal/src/runtime.rs:560-585 | codex-rs/ext/goal/src/runtime.rs:622-647 — both copies are in the same file, so extract the 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 `codex-rs/ext/goal/src/runtime.rs:560` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (26 lines × 2) codex-rs/rollout/src/list.rs:571— codex-rs/rollout/src/list.rs:571-596 | codex-rs/rollout/src/list.rs:695-720 — both copies are in the same file, so extract the 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 `codex-rs/rollout/src/list.rs:571` 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.
Duplicated block (26 lines × 2) codex-rs/windows-sandbox-rs/src/setup.rs:868— codex-rs/windows-sandbox-rs/src/setup.rs:868-893 | codex-rs/windows-sandbox-rs/src/winutil.rs:87-112 — 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 `codex-rs/windows-sandbox-rs/src/setup.rs:868` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (24 lines × 2) codex-rs/network-proxy/src/http_proxy.rs:250— codex-rs/network-proxy/src/http_proxy.rs:250-273 | codex-rs/network-proxy/src/http_proxy.rs:791-814 — both copies are in the same file, so extract the 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 `codex-rs/network-proxy/src/http_proxy.rs:250` 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.
Duplicated block (24 lines × 2) codex-rs/rollout-trace/src/protocol_event.rs:176— codex-rs/rollout-trace/src/protocol_event.rs:176-199 | codex-rs/rollout-trace/src/protocol_event.rs:238-261 — both copies are in the same file, so extract the 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 `codex-rs/rollout-trace/src/protocol_event.rs:176` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `event` to `&'a ExecCommandBeginEvent` in one and `&'a ExecCommandEndEvent` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (24 lines × 2) codex-rs/model-provider/src/models_endpoint.rs:436— codex-rs/model-provider/src/models_endpoint.rs:436-459 | codex-rs/model-provider/src/models_endpoint.rs:462-485 — both copies are in the same file, so extract the 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 `codex-rs/model-provider/src/models_endpoint.rs:436` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (23 lines × 2) codex-rs/app-server-client/src/lib.rs:268— codex-rs/app-server-client/src/lib.rs:268-290 | codex-rs/app-server-client/src/remote.rs:99-121 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (23 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-78 | codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resources.rs:56-78 — 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 `codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resource_templates.rs:56` 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.
Duplicated block (23 lines × 2) codex-rs/rollout/src/recorder.rs:725— codex-rs/rollout/src/recorder.rs:725-747 | codex-rs/rollout/src/recorder.rs:768-790 — both copies are in the same file, so extract the 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 `codex-rs/rollout/src/recorder.rs:725` 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.
Duplicated block (14–16 lines × 2) codex-rs/app-server-transport/src/transport/remote_control/mod.rs:527— codex-rs/app-server-transport/src/transport/remote_control/mod.rs:527-540 | codex-rs/app-server-transport/src/transport/remote_control/mod.rs:754-769 — both copies are in the same file, so extract the 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 `codex-rs/app-server-transport/src/transport/remote_control/mod.rs:527` 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.
Duplicated block (14–16 lines × 2) codex-rs/core/src/mcp_tool_call.rs:257— codex-rs/core/src/mcp_tool_call.rs:257-270 | codex-rs/core/src/mcp_tool_call.rs:389-404 — both copies are in the same file, so extract the 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 `codex-rs/core/src/mcp_tool_call.rs:389` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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 (14–16 lines × 2) codex-rs/exec/src/lib.rs:1030— codex-rs/exec/src/lib.rs:1030-1043 | codex-rs/exec/src/lib.rs:1058-1073 — both copies are in the same file, so extract the 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 `codex-rs/exec/src/lib.rs:1030` 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. 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/exec/src/lib.rs:1029` calls `chain`, `iter`, `cloned` and `codex-rs/exec/src/lib.rs:1057` 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 (13 lines × 3) codex-rs/rollout/src/list.rs:1480— codex-rs/rollout/src/list.rs:1480-1492 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/rollout/src/list.rs:1480` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 3) codex-rs/core/src/client.rs:3177— codex-rs/core/src/client.rs:3177-3189 | codex-rs/core/src/client.rs:3200-3212 | codex-rs/core/src/client.rs:3233-3245 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core/src/client.rs:3177` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
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:229-241 | codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs:375-387 — before extracting anything, compare `codex-rs/rmcp-client/src/bin/rmcp_test_server.rs` and `codex-rs/rmcp-client/src/bin/test_stdio_server.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:36` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server-protocol/src/protocol/item_builders.rs:97` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `payload` to `&ExecCommandBeginEvent` in one and `&ExecCommandEndEvent` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (12–13 lines × 2) codex-rs/core-plugins/src/manifest.rs:360— codex-rs/core-plugins/src/manifest.rs:360-372 | codex-rs/core-plugins/src/remote.rs:2104-2115 — 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 `codex-rs/core-plugins/src/manifest.rs:360` 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.
Duplicated block (12–13 lines × 2) codex-rs/tui/src/bottom_pane/multi_select_picker.rs:594— codex-rs/tui/src/bottom_pane/multi_select_picker.rs:594-606 | codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:310-321 — 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 99 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/multi_select_picker.rs:594` 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.
Duplicated block (11 lines × 3) codex-rs/analytics/src/reducer.rs:1802— codex-rs/analytics/src/reducer.rs:1802-1812 | codex-rs/analytics/src/reducer.rs:1836-1846 | codex-rs/analytics/src/reducer.rs:1876-1886 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/analytics/src/reducer.rs:1802` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/analytics/src/reducer.rs:1848` calls `to_string` and `codex-rs/analytics/src/reducer.rs:1813` 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 (11 lines × 3) codex-rs/app-server-transport/src/transport/remote_control/mod.rs:829— codex-rs/app-server-transport/src/transport/remote_control/mod.rs:829-839 | codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:341-351 | codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:374-384 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server-transport/src/transport/remote_control/mod.rs:829` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
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:290-300 — 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 4 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/experimental_features_view.rs:390` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
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 91 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (10 lines × 3) codex-rs/core-plugins/src/command_migration/render.rs:48— codex-rs/core-plugins/src/command_migration/render.rs:48-57 | codex-rs/external-agent-migration/src/rewrite.rs:92-101 | codex-rs/external-agent-migration/src/rewrite.rs:131-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 (10 lines × 3) codex-rs/app-server/src/request_processors/catalog_processor.rs:336— codex-rs/app-server/src/request_processors/catalog_processor.rs:336-346 | codex-rs/app-server/src/request_processors/catalog_processor.rs:516-526 | codex-rs/app-server/src/request_processors/mcp_processor.rs:889-898 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server/src/request_processors/catalog_processor.rs:336` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 4) codex-rs/app-server-daemon/src/backend/pid.rs:542— codex-rs/app-server-daemon/src/backend/pid.rs:542-548 | codex-rs/app-server-daemon/src/backend/pid.rs:557-563 | codex-rs/app-server-daemon/src/backend/pid.rs:572-578 | codex-rs/app-server-daemon/src/backend/pid.rs:587-593 — 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. 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 (7 lines × 4) codex-rs/core-plugins/src/remote.rs:2367— codex-rs/core-plugins/src/remote.rs:2367-2373 | codex-rs/core-plugins/src/remote.rs:2385-2391 | codex-rs/core-plugins/src/remote.rs:2418-2424 | codex-rs/core-plugins/src/remote/share.rs:390-396 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core-plugins/src/remote.rs:2367` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (7 lines × 4) codex-rs/tui/src/bottom_pane/approval_overlay.rs:732— codex-rs/tui/src/bottom_pane/approval_overlay.rs:732-738 | codex-rs/tui/src/bottom_pane/approval_overlay.rs:776-782 | codex-rs/tui/src/bottom_pane/approval_overlay.rs:805-811 | codex-rs/tui/src/bottom_pane/user_verification.rs:281-287 — 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 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `&ApprovalRequest` in one and `&UserVerificationRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (6 lines × 3) codex-rs/codex-mcp/src/tools.rs:276— codex-rs/codex-mcp/src/tools.rs:276-281 | 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:755— codex-rs/core/src/agent/control.rs:755-760 | 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:919— codex-rs/network-proxy/src/http_proxy.rs:919-924 | codex-rs/network-proxy/src/socks5.rs:309-314 | codex-rs/network-proxy/src/socks5.rs:803-808 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/network-proxy/src/http_proxy.rs:919` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/network-proxy/src/http_proxy.rs:926` calls `method` and `codex-rs/network-proxy/src/socks5.rs:316` 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.
R4 · Test Coverage· No test reaches this file · ×3
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.
No test reaches this file codex-rs/code-mode-runtime/src/runtime/content.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>.
McpConnectionSet::new (cyclomatic 96) codex-rs/codex-mcp/src/connection_manager.rs:416— McpConnectionSet::new 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.
McpConnectionSet::capture_binding_with_metadata (cyclomatic 43) codex-rs/codex-mcp/src/connection_manager/tool_catalog.rs:293— 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.
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:538— 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.
RuntimeKeymap::resolve (cyclomatic 55) codex-rs/tui/src/keymap.rs:707— RuntimeKeymap::resolve has cyclomatic complexity 55 (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:2173— 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.
codex_connectors::merge_directory_app (cyclomatic 54) codex-rs/connectors/src/lib.rs:307— 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.
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.
codex_code_mode_runtime::cell_actor::run_cell (cyclomatic 46) codex-rs/code-mode-runtime/src/cell_actor/mod.rs:113— codex_code_mode_runtime::cell_actor::run_cell 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_code_mode_runtime::runtime::run_runtime (cyclomatic 16) codex-rs/code-mode-runtime/src/runtime/mod.rs:182— 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_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.
PluginRequestProcessor::plugin_list_response (cyclomatic 41) codex-rs/app-server/src/request_processors/plugins.rs:560— PluginRequestProcessor::plugin_list_response has cyclomatic complexity 41 (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.
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:164— 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.
codex_app_server_client::cloud_backend::run_worker_with_prepared (cyclomatic 39) codex-rs/app-server-client/src/cloud_backend/mod.rs:312— codex_app_server_client::cloud_backend::run_worker_with_prepared has cyclomatic complexity 39 (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_client::cloud_backend::advance_prepared_resume (cyclomatic 21) codex-rs/app-server-client/src/cloud_backend/mod.rs:556— codex_app_server_client::cloud_backend::advance_prepared_resume 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.
PidBackend::start_inner (cyclomatic 39) codex-rs/app-server-daemon/src/backend/pid_start.rs:22— PidBackend::start_inner 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.
PidBackend::stop_with_grace (cyclomatic 18) codex-rs/app-server-daemon/src/backend/pid.rs:172— 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.
BedrockState::render (cyclomatic 37) codex-rs/tui/src/onboarding/bedrock.rs:350— BedrockState::render has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent 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::render_methods (cyclomatic 18) codex-rs/tui/src/onboarding/bedrock.rs:564— 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.
BottomPane::renderable_for_views (cyclomatic 36) codex-rs/tui/src/bottom_pane/mod.rs:2466— 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:898— 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.
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:1028— 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.
EventProcessorWithJsonOutput::map_item_with_id (cyclomatic 35) codex-rs/exec/src/event_processor_with_jsonl_output.rs:144— 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:424— 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.
LocalThreadStore::migrate_rollout_path (cyclomatic 34) codex-rs/thread-store/src/local/rollout_migration.rs:419— 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::migrate_one_rollout (cyclomatic 18) codex-rs/thread-store/src/local/rollout_migration.rs:650— 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.
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.
ExternalAgentConfigService::import (cyclomatic 31) codex-rs/external-agent-migration/src/service.rs:209— 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.
EventProcessorWithHumanOutput::process_server_notification (cyclomatic 30) codex-rs/exec/src/event_processor_with_human_output.rs:230— 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:101— 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.
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.
ConfigDocument::apply (cyclomatic 28) codex-rs/core/src/config/edit.rs:219— 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:504— 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.
codex_state::runtime::threads::push_thread_filters_with_preview (cyclomatic 28) codex-rs/state/src/runtime/threads.rs:1563— codex_state::runtime::threads::push_thread_filters_with_preview 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_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.
ThreadEventStore::snapshot (cyclomatic 26) codex-rs/tui/src/app/thread_events.rs:413— ThreadEventStore::snapshot 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.
ThreadEventStore::push_notification_inner (cyclomatic 22) codex-rs/tui/src/app/thread_events.rs:245— ThreadEventStore::push_notification_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.
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.
AppLinkView::activate_selected_action (cyclomatic 22) codex-rs/tui/src/bottom_pane/app_link_view.rs:422— 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:490— 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.
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.
TranscriptOverlay::handle_key (cyclomatic 21) codex-rs/tui/src/pager_overlay/transcript.rs:445— 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:183— 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.
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.
ReviewRequest::review (cyclomatic 20) codex-rs/ext/guardian-reviewer/src/review.rs:97— ReviewRequest::review 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.
ReviewRequest::decide (cyclomatic 17) codex-rs/ext/guardian-reviewer/src/routing.rs:70— 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.
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.
Client::add_user_message (cyclomatic 19) codex-rs/cloud-client/src/turns.rs:127— Client::add_user_message 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_login::auth::manager::load_auth (cyclomatic 19) codex-rs/login/src/auth/manager.rs:1606— codex_login::auth::manager::load_auth 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_login::server::process_request (cyclomatic 18) codex-rs/login/src/server.rs:349— 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.
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.
Daemon::try_restart_if_running (cyclomatic 16) codex-rs/app-server-daemon/src/lib.rs:559— 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:885— 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.
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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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.
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:538— 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.
ExecServerClient::spawn_rpc_reader (cognitive 69) codex-rs/exec-server/src/client_recovery.rs:655— 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:1142— 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.
FileSystemSandboxPolicy::to_legacy_sandbox_policy_with_projection (cognitive 59) codex-rs/protocol/src/permissions.rs:1888— FileSystemSandboxPolicy::to_legacy_sandbox_policy_with_projection has cognitive complexity 59 (threshold 15). Drivers by points: if/else 17 (42 pts), match/switch 5 (13 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 34). 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::writable_roots (cognitive 19) codex-rs/protocol/src/permissions.rs:1575— FileSystemSandboxPolicy::writable_roots has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 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.
McpManager::runtime_config_with_context (cognitive 58) codex-rs/core/src/mcp.rs:310— 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:255— 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.
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.
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:164— 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.
BedrockState::render (cognitive 47) codex-rs/tui/src/onboarding/bedrock.rs:350— BedrockState::render has cognitive complexity 47 (threshold 15). Drivers by points: if/else 22 (35 pts), boolean chains 6, match/switch 2 (4 pts), 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.
BedrockState::render_methods (cognitive 33) codex-rs/tui/src/onboarding/bedrock.rs:564— 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.
WsStream::new (cognitive 44) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:88— 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:110— 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.
RolloutRecorder::list_threads_with_db_fallback (cognitive 44) codex-rs/rollout/src/recorder.rs:545— RolloutRecorder::list_threads_with_db_fallback has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (31 pts), loops 3 (7 pts), boolean chains 4, match/switch 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.
RolloutRecorder::find_latest_thread_path (cognitive 18) codex-rs/rollout/src/recorder.rs:832— 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.
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.
StatusHistoryCell::content_lines (cognitive 39) codex-rs/tui/src/status/card.rs:757— StatusHistoryCell::content_lines has cognitive complexity 39 (threshold 15). Drivers by points: if/else 31 (33 pts), match/switch 3 (4 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:514— 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.
ConfigDocument::set_skill_config (cognitive 38) codex-rs/core/src/config/edit.rs:504— 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:219— 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.
TopLevelToolsState::append_exec_updates (cognitive 37) codex-rs/core/src/context/world_state/top_level_tools.rs:359— TopLevelToolsState::append_exec_updates has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (30 pts), loops 1 (5 pts), boolean chains 2 (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.
TopLevelToolsState::render_declaration_updates (cognitive 31) codex-rs/core/src/context/world_state/top_level_tools.rs:217— TopLevelToolsState::render_declaration_updates has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 4, 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.
ConnectionDriver::complete_request (cognitive 36) codex-rs/code-mode/src/remote_session/connection/driver/responses.rs:150— 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.
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.
codex_guardian_v2::async_scorer::approval::cached_evidence (cognitive 34) codex-rs/ext/guardian-v2/src/async_scorer/approval.rs:202— codex_guardian_v2::async_scorer::approval::cached_evidence has cognitive complexity 34 (threshold 15). Drivers by points: if/else 20 (28 pts), boolean chains 5, 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_guardian_v2::async_scorer::decisions::request_body (cognitive 18) codex-rs/ext/guardian-v2/src/async_scorer/decisions.rs:331— 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.
AppsRequestProcessor::apps_list_response (cognitive 31) codex-rs/app-server/src/request_processors/apps_processor.rs:178— AppsRequestProcessor::apps_list_response has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 8, match/switch 5 (8 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:36— 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.
codex_cloud_tasks_client::http::api::extract_assistant_messages_from_body (cognitive 31) codex-rs/cloud-tasks-client/src/http.rs:595— 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:697— 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.
ReviewRequest::review (cognitive 31) codex-rs/ext/guardian-reviewer/src/review.rs:97— ReviewRequest::review has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18 (25 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:70— 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.
ShellSnapshotFile::restore_credentials (cognitive 30) codex-rs/core/src/shell_snapshot.rs:369— 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:468— 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.
RollbackPlanner::apply_rollback (cognitive 29) codex-rs/thread-store/src/local/rollout_migration/rollback_plan.rs:447— 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:139— 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.
TextLayout::copy_block_ranges (cognitive 28) codex-rs/tui/src/transcript_view/text.rs:121— 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.
TextLayout::table_cell_position (cognitive 19) codex-rs/tui/src/transcript_view/text.rs:429— TextLayout::table_cell_position has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 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.
EventProcessorWithJsonOutput::collect_thread_events (cognitive 27) codex-rs/exec/src/event_processor_with_jsonl_output.rs:424— 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:144— 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.
OnboardingScreen::render_ref (cognitive 27) codex-rs/tui/src/onboarding/onboarding_screen.rs:451— 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 21) codex-rs/tui/src/onboarding/onboarding_screen.rs:372— OnboardingScreen::handle_key_event has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (17 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.
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.
SideCompanion::apply_notification (cognitive 25) codex-rs/tui/src/app/side_companion.rs:73— SideCompanion::apply_notification has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 5, loops 1 (3 pts), match/switch 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.
SideCompanion::finish_item (cognitive 18) codex-rs/tui/src/app/side_companion.rs:192— SideCompanion::finish_item has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, 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.
LocalProcess::start_process (cognitive 24) codex-rs/exec-server/src/local_process.rs:290— LocalProcess::start_process has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 5, match/switch 4 (5 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.
LocalProcess::exec_read (cognitive 20) codex-rs/exec-server/src/local_process.rs:576— 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.
ConnectionPool::lease (cognitive 24) codex-rs/ext/guardian-v2/src/async_scorer/sampler/connection_pool.rs:227— ConnectionPool::lease has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 3 (6 pts), loops 2 (4 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.
ConnectionPool::start_refill (cognitive 19) codex-rs/ext/guardian-v2/src/async_scorer/sampler/connection_pool.rs:162— ConnectionPool::start_refill has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 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.
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.
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 19) codex-rs/prompts/src/permissions_instructions.rs:311— codex_prompts::permissions_instructions::approval_text has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 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.
StateRuntime::start_periodic_logs_maintenance (cognitive 22) codex-rs/state/src/runtime/logs_maintenance.rs:15— StateRuntime::start_periodic_logs_maintenance has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (3 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.
StateRuntime::prune_logs_after_insert (cognitive 21) codex-rs/state/src/runtime/logs.rs:57— 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.
ThreadEventStore::snapshot (cognitive 22) codex-rs/tui/src/app/thread_events.rs:413— ThreadEventStore::snapshot has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, match/switch 5 (6 pts), 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:245— ThreadEventStore::push_notification_inner has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, 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.
EventProcessorWithHumanOutput::process_server_notification (cognitive 21) codex-rs/exec/src/event_processor_with_human_output.rs:230— 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:101— 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.
LocalAgentMessageBoard::post_inner (cognitive 21) codex-rs/message-board/src/local.rs:206— 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.
LocalAgentMessageBoard::search_posts (cognitive 16) codex-rs/message-board/src/local/queries.rs:417— LocalAgentMessageBoard::search_posts has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (15 pts), 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.
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.
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.
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.
codex_rollout_trace::reducer::replay_bundle (cognitive 17) codex-rs/rollout-trace/src/reducer/mod.rs:53— codex_rollout_trace::reducer::replay_bundle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4, boolean chains 3 (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· Edited copy of a member (73 corresponding lines) · ×2
Edited copy of a member (73 corresponding lines) codex-rs/app-server-transport/src/transport/remote_control/enroll.rs:56— codex-rs/app-server-transport/src/transport/remote_control/enroll.rs:56-155 | codex-rs/app-server-transport/src/transport/remote_control/enroll.rs:161-233 — These two members are one piece of code written twice and then edited apart: 73 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.
Edited copy of a member (73 corresponding lines) codex-rs/tui/src/tui.rs:1428— codex-rs/tui/src/tui.rs:1428-1518 | codex-rs/tui/src/tui.rs:1589-1661 — These two members are one piece of code written twice and then edited apart: 73 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 (50 corresponding lines) · ×2
Edited copy of a member (50 corresponding lines) codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resource_templates.rs:55— codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resource_templates.rs:55-108 | codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resources.rs:55-104 — These two members are one piece of code written twice and then edited apart: 50 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.
Edited copy of a member (50 corresponding lines) codex-rs/state/src/runtime/goals.rs:164— codex-rs/state/src/runtime/goals.rs:164-213 | codex-rs/state/src/runtime/goals.rs:221-271 — These two members are one piece of code written twice and then edited apart: 50 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 (38 corresponding lines) · ×2
Edited copy of a member (38 corresponding lines) codex-rs/core-plugins/src/marketplace_upgrade/git.rs:277— codex-rs/core-plugins/src/marketplace_upgrade/git.rs:277-314 | codex-rs/core-plugins/src/startup_sync.rs:687-735 — These two members are one piece of code written twice and then edited apart: 38 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.
Edited copy of a member (38 corresponding lines) codex-rs/rmcp-client/src/oauth/ema_identity.rs:85— codex-rs/rmcp-client/src/oauth/ema_identity.rs:85-125 | codex-rs/rmcp-client/src/oauth/ema_identity.rs:130-167 — These two members are one piece of code written twice and then edited apart: 38 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 copies of one member (3 members, 32+ corresponding lines) · ×2
Edited copies of one member (3 members, 32+ corresponding lines) codex-rs/tui/src/external_agent_config_migration/mod.rs:87— codex-rs/tui/src/external_agent_config_migration/mod.rs:87-125 | codex-rs/tui/src/external_agent_config_migration/source.rs:52-83 | codex-rs/tui/src/model_migration.rs:145-176 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 32 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 32+ corresponding lines) codex-rs/tui/src/chatwidget/plugin_catalog.rs:571— codex-rs/tui/src/chatwidget/plugin_catalog.rs:571-614 | codex-rs/tui/src/chatwidget/plugin_catalog.rs:620-668 | codex-rs/tui/src/chatwidget/plugin_catalog.rs:674-705 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 32 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (44 corresponding lines) · ×2
Edited copy of a member (44 corresponding lines) codex-rs/tui/src/bottom_pane/multi_select_picker.rs:502— codex-rs/tui/src/bottom_pane/multi_select_picker.rs:502-557 | codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:202-245 — These two members are one piece of code written twice and then edited apart: 44 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.
Edited copy of a member (44 corresponding lines) codex-rs/chatgpt/src/chatgpt_client.rs:113— codex-rs/chatgpt/src/chatgpt_client.rs:113-157 | codex-rs/chatgpt/src/chatgpt_client.rs:174-217 — These two members are one piece of code written twice and then edited apart: 44 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 (34 corresponding lines) · ×2
Edited copy of a member (34 corresponding lines) codex-rs/core/src/session/mod.rs:3467— codex-rs/core/src/session/mod.rs:3467-3503 | codex-rs/core/src/session/mod.rs:3685-3718 — These two members are one piece of code written twice and then edited apart: 34 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.
Edited copy of a member (34 corresponding lines) codex-rs/sandboxing/src/landlock.rs:33— codex-rs/sandboxing/src/landlock.rs:33-67 | codex-rs/sandboxing/src/landlock.rs:78-111 — These two members are one piece of code written twice and then edited apart: 34 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 (32 corresponding lines) · ×2
Edited copy of a member (32 corresponding lines) codex-rs/windows-sandbox-rs/src/dpapi.rs:20— codex-rs/windows-sandbox-rs/src/dpapi.rs:20-51 | codex-rs/windows-sandbox-rs/src/dpapi.rs:54-85 — These two members are one piece of code written twice and then edited apart: 32 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.
Edited copy of a member (32 corresponding lines) codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:103— codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:103-135 | codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs:328-359 — These two members are one piece of code written twice and then edited apart: 32 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 copies of one member (4 members, 14+ corresponding lines) · ×2
Edited copies of one member (4 members, 14+ corresponding lines) codex-rs/hooks/src/events/compact.rs:125— codex-rs/hooks/src/events/compact.rs:125-138 | codex-rs/hooks/src/events/compact.rs:206-219 | codex-rs/hooks/src/events/permission_request.rs:175-190 | codex-rs/hooks/src/events/pre_tool_use.rs:181-197 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 14+ corresponding lines) codex-rs/app-server/src/request_processors/turn_processor.rs:1407— codex-rs/app-server/src/request_processors/turn_processor.rs:1407-1428 | codex-rs/app-server/src/request_processors/turn_processor.rs:1434-1456 | codex-rs/app-server/src/request_processors/turn_processor.rs:1462-1481 | codex-rs/app-server/src/request_processors/turn_processor.rs:1487-1500 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 18+ corresponding lines) · ×2
Edited copies of one member (3 members, 18+ corresponding lines) codex-rs/exec-server/src/local_file_system.rs:1208— codex-rs/exec-server/src/local_file_system.rs:1208-1225 | codex-rs/external-agent-migration/src/hooks_common.rs:253-273 | codex-rs/external-agent-migration/src/utils.rs:49-81 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 18+ corresponding lines) codex-rs/app-server/src/request_processors/thread_processor.rs:726— codex-rs/app-server/src/request_processors/thread_processor.rs:726-744 | codex-rs/app-server/src/request_processors/thread_processor.rs:768-785 | codex-rs/app-server/src/request_processors/thread_processor.rs:866-887 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 21+ corresponding lines) · ×2
Edited copies of one member (3 members, 21+ corresponding lines) codex-rs/app-server-protocol/src/export.rs:1179— codex-rs/app-server-protocol/src/export.rs:1179-1199 | codex-rs/app-server-protocol/src/export.rs:1291-1313 | codex-rs/app-server-protocol/src/export.rs:1625-1647 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 21+ corresponding lines) codex-rs/tui/src/app/background_requests.rs:165— codex-rs/tui/src/app/background_requests.rs:165-188 | codex-rs/tui/src/app/background_requests.rs:196-218 | codex-rs/tui/src/app/background_requests.rs:224-244 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 15+ corresponding lines) · ×2
Edited copies of one member (4 members, 15+ corresponding lines) codex-rs/exec-server/src/remote_file_system.rs:145— codex-rs/exec-server/src/remote_file_system.rs:145-159 | codex-rs/exec-server/src/remote_file_system.rs:166-180 | codex-rs/exec-server/src/remote_file_system.rs:296-311 | codex-rs/exec-server/src/remote_file_system.rs:319-333 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 15+ corresponding lines) codex-rs/tui/src/history_cell/base.rs:193— codex-rs/tui/src/history_cell/base.rs:193-207 | codex-rs/tui/src/history_cell/base.rs:209-223 | codex-rs/tui/src/history_cell/base.rs:225-239 | codex-rs/tui/src/history_cell/base.rs:241-255 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 21+ corresponding lines) · ×2
Edited copies of one member (6 members, 21+ corresponding lines) sdk/python/src/openai_codex/api.py:153— sdk/python/src/openai_codex/api.py:153-173 | sdk/python/src/openai_codex/api.py:222-244 | sdk/python/src/openai_codex/api.py:263-286 | sdk/python/src/openai_codex/api.py:411-432 | sdk/python/src/openai_codex/api.py:482-505 | sdk/python/src/openai_codex/api.py:524-548 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 21 lines, 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 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. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
Edited copies of one member (6 members, 21+ corresponding lines) codex-rs/app-server-client/src/lib.rs:546— codex-rs/app-server-client/src/lib.rs:546-566 | codex-rs/app-server-client/src/lib.rs:641-662 | codex-rs/app-server-client/src/lib.rs:669-690 | codex-rs/app-server-client/src/remote.rs:555-575 | codex-rs/app-server-client/src/remote.rs:638-659 | codex-rs/app-server-client/src/remote.rs:665-686 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 21 lines, 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 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. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 14+ corresponding lines) · ×2
Edited copies of one member (5 members, 14+ corresponding lines) codex-rs/otel/src/events/session_telemetry.rs:218— codex-rs/otel/src/events/session_telemetry.rs:218-231 | codex-rs/otel/src/events/session_telemetry.rs:233-246 | codex-rs/otel/src/events/session_telemetry.rs:256-269 | codex-rs/otel/src/events/session_telemetry.rs:271-284 | codex-rs/otel/src/events/session_telemetry.rs:353-366 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
Edited copies of one member (5 members, 14+ corresponding lines) codex-rs/tui/src/chatwidget/connectors.rs:215— codex-rs/tui/src/chatwidget/connectors.rs:215-228 | codex-rs/tui/src/chatwidget/plugin_catalog.rs:458-471 | codex-rs/tui/src/chatwidget/plugin_catalog.rs:523-536 | codex-rs/tui/src/chatwidget/plugin_catalog.rs:541-554 | codex-rs/tui/src/chatwidget/plugin_catalog.rs:556-569 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 14+ corresponding lines) · ×2
Edited copies of one member (3 members, 14+ corresponding lines) codex-rs/keyring-store/src/lib.rs:78— codex-rs/keyring-store/src/lib.rs:78-95 | codex-rs/keyring-store/src/lib.rs:97-110 | codex-rs/keyring-store/src/lib.rs:112-129 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 14+ corresponding lines) codex-rs/tui/src/bottom_pane/request_user_input/render.rs:48— codex-rs/tui/src/bottom_pane/request_user_input/render.rs:48-61 | codex-rs/tui/src/render/line_utils.rs:5-18 | codex-rs/tui/src/render/line_utils.rs:21-34 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 6+ corresponding lines) · ×2
Edited copies of one member (3 members, 6+ corresponding lines) codex-rs/core-plugins/src/startup_sync.rs:1026— codex-rs/core-plugins/src/startup_sync.rs:1026-1031 | codex-rs/login/src/auth/manager.rs:1068-1073 | codex-rs/model-provider/src/amazon_bedrock/auth.rs:246-251 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 6+ corresponding lines) codex-rs/shell-command/src/command_safety/powershell_tree_sitter.rs:441— codex-rs/shell-command/src/command_safety/powershell_tree_sitter.rs:441-460 | codex-rs/tui/src/terminal_hyperlinks.rs:644-649 | codex-rs/tui/src/wrapping.rs:515-535 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
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.
Duplicated block (25 lines × 2) codex-rs/core/src/tools/network_approval.rs:1048— codex-rs/core/src/tools/network_approval.rs:1048-1072 | codex-rs/core/src/tools/network_approval.rs:1097-1121 — both copies are in the same file, so extract the 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 `codex-rs/core/src/tools/network_approval.rs:1048` 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.
Duplicated block (25 lines × 2) codex-rs/state/src/runtime/memories.rs:1339— codex-rs/state/src/runtime/memories.rs:1339-1363 | codex-rs/state/src/runtime/memories.rs:1380-1405 — both copies are in the same file, so extract the 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 `codex-rs/state/src/runtime/memories.rs:1339` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (20–21 lines × 2) codex-rs/tui/src/lib.rs:1736— codex-rs/tui/src/lib.rs:1736-1756 | codex-rs/tui/src/lib.rs:1840-1859 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/lib.rs:1736` 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. 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 (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.
Duplicated block (19–20 lines × 2) codex-rs/core-plugins/src/marketplace_upgrade/git.rs:278— codex-rs/core-plugins/src/marketplace_upgrade/git.rs:278-296 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core-plugins/src/marketplace_upgrade/git.rs:278` 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.
Duplicated block (19–20 lines × 2) codex-rs/hooks/src/events/stop.rs:281— codex-rs/hooks/src/events/stop.rs:281-299 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/hooks/src/events/stop.rs:281` 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. 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–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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/external-agent-migration/src/hooks_cla.rs:179` 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.
Duplicated block (18–19 lines × 2) codex-rs/tui/src/bottom_pane/textarea.rs:1522— codex-rs/tui/src/bottom_pane/textarea.rs:1522-1540 | codex-rs/tui/src/bottom_pane/textarea.rs:1593-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/textarea.rs:1522` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (17–18 lines × 2) codex-rs/codex-api/src/files.rs:177— codex-rs/codex-api/src/files.rs:177-193 | codex-rs/codex-api/src/files.rs:383-400 — both copies are in the same file, so extract the 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 `codex-rs/codex-api/src/files.rs:177` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/codex-api/src/files.rs:401` calls `clone` and `codex-rs/codex-api/src/files.rs:194` 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–18 lines × 2) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:720— codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:720-736 | 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 6 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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:720` 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.
Duplicated block (17 lines × 3) codex-rs/analytics/src/events.rs:1546— codex-rs/analytics/src/events.rs:1546-1562 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/chatwidget/plugin_catalog.rs:591` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/codex-experimental-api-macros/src/lib.rs:50` 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. 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/external-agent-migration/src/sessions/records_cla.rs:184` 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. 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 (16 lines × 3) codex-rs/code-mode-runtime/src/cell_actor/mod.rs:160— codex-rs/code-mode-runtime/src/cell_actor/mod.rs:160-175 | codex-rs/code-mode-runtime/src/cell_actor/mod.rs:263-278 | codex-rs/code-mode-runtime/src/cell_actor/mod.rs:392-407 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/code-mode-runtime/src/cell_actor/mod.rs:160` 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.
Duplicated block (16 lines × 3) codex-rs/rollout/src/list.rs:570— codex-rs/rollout/src/list.rs:570-585 | codex-rs/rollout/src/list.rs:630-645 | codex-rs/rollout/src/list.rs:694-709 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/rollout/src/list.rs:570` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (15–16 lines × 2) codex-rs/thread-store/src/local/thread_history.rs:542— codex-rs/thread-store/src/local/thread_history.rs:542-556 | codex-rs/thread-store/src/local/thread_history/search.rs:342-357 — 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–16 lines × 2) codex-rs/tui/src/app/startup.rs:754— codex-rs/tui/src/app/startup.rs:754-769 | codex-rs/tui/src/app/startup.rs:859-873 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/app/startup.rs:754` 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.
Duplicated block (15 lines × 3) codex-rs/ext/memories/src/schema.rs:28— codex-rs/ext/memories/src/schema.rs:28-42 | codex-rs/ext/skills/src/tools/schema.rs:28-42 | codex-rs/ext/web-search/src/schema.rs:29-43 — before extracting anything, compare `codex-rs/ext/memories/src/schema.rs` and `codex-rs/ext/skills/src/tools/schema.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 40 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/ext/memories/src/schema.rs:28` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
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.
Duplicated block (11–13 lines × 2) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1748— codex-rs/app-server-protocol/src/protocol/thread_history.rs:1748-1758 | codex-rs/thread-store/src/local/rollout_migration/legacy_event.rs:56-68 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server-protocol/src/protocol/thread_history.rs:1748` 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. 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 (11–13 lines × 2) codex-rs/cloud-tasks/src/lib.rs:1719— codex-rs/cloud-tasks/src/lib.rs:1719-1729 | codex-rs/cloud-tasks/src/lib.rs:2056-2068 — both copies are in the same file, so extract the 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 `codex-rs/cloud-tasks/src/lib.rs:1719` 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/shell-command/src/parse_command.rs:2518` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/shell-command/src/parse_command.rs:2517` 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.
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:716-727 | codex-rs/app-server/src/request_processors/process_exec_processor.rs:436-446 — 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 8 separate duplicated blocks between them, totalling at least 140 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server/src/command_exec.rs:395` 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.
Duplicated block (11–12 lines × 3) codex-rs/tui/src/app/startup.rs:627— codex-rs/tui/src/app/startup.rs:627-637 | codex-rs/tui/src/app/startup.rs:780-791 | codex-rs/tui/src/app/startup.rs:892-903 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/app/startup.rs:627` 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. 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 (11 lines × 4) codex-rs/app-server/src/request_processors/apps_processor.rs:370— codex-rs/app-server/src/request_processors/apps_processor.rs:370-380 | codex-rs/app-server/src/request_processors/mcp_processor.rs:124-134 | codex-rs/app-server/src/request_processors/thread_processor.rs:1105-1115 | codex-rs/app-server/src/request_processors/turn_processor.rs:459-469 — 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 4 call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (11 lines × 4) codex-rs/tui/src/lib.rs:1665— codex-rs/tui/src/lib.rs:1665-1675 | codex-rs/tui/src/lib.rs:1706-1716 | codex-rs/tui/src/lib.rs:1769-1779 | codex-rs/tui/src/lib.rs:1810-1820 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/lib.rs:1665` 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.
Duplicated block (9–11 lines × 2) codex-rs/exec/src/lib.rs:1130— codex-rs/exec/src/lib.rs:1130-1140 | codex-rs/exec/src/lib.rs:1226-1234 — both copies are in the same file, so extract the 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 `codex-rs/exec/src/lib.rs:1130` 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. 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/external-agent-migration/src/hooks_cur.rs:129` 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. 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 (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 — 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 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/cwd_prompt.rs:341` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `area` to `Rect` in one and `ratatui::layout::Rect` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/tui/src/update_prompt.rs:269` calls `mark_underlined_hyperlink` and `codex-rs/tui/src/cwd_prompt.rs:351` 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 (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 91 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–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:50-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/external-agent-migration/src/hooks_common.rs:257` 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.
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:355-363 — 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 `codex-rs/message-board/src/in_memory.rs:414` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. 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 (5 lines × 3) codex-rs/network-proxy/src/runtime.rs:800— codex-rs/network-proxy/src/runtime.rs:800-804 | codex-rs/network-proxy/src/runtime.rs:823-827 | codex-rs/network-proxy/src/runtime.rs:1271-1275 — 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. 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/network-proxy/src/runtime.rs:1271` calls `credential_broker` and `codex-rs/network-proxy/src/runtime.rs:800` 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 (5 lines × 3) codex-rs/rollout-trace/src/reducer/code_cell.rs:727— codex-rs/rollout-trace/src/reducer/code_cell.rs:727-731 | codex-rs/rollout-trace/src/reducer/tool.rs:513-517 | codex-rs/rollout-trace/src/reducer/tool/agents.rs:778-782 — 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.
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.
Sync-over-async blocking codex-rs/tcp-tunnel/src/ssh.rs:81— `run_ssh_proxy` 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.
Low contrast colour pair in CSS (2.9:1) codex-rs/tui/assets/inline_visualization/visualize.css:1307— `.btn:not(.btn-primary, .viz-tile):is( [aria-pressed="true"], [aria-selected="true"], .is-selected )` sets color: var(
--color-text-inverse,
light-dark(rgb(255 255 255), rgb(13 13 13))
) on background-color: light-dark(rgb(51 156 255), rgb(51 156 255)) — 2.9:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
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:1218— `.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.
MessageProcessor::handle_initialized_client_request (cyclomatic 195) codex-rs/app-server/src/message_processor.rs:1138— MessageProcessor::handle_initialized_client_request has cyclomatic complexity 195 (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.
ConfigRequirementsWithSources::merge_unset_fields (cyclomatic 102) codex-rs/config/src/config_requirements.rs:1414— ConfigRequirementsWithSources::merge_unset_fields has cyclomatic complexity 102 (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.
ThreadManagerState::spawn_thread (cyclomatic 63) codex-rs/core/src/thread_manager.rs:2491— ThreadManagerState::spawn_thread has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MathMarkdown::new (cyclomatic 61) codex-rs/tui/src/markdown_render/math.rs:28— MathMarkdown::new has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
ToolOrchestrator::run (cyclomatic 51) codex-rs/core/src/tools/orchestrator.rs:125— ToolOrchestrator::run 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.
UnifiedExecRuntime::run (cyclomatic 51) codex-rs/core/src/tools/runtimes/unified_exec.rs:221— UnifiedExecRuntime::run has cyclomatic complexity 51 (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.
NetworkApprovalService::handle_inline_policy_request (cyclomatic 47) codex-rs/core/src/tools/network_approval.rs:743— NetworkApprovalService::handle_inline_policy_request 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.
StartupDraftPump::handle_event (cyclomatic 46) codex-rs/tui/src/startup_draft_input.rs:24— StartupDraftPump::handle_event 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.
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.
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.
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.
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.
CollectedContext::compose_prepared (cyclomatic 41) codex-rs/guardian-context/src/composition.rs:215— CollectedContext::compose_prepared 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.
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.
ShellSnapshotCache::prepare (cyclomatic 40) codex-rs/exec-server/src/shell_snapshot.rs:109— ShellSnapshotCache::prepare has cyclomatic complexity 40 (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.
StreamableHttpClientAdapter::post_message (cyclomatic 40) codex-rs/rmcp-client/src/http_client_adapter.rs:149— StreamableHttpClientAdapter::post_message 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.
ContextProfile::prepare_transcript_for_budgeting (cyclomatic 39) codex-rs/guardian-context/src/preparation/transcript.rs:135— ContextProfile::prepare_transcript_for_budgeting 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.
ToolRegistry::dispatch_any_with_state (cyclomatic 38) codex-rs/core/src/tools/registry.rs:760— ToolRegistry::dispatch_any_with_state 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.
Classification::run (cyclomatic 38) codex-rs/ext/guardian-v2/src/async_scorer/classification.rs:112— Classification::run 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.
FeedbackRequestProcessor::feedback_response (cyclomatic 37) codex-rs/app-server/src/request_processors/feedback_processor.rs:94— FeedbackRequestProcessor::feedback_response has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GuardianV2Extension::score_tool (cyclomatic 37) codex-rs/ext/guardian-v2/src/async_scorer/observation.rs:53— GuardianV2Extension::score_tool 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.
SamplingExecution::run (cyclomatic 37) codex-rs/ext/guardian-v2/src/async_scorer/sampler/execution.rs:187— SamplingExecution::run has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
ConfigRequirements::try_from (cyclomatic 36) codex-rs/config/src/config_requirements.rs:2195— ConfigRequirements::try_from 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.
RollbackPlanner::observe (cyclomatic 36) codex-rs/thread-store/src/local/rollout_migration/rollback_plan.rs:139— RollbackPlanner::observe has cyclomatic complexity 36 (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_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.
ReadTool::handle (cyclomatic 35) codex-rs/ext/skills/src/tools/read.rs:116— ReadTool::handle 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.
StatusHistoryCell::content_lines (cyclomatic 35) codex-rs/tui/src/status/card.rs:757— StatusHistoryCell::content_lines 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.
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.
AccountRequestProcessor::read_account (cyclomatic 34) codex-rs/app-server/src/request_processors/account_processor/workspace_routing.rs:309— AccountRequestProcessor::read_account 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.
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.
ExecServerClient::spawn_rpc_reader (cyclomatic 33) codex-rs/exec-server/src/client_recovery.rs:655— 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.
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.
TraceReducer::apply_event (cyclomatic 33) codex-rs/rollout-trace/src/reducer/mod.rs:260— TraceReducer::apply_event has cyclomatic complexity 33 (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.
ThreadMetadata::diff_fields (cyclomatic 33) codex-rs/state/src/model/thread_metadata.rs:247— 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.
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.
RealtimeHistoryState::observe (cyclomatic 30) codex-rs/core/src/realtime_history.rs:171— RealtimeHistoryState::observe 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.
ElicitationRequestManager::make_sender (cyclomatic 29) codex-rs/codex-mcp/src/elicitation.rs:425— ElicitationRequestManager::make_sender 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.
McpManager::runtime_config_with_context (cyclomatic 29) codex-rs/core/src/mcp.rs:310— 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.
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.
codex_guardian_v2::async_scorer::approval::cached_evidence (cyclomatic 29) codex-rs/ext/guardian-v2/src/async_scorer/approval.rs:202— codex_guardian_v2::async_scorer::approval::cached_evidence 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.
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.
ThreadMetadataPatch::merge (cyclomatic 29) codex-rs/thread-store/src/types.rs:899— 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.
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.
ConfigManager::persist_user_edits (cyclomatic 28) codex-rs/app-server/src/config_manager_service.rs:354— ConfigManager::persist_user_edits 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.
RemoteAppServerClient::connect_with_stream (cyclomatic 28) codex-rs/app-server-client/src/remote.rs:244— 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.
SandboxManager::transform (cyclomatic 28) codex-rs/sandboxing/src/manager.rs:382— SandboxManager::transform 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.
ThreadMetadataSync::observe_items_with_update (cyclomatic 28) codex-rs/thread-store/src/thread_metadata_sync.rs:242— 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.
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.
McpServerElicitationOverlay::handle_key_event (cyclomatic 28) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1519— 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.
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.
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.
SampleTask::run (cyclomatic 27) codex-rs/app-server/src/thread_sample.rs:113— SampleTask::run has cyclomatic complexity 27 (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.
ConnectionDriver::complete_request (cyclomatic 27) codex-rs/code-mode/src/remote_session/connection/driver/responses.rs:150— 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.
RequestPluginInstallHandler::handle_call (cyclomatic 27) codex-rs/core/src/tools/handlers/request_plugin_install.rs:95— 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.
LocalProcess::start_process (cyclomatic 27) codex-rs/exec-server/src/local_process.rs:290— LocalProcess::start_process has cyclomatic complexity 27 (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_guardian_reviewer::completion::complete_review (cyclomatic 27) codex-rs/ext/guardian-reviewer/src/completion.rs:39— codex_guardian_reviewer::completion::complete_review 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.
GuardianApprovalReviewer::decide_request (cyclomatic 27) codex-rs/ext/guardian-v2/src/async_scorer/approval.rs:55— GuardianApprovalReviewer::decide_request 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.
QueuedItemService::watch_external_messages (cyclomatic 27) codex-rs/ext/queue/src/service.rs:93— 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.
ComposedContext::enforce_budget (cyclomatic 27) codex-rs/guardian-context/src/enforcement.rs:255— ComposedContext::enforce_budget 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.
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.
KeymapContextSet::contains_action (cyclomatic 27) codex-rs/tui/src/keymap/chords.rs:213— KeymapContextSet::contains_action 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.
TurnDetails::index_turn (cyclomatic 27) codex-rs/tui/src/transcript_view/turn_details.rs:169— TurnDetails::index_turn 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.
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.
McpCatalogBuilder::build (cyclomatic 26) codex-rs/codex-mcp/src/catalog.rs:528— McpCatalogBuilder::build 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.
ModelClientSession::stream_responses_websocket (cyclomatic 26) codex-rs/core/src/client.rs:2186— ModelClientSession::stream_responses_websocket 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.
Features::apply_map (cyclomatic 26) codex-rs/features/src/lib.rs:740— 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.
BoardTool::execute (cyclomatic 26) codex-rs/message-board/src/tools.rs:192— BoardTool::execute 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.
FileSystemSandboxPolicy::to_legacy_sandbox_policy_with_projection (cyclomatic 26) codex-rs/protocol/src/permissions.rs:1888— FileSystemSandboxPolicy::to_legacy_sandbox_policy_with_projection 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.
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.
AppsRequestProcessor::apps_list_response (cyclomatic 25) codex-rs/app-server/src/request_processors/apps_processor.rs:178— AppsRequestProcessor::apps_list_response 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.
Requests::handle (cyclomatic 25) codex-rs/app-server-client/src/cloud_backend/requests.rs:56— Requests::handle has cyclomatic complexity 25 (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.
RemotePluginMeasurementCache::prepare (cyclomatic 25) codex-rs/core-plugins/src/plugin_measurement_references.rs:84— 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.
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.
sign_macos_cli_package.main (cyclomatic 25) .github/scripts/macos-signing/sign_macos_cli_package.py:13— sign_macos_cli_package.main 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.
HeadTailOutput::trim (cyclomatic 24) codex-rs/code-mode-runtime/src/output/output_collection.rs:314— HeadTailOutput::trim 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.
ToolCallRuntime::handle_tool_call_with_source (cyclomatic 24) codex-rs/core/src/tools/parallel.rs:167— ToolCallRuntime::handle_tool_call_with_source 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.
ExecServerCommand::run (cyclomatic 24) codex-rs/exec-server-cli/src/command.rs:193— ExecServerCommand::run 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.
SkillsExtension::contribute (cyclomatic 24) codex-rs/ext/skills/src/extension.rs:333— 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.
RolloutRecorder::list_threads_with_db_fallback (cyclomatic 24) codex-rs/rollout/src/recorder.rs:545— RolloutRecorder::list_threads_with_db_fallback 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.
ManagedWorktreeTools::execute_inner (cyclomatic 24) codex-rs/tui/src/managed_worktree_tools.rs:122— ManagedWorktreeTools::execute_inner 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.
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.
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.
ExternalAgentSessionImporter::persist_session (cyclomatic 23) codex-rs/app-server/src/external_agent_migration/session_importer.rs:391— ExternalAgentSessionImporter::persist_session 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.
InitializeRequestProcessor::initialize (cyclomatic 23) codex-rs/app-server/src/request_processors/initialize_processor.rs:53— InitializeRequestProcessor::initialize 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.
ScanState::observe (cyclomatic 23) codex-rs/app-server-protocol/src/export.rs:941— 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.
SessionState::recover_events (cyclomatic 23) codex-rs/exec-server/src/client_recovery.rs:96— 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.
CodexAuth::from_auth_dot_json (cyclomatic 23) codex-rs/login/src/auth/manager.rs:370— CodexAuth::from_auth_dot_json 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.
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.
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.
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.
verify_cargo_workspace_manifests.manifest_errors (cyclomatic 23) .github/scripts/verify_cargo_workspace_manifests.py:104— 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.
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.
ModelClient::build_responses_request (cyclomatic 22) codex-rs/core/src/client.rs:1162— 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.
Discovery::handle_reply (cyclomatic 22) codex-rs/rmcp-client/src/local_stdio_transport.rs:66— 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.
_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.
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.
PluginContributor::selected_plugins (cyclomatic 21) codex-rs/ext/mcp/src/plugin.rs:247— PluginContributor::selected_plugins 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.
TranscriptHistory::record (cyclomatic 21) codex-rs/guardian-context/src/history.rs:68— TranscriptHistory::record 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.
ModelProviderInfo::validate (cyclomatic 21) codex-rs/model-provider-info/src/lib.rs:356— ModelProviderInfo::validate 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_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.
ProviderForm::layout (cyclomatic 21) codex-rs/tui/src/app/provider/editor.rs:166— ProviderForm::layout 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.
McpToolCallCell::compact_mcp_lines (cyclomatic 21) codex-rs/tui/src/history_cell/mcp_preview.rs:37— 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.
codex_utils_output_truncation::truncate_measured_output_iter (cyclomatic 21) codex-rs/utils/output-truncation/src/lib.rs:348— codex_utils_output_truncation::truncate_measured_output_iter 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_utils_sandbox_summary::sandbox_summary::summarize_permission_profile (cyclomatic 21) codex-rs/utils/sandbox-summary/src/sandbox_summary.rs:8— 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.
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.
ThreadHistoryBuilder::build_user_inputs (cyclomatic 20) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1730— ThreadHistoryBuilder::build_user_inputs 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. This is NOT this file's highest cyclomatic complexity: ThreadHistoryBuilder::handle_event_for_history_mode (cyclomatic 44) 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.
WsStream::new (cyclomatic 20) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:88— 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.
McpServerConfig::try_from (cyclomatic 20) codex-rs/config/src/mcp_types.rs:470— 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.
CapturedRootConversation::prepare (cyclomatic 20) codex-rs/core/src/agent/control/user_authorization.rs:50— CapturedRootConversation::prepare 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.
ShellSnapshotFile::restore_credentials (cyclomatic 20) codex-rs/core/src/shell_snapshot.rs:369— 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.
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.
WarningsView::handle_key (cyclomatic 20) codex-rs/tui/src/bottom_pane/warnings_view.rs:112— 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.
ClipboardWorker::poll (cyclomatic 20) codex-rs/tui/src/clipboard_copy/worker.rs:468— 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.
OnboardingScreen::render_ref (cyclomatic 20) codex-rs/tui/src/onboarding/onboarding_screen.rs:451— 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.
NotarizationConfiguration.from_environment (cyclomatic 20) .github/scripts/macos-signing/notarize_with_akv.py:46— 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.
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.
OutgoingMessageSender::send_request_to_connections (cyclomatic 19) codex-rs/app-server/src/outgoing_message.rs:388— OutgoingMessageSender::send_request_to_connections 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.
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.
codex_cloud_client::items::summary (cyclomatic 19) codex-rs/cloud-client/src/items.rs:173— codex_cloud_client::items::summary 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.
ThreadEnvironments::update_selections_with_bindings (cyclomatic 19) codex-rs/core/src/environment_selection.rs:623— ThreadEnvironments::update_selections_with_bindings 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.
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.
TranscriptImages::collect (cyclomatic 19) codex-rs/guardian-context/src/images.rs:110— 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.
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.
SanitizedGitUrl::try_from (cyclomatic 19) codex-rs/protocol/src/sanitized_git_url.rs:29— SanitizedGitUrl::try_from 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.
LocalStdioServerLauncher::launch_server (cyclomatic 19) codex-rs/rmcp-client/src/stdio_server_launcher.rs:452— 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.
SideCompanion::apply_notification (cyclomatic 19) codex-rs/tui/src/app/side_companion.rs:73— SideCompanion::apply_notification 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.
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.
FeedbackNoteView::render (cyclomatic 19) codex-rs/tui/src/bottom_pane/feedback_note_view.rs:229— FeedbackNoteView::render 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.
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.
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.
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.
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.
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.
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.
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.
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.
codex_code_mode_protocol::description::build_exec_tool_description_and_definitions (cyclomatic 18) codex-rs/code-mode-protocol/src/description.rs:290— codex_code_mode_protocol::description::build_exec_tool_description_and_definitions 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.
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.
Inner::recover (cyclomatic 18) codex-rs/exec-server/src/client_recovery.rs:367— Inner::recover 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.
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.
GoalRuntimeHandle::stop_active_goal_for_turn (cyclomatic 18) codex-rs/ext/goal/src/runtime.rs:275— 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.
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.
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.
RolloutItem::from (cyclomatic 18) codex-rs/history/src/rollout_payload.rs:284— RolloutItem::from 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.
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.
LocalAgentMessageBoard::post_inner (cyclomatic 18) codex-rs/message-board/src/local.rs:206— 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.
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.
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.
ModelReplayPlanner::finish (cyclomatic 18) codex-rs/thread-store/src/local/rollout_migration/rollback_replay.rs:88— 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.
Draft::patch (cyclomatic 18) codex-rs/tui/src/app/provider/editor/form.rs:73— Draft::patch 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.
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.
ConfigEditor::value (cyclomatic 18) codex-rs/tui/src/config_panel/mod.rs:141— ConfigEditor::value 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.
Terminal::draw_with_size (cyclomatic 18) codex-rs/tui/src/custom_terminal.rs:381— Terminal::draw_with_size 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.
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.
ComputerActivityCell::display_lines (cyclomatic 18) codex-rs/tui/src/history_cell/computer_activity.rs:154— 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.
UnifiedExecProcessesCell::display_lines (cyclomatic 18) codex-rs/tui/src/history_cell/exec.rs:148— 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.
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.
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.
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.
TurnRequestProcessor::turn_start_inner (cyclomatic 17) codex-rs/app-server/src/request_processors/turn_processor.rs:577— TurnRequestProcessor::turn_start_inner 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.
Apply::run (cyclomatic 17) codex-rs/cloud-tasks-client/src/http.rs:451— 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.
HostState::handle_request (cyclomatic 17) codex-rs/code-mode-host/src/lib.rs:403— 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.
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.
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.
PermissionsState::render_diff (cyclomatic 17) codex-rs/core/src/context/world_state/permissions.rs:147— PermissionsState::render_diff 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.
PluginsInstructionsState::render_diff (cyclomatic 17) codex-rs/core/src/context/world_state/plugins_instructions.rs:93— PluginsInstructionsState::render_diff 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.
TopLevelToolsState::render_declaration_updates (cyclomatic 17) codex-rs/core/src/context/world_state/top_level_tools.rs:217— TopLevelToolsState::render_declaration_updates 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.
NodeReplReviewEvidence::record (cyclomatic 17) codex-rs/ext/guardian-reviewer/src/node_repl_review_evidence.rs:112— 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.
Housekeeper::route (cyclomatic 17) codex-rs/ext/guardian-v3/src/housekeeper.rs:109— Housekeeper::route 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.
InstallationsTool::handle (cyclomatic 17) codex-rs/ext/skills/src/tools/installations.rs:73— InstallationsTool::handle 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.
FeaturesToml::entries (cyclomatic 17) codex-rs/features/src/lib.rs:1018— 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.
OpenAiModelsManager::fetch_and_update_models (cyclomatic 17) codex-rs/models-manager/src/manager.rs:831— OpenAiModelsManager::fetch_and_update_models 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.
OAuthStoreLock::acquire_in_with_mode (cyclomatic 17) codex-rs/rmcp-client/src/oauth/store_lock.rs:128— OAuthStoreLock::acquire_in_with_mode 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.
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.
RmcpClient::call_tool_inner (cyclomatic 17) codex-rs/rmcp-client/src/rmcp_client.rs:1053— 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.
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.
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.
Tui::with_restored (cyclomatic 17) codex-rs/tui/src/tui.rs:1003— Tui::with_restored 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.
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.
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.
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.
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.
_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.
run_bazel.bazel_args_with_remote_config (cyclomatic 17) .github/scripts/run_bazel.py:70— run_bazel.bazel_args_with_remote_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.
build_npm_package.copy_native_binaries (cyclomatic 17) codex-cli/scripts/build_npm_package.py:358— build_npm_package.copy_native_binaries 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.
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.
GrpcCodeModeSessionProvider::open_binding (cyclomatic 16) codex-rs/code-mode/src/grpc_session/mod.rs:154— GrpcCodeModeSessionProvider::open_binding 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.
SessionConfiguration::apply (cyclomatic 16) codex-rs/core/src/session/session.rs:421— SessionConfiguration::apply 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_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.
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.
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.
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.
codex_terminal_detection::detect_terminal_identity_from_env (cyclomatic 16) codex-rs/terminal-detection/src/lib.rs:289— codex_terminal_detection::detect_terminal_identity_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 18) 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.
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.
ModifierDiff::queue (cyclomatic 16) codex-rs/tui/src/custom_terminal.rs:838— ModifierDiff::queue has cyclomatic complexity 16 (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.
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.
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.
RuntimeChordKeymap::from_config (cyclomatic 16) codex-rs/tui/src/keymap/chords.rs:351— 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.
KeyChordMatcher::advance (cyclomatic 16) codex-rs/tui/src/keymap/chords.rs:687— 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.
CopyLine::render (cyclomatic 16) codex-rs/tui/src/markdown_copy.rs:198— 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.
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.
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.
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.
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.
update_sdk_artifacts._annotation_to_source (cyclomatic 16) sdk/python/scripts/update_sdk_artifacts.py:1021— 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.
issue_labeler.read_labels (cyclomatic 16) .github/scripts/issue_labeler.py:112— issue_labeler.read_labels 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.
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.
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.
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.
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.
ConfigRequirementsWithSources::merge_unset_fields (cognitive 118) codex-rs/config/src/config_requirements.rs:1414— ConfigRequirementsWithSources::merge_unset_fields has cognitive complexity 118 (threshold 15). Drivers by points: if/else 56 (68 pts), boolean chains 46, 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.
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.
MathMarkdown::new (cognitive 107) codex-rs/tui/src/markdown_render/math.rs:28— MathMarkdown::new has cognitive complexity 107 (threshold 15). Drivers by points: if/else 38 (77 pts), boolean chains 22, loops 4 (8 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.
ThreadManagerState::spawn_thread (cognitive 95) codex-rs/core/src/thread_manager.rs:2491— ThreadManagerState::spawn_thread has cognitive complexity 95 (threshold 15). Drivers by points: if/else 45 (67 pts), match/switch 11 (15 pts), boolean chains 12, 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.
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.
SamplingExecution::run (cognitive 87) codex-rs/ext/guardian-v2/src/async_scorer/sampler/execution.rs:187— SamplingExecution::run has cognitive complexity 87 (threshold 15). Drivers by points: if/else 20 (54 pts), match/switch 9 (22 pts), loops 4 (9 pts), boolean chains 2 (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.
ToolOrchestrator::run (cognitive 84) codex-rs/core/src/tools/orchestrator.rs:125— ToolOrchestrator::run has cognitive complexity 84 (threshold 15). Drivers by points: if/else 35 (58 pts), boolean chains 18, match/switch 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.
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.
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.
CollectedContext::compose_prepared (cognitive 78) codex-rs/guardian-context/src/composition.rs:215— CollectedContext::compose_prepared has cognitive complexity 78 (threshold 15). Drivers by points: if/else 22 (60 pts), match/switch 5 (13 pts), loops 2 (4 pts), boolean chains 1 (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.
NetworkApprovalService::handle_inline_policy_request (cognitive 77) codex-rs/core/src/tools/network_approval.rs:743— NetworkApprovalService::handle_inline_policy_request has cognitive complexity 77 (threshold 15). Drivers by points: if/else 38 (61 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.
UnifiedExecRuntime::run (cognitive 70) codex-rs/core/src/tools/runtimes/unified_exec.rs:221— UnifiedExecRuntime::run has cognitive complexity 70 (threshold 15). Drivers by points: if/else 36 (44 pts), boolean chains 18, loops 2 (4 pts), match/switch 2 (4 pts) (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.
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.
FeedbackRequestProcessor::feedback_response (cognitive 68) codex-rs/app-server/src/request_processors/feedback_processor.rs:94— FeedbackRequestProcessor::feedback_response has cognitive complexity 68 (threshold 15). Drivers by points: if/else 23 (39 pts), match/switch 8 (16 pts), loops 4 (9 pts), boolean chains 4 (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.
RemoteAppServerClient::connect_with_stream (cognitive 68) codex-rs/app-server-client/src/remote.rs:244— 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.
StreamableHttpClientAdapter::post_message (cognitive 64) codex-rs/rmcp-client/src/http_client_adapter.rs:149— StreamableHttpClientAdapter::post_message has cognitive complexity 64 (threshold 15). Drivers by points: if/else 27 (44 pts), boolean chains 12, 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.
QueuedItemService::watch_external_messages (cognitive 63) codex-rs/ext/queue/src/service.rs:93— 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.
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.
ConfigRequirements::try_from (cognitive 57) codex-rs/config/src/config_requirements.rs:2195— ConfigRequirements::try_from has cognitive complexity 57 (threshold 15). Drivers by points: if/else 27 (41 pts), match/switch 10 (12 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.
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.
verify_cargo_workspace_manifests.manifest_errors (cognitive 56) .github/scripts/verify_cargo_workspace_manifests.py:104— 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.
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.
ShellSnapshotCache::prepare (cognitive 54) codex-rs/exec-server/src/shell_snapshot.rs:109— ShellSnapshotCache::prepare has cognitive complexity 54 (threshold 15). Drivers by points: if/else 26 (34 pts), match/switch 7 (9 pts), boolean chains 6, 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.
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.
ModelClientSession::stream_responses_websocket (cognitive 53) codex-rs/core/src/client.rs:2186— ModelClientSession::stream_responses_websocket has cognitive complexity 53 (threshold 15). Drivers by points: if/else 24 (41 pts), match/switch 3 (6 pts), loops 2 (4 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.
ReadTool::handle (cognitive 52) codex-rs/ext/skills/src/tools/read.rs:116— ReadTool::handle has cognitive complexity 52 (threshold 15). Drivers by points: if/else 30 (39 pts), boolean chains 6, match/switch 5, loops 1 (2 pts) (nesting depth added 10). 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.
ContextProfile::prepare_transcript_for_budgeting (cognitive 52) codex-rs/guardian-context/src/preparation/transcript.rs:135— ContextProfile::prepare_transcript_for_budgeting has cognitive complexity 52 (threshold 15). Drivers by points: if/else 18 (30 pts), loops 5 (9 pts), match/switch 7 (8 pts), boolean chains 5 (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.
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.
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.
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.
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.
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.
ToolRegistry::dispatch_any_with_state (cognitive 47) codex-rs/core/src/tools/registry.rs:760— ToolRegistry::dispatch_any_with_state has cognitive complexity 47 (threshold 15). Drivers by points: if/else 23 (31 pts), match/switch 10 (13 pts), boolean chains 2, 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.
ThreadMetadataSync::observe_items_with_update (cognitive 47) codex-rs/thread-store/src/thread_metadata_sync.rs:242— 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.
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.
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.
sign_macos_cli_package.main (cognitive 46) .github/scripts/macos-signing/sign_macos_cli_package.py:13— sign_macos_cli_package.main has cognitive complexity 46 (threshold 15). Drivers by points: if/else 19 (38 pts), boolean chains 5, loops 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.
HeadTailOutput::trim (cognitive 45) codex-rs/code-mode-runtime/src/output/output_collection.rs:314— HeadTailOutput::trim has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (29 pts), loops 5 (9 pts), match/switch 2 (5 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::selected_plugins (cognitive 43) codex-rs/ext/mcp/src/plugin.rs:247— PluginContributor::selected_plugins has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 5 (11 pts), boolean chains 4, match/switch 1 (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.
TurnDetails::index_turn (cognitive 43) codex-rs/tui/src/transcript_view/turn_details.rs:169— TurnDetails::index_turn has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 11, match/switch 1 (2 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.
ConfigManager::persist_user_edits (cognitive 42) codex-rs/app-server/src/config_manager_service.rs:354— ConfigManager::persist_user_edits has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 12, loops 3 (6 pts), match/switch 1 (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.
codex_code_mode_protocol::description::build_exec_tool_description_and_definitions (cognitive 42) codex-rs/code-mode-protocol/src/description.rs:290— codex_code_mode_protocol::description::build_exec_tool_description_and_definitions has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (36 pts), boolean chains 2, loops 1 (2 pts), match/switch 2 (nesting depth added 24). 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_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.
McpCatalogBuilder::build (cognitive 41) codex-rs/codex-mcp/src/catalog.rs:528— McpCatalogBuilder::build has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 7, match/switch 4 (7 pts), loops 4 (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.
ExecServerCommand::run (cognitive 41) codex-rs/exec-server-cli/src/command.rs:193— ExecServerCommand::run has cognitive complexity 41 (threshold 15). Drivers by points: if/else 22 (30 pts), match/switch 3 (7 pts), boolean chains 4 (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.
Classification::run (cognitive 40) codex-rs/ext/guardian-v2/src/async_scorer/classification.rs:112— Classification::run has cognitive complexity 40 (threshold 15). Drivers by points: if/else 23 (25 pts), boolean chains 7, match/switch 7, 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.
GuardianV2Extension::score_tool (cognitive 40) codex-rs/ext/guardian-v2/src/async_scorer/observation.rs:53— GuardianV2Extension::score_tool has cognitive complexity 40 (threshold 15). Drivers by points: if/else 24 (26 pts), match/switch 7 (9 pts), boolean chains 5 (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.
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.
ThreadHistoryBuilder::build_user_inputs (cognitive 39) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1730— ThreadHistoryBuilder::build_user_inputs has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 5 (9 pts), match/switch 2 (6 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.
GuardianApprovalReviewer::decide_request (cognitive 39) codex-rs/ext/guardian-v2/src/async_scorer/approval.rs:55— GuardianApprovalReviewer::decide_request has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (25 pts), boolean chains 6, match/switch 3 (6 pts), loops 1 (2 pts) (nesting depth added 10). 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_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.
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.
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.
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.
ManagedWorktreeTools::execute_inner (cognitive 37) codex-rs/tui/src/managed_worktree_tools.rs:122— ManagedWorktreeTools::execute_inner has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (22 pts), match/switch 4 (8 pts), boolean chains 5, 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.
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.
TranscriptImages::collect (cognitive 36) codex-rs/guardian-context/src/images.rs:110— 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.
UnifiedExecProcessesCell::display_lines (cognitive 36) codex-rs/tui/src/history_cell/exec.rs:148— 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.
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.
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.
ModelClient::build_responses_request (cognitive 35) codex-rs/core/src/client.rs:1162— 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.
SkillsExtension::contribute (cognitive 35) codex-rs/ext/skills/src/extension.rs:333— 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.
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.
ThreadEnvironments::update_selections_with_bindings (cognitive 34) codex-rs/core/src/environment_selection.rs:623— ThreadEnvironments::update_selections_with_bindings has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 5, match/switch 1 (4 pts), loops 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.
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.
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.
TranscriptHistory::record (cognitive 34) codex-rs/guardian-context/src/history.rs:68— TranscriptHistory::record has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 7, loops 1 (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.
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.
codex_utils_sandbox_summary::sandbox_summary::summarize_permission_profile (cognitive 34) codex-rs/utils/sandbox-summary/src/sandbox_summary.rs:8— 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.
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.
RealtimeHistoryState::observe (cognitive 33) codex-rs/core/src/realtime_history.rs:171— RealtimeHistoryState::observe has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (28 pts), match/switch 3 (4 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.
Inner::recover (cognitive 33) codex-rs/exec-server/src/client_recovery.rs:367— Inner::recover has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (24 pts), match/switch 3 (8 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.
ClipboardWorker::poll (cognitive 33) codex-rs/tui/src/clipboard_copy/worker.rs:468— 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.
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.
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.
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.
ThreadMetadata::diff_fields (cognitive 32) codex-rs/state/src/model/thread_metadata.rs:247— 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.
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.
codex_utils_output_truncation::truncate_measured_output_iter (cognitive 32) codex-rs/utils/output-truncation/src/lib.rs:348— codex_utils_output_truncation::truncate_measured_output_iter has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (21 pts), match/switch 5 (6 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.
build_npm_package.copy_native_binaries (cognitive 32) codex-cli/scripts/build_npm_package.py:358— build_npm_package.copy_native_binaries has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 3 (6 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.
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.
ModelProviderInfo::validate (cognitive 31) codex-rs/model-provider-info/src/lib.rs:356— ModelProviderInfo::validate has cognitive complexity 31 (threshold 15). Drivers by points: if/else 21 (31 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.
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.
codex_tcp_tunnel::serve (cognitive 31) codex-rs/tcp-tunnel/src/lib.rs:424— 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.
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.
ProviderForm::layout (cognitive 31) codex-rs/tui/src/app/provider/editor.rs:166— ProviderForm::layout has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 5, 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.
ElicitationRequestManager::make_sender (cognitive 30) codex-rs/codex-mcp/src/elicitation.rs:425— ElicitationRequestManager::make_sender has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (19 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.
NodeReplReviewEvidence::record (cognitive 30) codex-rs/ext/guardian-reviewer/src/node_repl_review_evidence.rs:112— 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.
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.
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.
FeedbackNoteView::render (cognitive 30) codex-rs/tui/src/bottom_pane/feedback_note_view.rs:229— FeedbackNoteView::render has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (23 pts), loops 2 (3 pts), boolean chains 2, 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.
McpServerElicitationOverlay::handle_key_event (cognitive 30) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:1519— 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.
CopyLine::render (cognitive 30) codex-rs/tui/src/markdown_copy.rs:198— 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.
OutgoingMessageSender::send_request_to_connections (cognitive 29) codex-rs/app-server/src/outgoing_message.rs:388— OutgoingMessageSender::send_request_to_connections has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 5, match/switch 2 (3 pts), loops 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.
InitializeRequestProcessor::initialize (cognitive 29) codex-rs/app-server/src/request_processors/initialize_processor.rs:53— InitializeRequestProcessor::initialize has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 5, match/switch 1 (3 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.
ToolCallRuntime::handle_tool_call_with_source (cognitive 29) codex-rs/core/src/tools/parallel.rs:167— ToolCallRuntime::handle_tool_call_with_source has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (16 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.
RemotePluginMeasurementCache::prepare (cognitive 29) codex-rs/core-plugins/src/plugin_measurement_references.rs:84— 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.
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.
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.
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.
ComputerActivityCell::display_lines (cognitive 29) codex-rs/tui/src/history_cell/computer_activity.rs:154— 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.
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.
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.
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.
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.
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.
RenderedEnvironments::body (cognitive 28) codex-rs/core/src/context/world_state/environment.rs:297— 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.
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.
ThreadMetadataPatch::merge (cognitive 28) codex-rs/thread-store/src/types.rs:899— 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.
McpServerElicitationFormRequest::from_app_server_request (cognitive 28) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:194— McpServerElicitationFormRequest::from_app_server_request has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (24 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.
_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.
SampleTask::run (cognitive 27) codex-rs/app-server/src/thread_sample.rs:113— SampleTask::run has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 6, match/switch 4 (6 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.
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.
SessionState::recover_events (cognitive 27) codex-rs/exec-server/src/client_recovery.rs:96— 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.
BoardTool::execute (cognitive 27) codex-rs/message-board/src/tools.rs:192— BoardTool::execute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 9 (13 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.
OpenAiModelsManager::fetch_and_update_models (cognitive 27) codex-rs/models-manager/src/manager.rs:831— OpenAiModelsManager::fetch_and_update_models has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 7, 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.
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.
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.
McpServerConfig::try_from (cognitive 26) codex-rs/config/src/mcp_types.rs:470— 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.
PermissionsState::render_diff (cognitive 26) codex-rs/core/src/context/world_state/permissions.rs:147— PermissionsState::render_diff has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 2 (4 pts), boolean chains 3, 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.
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.
RequestPluginInstallHandler::handle_call (cognitive 26) codex-rs/core/src/tools/handlers/request_plugin_install.rs:95— RequestPluginInstallHandler::handle_call has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (13 pts), match/switch 8 (9 pts), boolean chains 4 (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_model_provider_info::merge_configured_model_providers (cognitive 26) codex-rs/model-provider-info/src/lib.rs:797— codex_model_provider_info::merge_configured_model_providers has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (23 pts), boolean chains 2, 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.
SanitizedGitUrl::try_from (cognitive 26) codex-rs/protocol/src/sanitized_git_url.rs:29— SanitizedGitUrl::try_from has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 8, loops 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.
SandboxManager::transform (cognitive 26) codex-rs/sandboxing/src/manager.rs:382— SandboxManager::transform has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 8 (13 pts), if/else 6 (8 pts), boolean chains 5 (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.
ModelReplayPlanner::finish (cognitive 26) codex-rs/thread-store/src/local/rollout_migration/rollback_replay.rs:88— 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.
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.
RuntimeChordKeymap::from_config (cognitive 26) codex-rs/tui/src/keymap/chords.rs:351— 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.
Tui::with_restored (cognitive 26) codex-rs/tui/src/tui.rs:1003— Tui::with_restored has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (17 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.
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.
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.
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.
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.
Housekeeper::route (cognitive 25) codex-rs/ext/guardian-v3/src/housekeeper.rs:109— Housekeeper::route has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 6 (8 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.
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.
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.
Terminal::draw_with_size (cognitive 25) codex-rs/tui/src/custom_terminal.rs:381— Terminal::draw_with_size has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 3 (5 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 7). 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.
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.
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.
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.
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.
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.
Requests::handle (cognitive 24) codex-rs/app-server-client/src/cloud_backend/requests.rs:56— Requests::handle has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 3 (5 pts), boolean chains 2, loops 1 (2 pts) (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.
InProcessAppServerClient::start (cognitive 24) codex-rs/app-server-client/src/lib.rs:384— 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.
HostState::handle_request (cognitive 24) codex-rs/code-mode-host/src/lib.rs:403— 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.
RealtimeWebsocketConnection::from_sideband (cognitive 24) codex-rs/codex-api/src/endpoint/realtime_websocket/methods/sideband.rs:20— RealtimeWebsocketConnection::from_sideband has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 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.
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.
RetainedContext::record_user_message (cognitive 24) codex-rs/history/src/retained_context.rs:389— 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.
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.
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.
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.
TurnRequestProcessor::turn_start_inner (cognitive 23) codex-rs/app-server/src/request_processors/turn_processor.rs:577— 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.
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.
ExecPolicyManager::create_exec_approval_requirement_for_parsed_commands (cognitive 23) codex-rs/core/src/exec_policy.rs:366— ExecPolicyManager::create_exec_approval_requirement_for_parsed_commands has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (17 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.
codex_git_attribution::policy::resolve_attribution_policy (cognitive 23) codex-rs/ext/git-attribution/src/policy.rs:54— codex_git_attribution::policy::resolve_attribution_policy has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 2 (5 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.
Discovery::handle_reply (cognitive 23) codex-rs/rmcp-client/src/local_stdio_transport.rs:66— 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.
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.
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.
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.
CapturedRootConversation::prepare (cognitive 22) codex-rs/core/src/agent/control/user_authorization.rs:50— CapturedRootConversation::prepare has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 7, match/switch 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.
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.
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.
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.
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.
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.
LocalStdioServerLauncher::launch_server (cognitive 22) codex-rs/rmcp-client/src/stdio_server_launcher.rs:452— 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.
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.
update_sdk_artifacts._annotation_to_source (cognitive 22) sdk/python/scripts/update_sdk_artifacts.py:1021— 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.
issue_labeler.suggest_labels (cognitive 22) .github/scripts/issue_labeler.py:150— issue_labeler.suggest_labels has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 3 (8 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.
Apply::run (cognitive 21) codex-rs/cloud-tasks-client/src/http.rs:451— 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.
RealtimeConversationManager::handoff_out (cognitive 21) codex-rs/core/src/realtime_conversation.rs:1058— 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.
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.
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.
CodexAuth::from_auth_dot_json (cognitive 21) codex-rs/login/src/auth/manager.rs:370— CodexAuth::from_auth_dot_json has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 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.
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.
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.
Draft::patch (cognitive 21) codex-rs/tui/src/app/provider/editor/form.rs:73— Draft::patch has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, match/switch 2 (3 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.
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.
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.
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.
UserHistoryCell::transcript_hyperlink_lines (cognitive 21) codex-rs/tui/src/history_cell/messages.rs:249— UserHistoryCell::transcript_hyperlink_lines has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (19 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, 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.
KeymapContextSet::contains_action (cognitive 21) codex-rs/tui/src/keymap/chords.rs:213— KeymapContextSet::contains_action has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 14, if/else 5, match/switch 1 (2 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.
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.
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.
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.
update_sdk_artifacts._normalized_schema_bundle_text (cognitive 21) sdk/python/scripts/update_sdk_artifacts.py:525— update_sdk_artifacts._normalized_schema_bundle_text has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (15 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.
ScanState::observe (cognitive 20) codex-rs/app-server-protocol/src/export.rs:941— 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.
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.
GrpcCodeModeSessionProvider::open_binding (cognitive 20) codex-rs/code-mode/src/grpc_session/mod.rs:154— GrpcCodeModeSessionProvider::open_binding has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 4 (5 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.
LocalAgentRuntime::capture_sender_user_messages (cognitive 20) codex-rs/core/src/agent/control/sender_context.rs:19— LocalAgentRuntime::capture_sender_user_messages has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 3 (9 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.
InstallationsTool::handle (cognitive 20) codex-rs/ext/skills/src/tools/installations.rs:73— InstallationsTool::handle has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, loops 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.
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.
OAuthSessionManager::refresh (cognitive 20) codex-rs/login/src/oauth_session.rs:321— 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.
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.
Live::filtered_history (cognitive 20) codex-rs/tui/src/analytics/client.rs:141— 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.
Hints::fit (cognitive 20) codex-rs/tui/src/bottom_pane/chat_composer/passive_hints.rs:140— Hints::fit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3, 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.
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.
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.
ProviderInput::line (cognitive 20) codex-rs/tui/src/onboarding/provider_setup.rs:66— ProviderInput::line has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3, match/switch 1 (2 pts), 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.
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.
run_bazel.bazel_args_with_remote_config (cognitive 20) .github/scripts/run_bazel.py:70— run_bazel.bazel_args_with_remote_config has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6, error handling 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.
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.
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.
codex_code_mode_host::peer::drive_cell (cognitive 19) codex-rs/code-mode-host/src/peer.rs:420— 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.
RealtimeWebsocketEvents::next_event (cognitive 19) codex-rs/codex-api/src/endpoint/realtime_websocket/methods.rs:566— RealtimeWebsocketEvents::next_event has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 3 (7 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.
ToolCatalogTransportIdentity::new (cognitive 19) codex-rs/codex-mcp/src/tool_catalog_cache.rs:363— 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.
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.
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.
TurnEnvironment::shell_snapshot (cognitive 19) codex-rs/core/src/session/turn_context.rs:147— 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.
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.
OpenAiModelsEndpoint::fetch_models (cognitive 19) codex-rs/model-provider/src/models_endpoint.rs:155— OpenAiModelsEndpoint::fetch_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.
SandboxPolicy::get_writable_roots_with_cwd (cognitive 19) codex-rs/protocol/src/protocol.rs:1445— 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.
PreparedLaunchPolicy::resolve (cognitive 19) codex-rs/sandboxing/src/launch.rs:94— PreparedLaunchPolicy::resolve has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 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.
InMemoryThreadStore::list_threads (cognitive 19) codex-rs/thread-store/src/in_memory.rs:1019— InMemoryThreadStore::list_threads has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 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.
BackendSessions::next_event (cognitive 19) codex-rs/tui/src/app/backend_sessions.rs:274— BackendSessions::next_event has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 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.
AppExitInfo::format_exit_messages (cognitive 19) codex-rs/tui/src/app/exit_summary.rs:77— AppExitInfo::format_exit_messages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 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.
WarningsView::handle_key (cognitive 19) codex-rs/tui/src/bottom_pane/warnings_view.rs:112— 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.
HintLine::new (cognitive 19) codex-rs/tui/src/footer_hint.rs:38— HintLine::new has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 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.
KeyChordMatcher::advance (cognitive 19) codex-rs/tui/src/keymap/chords.rs:687— 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.
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.
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.
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.
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.
_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.
NotarizationConfiguration.from_environment (cognitive 19) .github/scripts/macos-signing/notarize_with_akv.py:46— 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.
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.
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.
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.
Client::add_user_message (cognitive 18) codex-rs/cloud-client/src/turns.rs:127— Client::add_user_message has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 8 (11 pts), boolean chains 5, if/else 2 (nesting depth added 3). 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.
ApplyPatchRuntime::run (cognitive 18) codex-rs/core/src/tools/runtimes/apply_patch.rs:172— 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.
GoalRuntimeHandle::stop_active_goal_for_turn (cognitive 18) codex-rs/ext/goal/src/runtime.rs:275— 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.
Features::apply_map (cognitive 18) codex-rs/features/src/lib.rs:740— 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.
codex_features::unstable_features_warning_event (cognitive 18) codex-rs/features/src/lib.rs:2491— 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.
Ranking::advance (cognitive 18) codex-rs/file-search/src/snapshot.rs:53— Ranking::advance has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 2 (4 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_file_search::walker_worker (cognitive 18) codex-rs/file-search/src/lib.rs:429— codex_file_search::walker_worker has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), match/switch 3 (5 pts), boolean chains 2, 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.
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.
PreparedElasticContext::enforce_budget (cognitive 18) codex-rs/guardian-context/src/allocation.rs:200— PreparedElasticContext::enforce_budget has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 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.
codex_history::model_id_ordinals::next_model_id_ordinals (cognitive 18) codex-rs/history/src/model_id_ordinals.rs:10— codex_history::model_id_ordinals::next_model_id_ordinals 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.
GatewayOAuthConfig::validate (cognitive 18) codex-rs/model-provider-info/src/gateway_oauth.rs:158— GatewayOAuthConfig::validate has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 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.
ResponseInputItem::from_user_input (cognitive 18) codex-rs/protocol/src/models.rs:2301— 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.
MemoryStore::get_phase2_input_selection (cognitive 18) codex-rs/state/src/runtime/memories.rs:457— 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.
layout.validate_package_dir (cognitive 18) scripts/codex_package/layout.py:95— 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.
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.
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.
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.
notarize_with_akv.notarize (cognitive 18) .github/scripts/macos-signing/notarize_with_akv.py:510— 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.
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.
codex.detectPackageManager (cognitive 18) codex-cli/bin/codex.js:172— 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.
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.
Replies::forward_next (cognitive 17) codex-rs/app-server-client/src/cloud_backend/mod.rs:58— Replies::forward_next has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 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.
SharedTransport::client (cognitive 17) codex-rs/code-mode/src/grpc_session/transport.rs:64— SharedTransport::client has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, 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.
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.
ResponsesWebsocketConnection::stream_request_with_observer (cognitive 17) codex-rs/codex-api/src/endpoint/responses_websocket.rs:304— ResponsesWebsocketConnection::stream_request_with_observer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), match/switch 5 (7 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.
AgentsMdManager::refresh (cognitive 17) codex-rs/core/src/agents_md_manager.rs:69— AgentsMdManager::refresh has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3 (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.
ResponsesHttpExecutor::stream_responses_http (cognitive 17) codex-rs/core/src/client.rs:1969— ResponsesHttpExecutor::stream_responses_http has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (2 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.
SessionConfiguration::apply (cognitive 17) codex-rs/core/src/session/session.rs:421— SessionConfiguration::apply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (13 pts), 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.
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.
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.
TcpUpstreamProxy::connect (cognitive 17) codex-rs/network-proxy/src/tcp_upstream.rs:51— TcpUpstreamProxy::connect has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 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.
OtelProvider::try_new (cognitive 17) codex-rs/otel/src/provider.rs:202— OtelProvider::try_new has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 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.
OAuthStoreLock::acquire_in_with_mode (cognitive 17) codex-rs/rmcp-client/src/oauth/store_lock.rs:128— OAuthStoreLock::acquire_in_with_mode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), match/switch 6 (8 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.
RolloutPersistenceTelemetry::record_batch (cognitive 17) codex-rs/rollout/src/persistence_metrics.rs:388— 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.
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.
SqliteConfig::open_read_write_pool_with_spec (cognitive 17) codex-rs/state/src/sqlite.rs:459— 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.
AttachmentState::handle_remote_image_selection_key (cognitive 17) codex-rs/tui/src/bottom_pane/chat_composer/attachment_state.rs:132— 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.
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.
cargo.build_source_binaries (cognitive 17) scripts/codex_package/cargo.py:27— cargo.build_source_binaries has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (6 pts), ternaries 5, boolean chains 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.
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.
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.
contract_releases.github_read (cognitive 17) .github/scripts/contract_releases.py:18— 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.
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.
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.
codex_cloud_client::items::summary (cognitive 16) codex-rs/cloud-client/src/items.rs:173— codex_cloud_client::items::summary has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 5 (14 pts), loops 1 (2 pts) (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.
ResourceOrigins::observe (cognitive 16) codex-rs/codex-mcp/src/resource_origin.rs:106— 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.
ManagedClientStartup::start (cognitive 16) codex-rs/codex-mcp/src/rmcp_client.rs:306— 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.
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.
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.
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.
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.
Policy::preserves_managed_requirements (cognitive 16) codex-rs/execpolicy/src/policy.rs:199— Policy::preserves_managed_requirements has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, 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.
codex_image_generation_extension::tool::save_image_generation_result (cognitive 16) codex-rs/ext/image-generation/src/tool.rs:362— 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.
FeaturesToml::entries (cognitive 16) codex-rs/features/src/lib.rs:1018— 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.
NodeReplContext::render_inputs (cognitive 16) codex-rs/guardian-context/src/preparation/repl.rs:119— NodeReplContext::render_inputs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (5 pts), boolean chains 4, match/switch 2 (4 pts), 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.
NetworkProxyState::host_blocked_with_lookup (cognitive 16) codex-rs/network-proxy/src/runtime.rs:864— NetworkProxyState::host_blocked_with_lookup has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, 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.
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.
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.
LocalHistoryAccount::includes (cognitive 16) codex-rs/thread-store/src/local_history_account.rs:21— LocalHistoryAccount::includes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6 (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.
Completion::finish (cognitive 16) codex-rs/tui/src/app/provider/write.rs:144— Completion::finish has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 3 (6 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.
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.
TabStrip::render (cognitive 16) codex-rs/tui/src/sidebar_tab_strip.rs:87— TabStrip::render has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), match/switch 4 (7 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.
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.
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.
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.
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.
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.
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.
Near-duplicate member pair (62 shared lines) codex-rs/app-server-transport/src/transport/remote_control/mod.rs:440— codex-rs/app-server-transport/src/transport/remote_control/mod.rs:440-565 | codex-rs/app-server-transport/src/transport/remote_control/mod.rs:688-794 — 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.
Near-duplicate member pair (45 shared lines) codex-rs/rollout-trace/src/protocol_event.rs:270— codex-rs/rollout-trace/src/protocol_event.rs:270-439 | codex-rs/rollout-trace/src/protocol_event.rs:441-530 — These two members are variants of one another: 45 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.
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 (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· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (7 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/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 7 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 7 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 7 times.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
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· Edited copy of a member (107 corresponding lines) · ×1
Edited copy of a member (107 corresponding lines) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1730— codex-rs/app-server-protocol/src/protocol/thread_history.rs:1730-1856 | codex-rs/thread-store/src/local/rollout_migration/legacy_event.rs:42-148 — These two members are one piece of code written twice and then edited apart: 107 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 (109 corresponding lines) · ×1
Edited copy of a member (109 corresponding lines) codex-rs/state/src/runtime/threads.rs:643— codex-rs/state/src/runtime/threads.rs:643-751 | codex-rs/state/src/runtime/threads.rs:993-1154 — These two members are one piece of code written twice and then edited apart: 109 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 (113 corresponding lines) · ×1
Edited copy of a member (113 corresponding lines) codex-rs/app-server/src/command_exec.rs:455— codex-rs/app-server/src/command_exec.rs:455-567 | codex-rs/app-server/src/request_processors/process_exec_processor.rs:489-611 — These two members are one piece of code written twice and then edited apart: 113 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 (70 corresponding lines) · ×1
Edited copy of a member (70 corresponding lines) codex-rs/tui/src/bottom_pane/textarea.rs:1497— codex-rs/tui/src/bottom_pane/textarea.rs:1497-1566 | codex-rs/tui/src/bottom_pane/textarea.rs:1568-1642 — These two members are one piece of code written twice and then edited apart: 70 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 (61 corresponding lines) · ×1
Edited copy of a member (61 corresponding lines) codex-rs/windows-sandbox-rs/src/acl.rs:776— codex-rs/windows-sandbox-rs/src/acl.rs:776-836 | codex-rs/windows-sandbox-rs/src/acl.rs:1034-1101 — These two members are one piece of code written twice and then edited apart: 61 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 (69 corresponding lines) · ×1
Edited copy of a member (69 corresponding lines) 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 — These two members are one piece of code written twice and then edited apart: 69 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 (53 corresponding lines) · ×1
Edited copy of a member (53 corresponding lines) codex-rs/rollout/src/search.rs:124— codex-rs/rollout/src/search.rs:124-176 | codex-rs/rollout/src/search.rs:225-286 — These two members are one piece of code written twice and then edited apart: 53 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 (51 corresponding lines) · ×1
Edited copy of a member (51 corresponding lines) codex-rs/external-agent-migration/src/sessions/records_cla.rs:179— codex-rs/external-agent-migration/src/sessions/records_cla.rs:179-229 | codex-rs/external-agent-migration/src/sessions/records_cur.rs:143-194 — These two members are one piece of code written twice and then edited apart: 51 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 (57 corresponding lines) · ×1
Edited copy of a member (57 corresponding lines) codex-rs/skills/src/mentions.rs:88— codex-rs/skills/src/mentions.rs:88-149 | codex-rs/tui/src/chatwidget/skills.rs:326-382 — These two members are one piece of code written twice and then edited apart: 57 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 copies of one member (3 members, 56+ corresponding lines) · ×1
Edited copies of one member (3 members, 56+ corresponding lines) codex-rs/ext/goal/src/runtime.rs:553— codex-rs/ext/goal/src/runtime.rs:553-608 | codex-rs/ext/goal/src/runtime.rs:615-672 | codex-rs/ext/goal/src/tool.rs:353-413 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 56 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (54 corresponding lines) · ×1
Edited copy of a member (54 corresponding lines) codex-rs/tui/src/resume_picker.rs:607— codex-rs/tui/src/resume_picker.rs:607-664 | codex-rs/tui/src/resume_picker.rs:673-726 — These two members are one piece of code written twice and then edited apart: 54 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 (49 corresponding lines) · ×1
Edited copy of a member (49 corresponding lines) codex-rs/app-server/src/external_agent_migration/protocol.rs:67— codex-rs/app-server/src/external_agent_migration/protocol.rs:67-115 | codex-rs/app-server/src/external_agent_migration/protocol.rs:131-179 — These two members are one piece of code written twice and then edited apart: 49 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 (48 corresponding lines) · ×1
Edited copy of a member (48 corresponding lines) codex-rs/hooks/src/events/compact.rs:76— codex-rs/hooks/src/events/compact.rs:76-123 | codex-rs/hooks/src/events/compact.rs:157-204 — These two members are one piece of code written twice and then edited apart: 48 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 copies of one member (3 members, 53+ corresponding lines) · ×1
Edited copies of one member (3 members, 53+ corresponding lines) codex-rs/rollout/src/list.rs:540— codex-rs/rollout/src/list.rs:540-596 | codex-rs/rollout/src/list.rs:604-656 | codex-rs/rollout/src/list.rs:664-720 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 53 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (64 corresponding lines) · ×1
Edited copy of a member (64 corresponding lines) codex-rs/protocol/src/models.rs:1672— codex-rs/protocol/src/models.rs:1672-1735 | codex-rs/protocol/src/models.rs:1739-1802 — These two members are one piece of code written twice and then edited apart: 64 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 (63 corresponding lines) · ×1
Edited copy of a member (63 corresponding lines) codex-rs/state/src/runtime/memories.rs:882— codex-rs/state/src/runtime/memories.rs:882-945 | codex-rs/state/src/runtime/memories.rs:959-1021 — These two members are one piece of code written twice and then edited apart: 63 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 copies of one member (3 members, 30+ corresponding lines) · ×1
Edited copies of one member (3 members, 30+ corresponding lines) codex-rs/tui/src/app_server_session.rs:2967— codex-rs/tui/src/app_server_session.rs:2967-2999 | codex-rs/tui/src/app_server_session.rs:3005-3035 | codex-rs/tui/src/app_server_session.rs:3042-3071 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 33+ corresponding lines) · ×1
Edited copies of one member (3 members, 33+ corresponding lines) codex-rs/rmcp-client/src/rmcp_client.rs:741— codex-rs/rmcp-client/src/rmcp_client.rs:741-776 | codex-rs/rmcp-client/src/rmcp_client.rs:848-880 | codex-rs/rmcp-client/src/rmcp_client.rs:886-920 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 33 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 31+ corresponding lines) · ×1
Edited copies of one member (4 members, 31+ corresponding lines) codex-rs/login/src/auth/manager.rs:2476— codex-rs/login/src/auth/manager.rs:2476-2511 | codex-rs/login/src/auth/manager.rs:2514-2544 | codex-rs/login/src/auth/manager.rs:2551-2585 | codex-rs/login/src/auth/manager.rs:2596-2629 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 31 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 26+ corresponding lines) · ×1
Edited copies of one member (3 members, 26+ corresponding lines) codex-rs/core-plugins/src/command_migration/render.rs:41— codex-rs/core-plugins/src/command_migration/render.rs:41-66 | codex-rs/external-agent-migration/src/rewrite.rs:81-112 | codex-rs/external-agent-migration/src/rewrite.rs:118-151 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (40 corresponding lines) · ×1
Edited copy of a member (40 corresponding lines) codex-rs/tui/src/chatwidget/streaming.rs:310— codex-rs/tui/src/chatwidget/streaming.rs:310-349 | codex-rs/tui/src/chatwidget/streaming.rs:728-767 — These two members are one piece of code written twice and then edited apart: 40 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 copies of one member (3 members, 29+ corresponding lines) · ×1
Edited copies of one member (3 members, 29+ corresponding lines) codex-rs/protocol/src/approvals.rs:384— codex-rs/protocol/src/approvals.rs:384-412 | codex-rs/tui/src/app.rs:406-447 | codex-rs/tui/src/approval_events.rs:73-111 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 29 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 22+ corresponding lines) · ×1
Edited copies of one member (4 members, 22+ corresponding lines) codex-rs/otel/src/metrics/client.rs:145— codex-rs/otel/src/metrics/client.rs:145-177 | codex-rs/otel/src/metrics/client.rs:185-206 | codex-rs/otel/src/metrics/client.rs:214-240 | codex-rs/otel/src/metrics/client.rs:273-300 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 22 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 15+ corresponding lines) · ×1
Edited copies of one member (3 members, 15+ corresponding lines) codex-rs/ext/memories/src/tools/list.rs:77— codex-rs/ext/memories/src/tools/list.rs:77-101 | codex-rs/ext/memories/src/tools/read.rs:76-98 | codex-rs/ext/memories/src/tools/search.rs:85-99 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 25+ corresponding lines) · ×1
Edited copies of one member (3 members, 25+ corresponding lines) codex-rs/app-server-transport/src/transport/remote_control/mod.rs:824— codex-rs/app-server-transport/src/transport/remote_control/mod.rs:824-849 | codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:336-360 | codex-rs/app-server-transport/src/transport/remote_control/websocket.rs:362-392 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 19+ corresponding lines) · ×1
Edited copies of one member (3 members, 19+ corresponding lines) codex-rs/rmcp-client/src/oauth/resolved_store.rs:105— codex-rs/rmcp-client/src/oauth/resolved_store.rs:105-128 | codex-rs/rmcp-client/src/oauth/resolved_store.rs:168-186 | codex-rs/rmcp-client/src/oauth/resolved_store.rs:349-368 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 24+ corresponding lines) · ×1
Edited copies of one member (3 members, 24+ corresponding lines) codex-rs/ext/skills/src/dynamic_skill_selector/lru_plus_character_routing.rs:40— codex-rs/ext/skills/src/dynamic_skill_selector/lru_plus_character_routing.rs:40-64 | codex-rs/ext/skills/src/dynamic_skill_selector/lru_plus_character_routing.rs:95-131 | codex-rs/ext/skills/src/dynamic_skill_selector/lru_plus_lexical.rs:32-55 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (46 corresponding lines) · ×1
Edited copy of a member (46 corresponding lines) codex-rs/core/src/codex_thread.rs:910— codex-rs/core/src/codex_thread.rs:910-955 | codex-rs/core/src/session/thread_settings.rs:102-147 — These two members are one piece of code written twice and then edited apart: 46 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 copies of one member (4 members, 18+ corresponding lines) · ×1
Edited copies of one member (4 members, 18+ corresponding lines) codex-rs/tui/src/chatwidget/plugin_catalog.rs:342— codex-rs/tui/src/chatwidget/plugin_catalog.rs:342-359 | codex-rs/tui/src/chatwidget/plugin_catalog.rs:361-380 | codex-rs/tui/src/chatwidget/plugin_catalog.rs:476-496 | codex-rs/tui/src/chatwidget/plugin_catalog.rs:501-518 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 18 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 15+ corresponding lines) · ×1
Edited copies of one member (5 members, 15+ corresponding lines) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1101— codex-rs/app-server-protocol/src/protocol/thread_history.rs:1101-1115 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:1156-1170 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:1216-1234 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:1275-1289 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:1321-1335 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 15 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 17+ corresponding lines) · ×1
Edited copies of one member (4 members, 17+ corresponding lines) codex-rs/core-plugins/src/startup_sync.rs:925— codex-rs/core-plugins/src/startup_sync.rs:925-941 | codex-rs/core-plugins/src/startup_sync.rs:947-964 | codex-rs/core-plugins/src/startup_sync.rs:970-987 | codex-rs/core-plugins/src/startup_sync.rs:993-1011 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 21+ corresponding lines) · ×1
Edited copies of one member (4 members, 21+ corresponding lines) codex-rs/state/src/runtime/memories.rs:1036— codex-rs/state/src/runtime/memories.rs:1036-1066 | codex-rs/state/src/runtime/memories.rs:1236-1256 | codex-rs/state/src/runtime/memories.rs:1335-1363 | codex-rs/state/src/runtime/memories.rs:1376-1405 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 21 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (7 members, 14+ corresponding lines) · ×1
Edited copies of one member (7 members, 14+ corresponding lines) codex-rs/tui/src/app/background_requests.rs:389— codex-rs/tui/src/app/background_requests.rs:389-404 | codex-rs/tui/src/app/background_requests.rs:412-428 | codex-rs/tui/src/app/background_requests.rs:435-448 | codex-rs/tui/src/app/background_requests.rs:457-475 | codex-rs/tui/src/app/background_requests.rs:483-499 | codex-rs/tui/src/app/background_requests.rs:524-541 | codex-rs/tui/src/app/background_requests.rs:563-583 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 20+ corresponding lines) · ×1
Edited copies of one member (3 members, 20+ corresponding lines) codex-rs/tools/src/json_schema/compaction.rs:87— codex-rs/tools/src/json_schema/compaction.rs:87-111 | codex-rs/tools/src/json_schema/compaction.rs:113-132 | codex-rs/tools/src/json_schema/compaction.rs:134-153 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 7+ corresponding lines) · ×1
Edited copies of one member (4 members, 7+ corresponding lines) codex-rs/network-proxy/src/socks5.rs:545— codex-rs/network-proxy/src/socks5.rs:545-551 | codex-rs/network-proxy/src/socks5.rs:559-565 | codex-rs/network-proxy/src/socks5.rs:567-573 | codex-rs/network-proxy/src/socks5.rs:575-581 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 9+ corresponding lines) · ×1
Edited copies of one member (4 members, 9+ corresponding lines) codex-rs/config/src/config_requirements.rs:365— codex-rs/config/src/config_requirements.rs:365-373 | codex-rs/config/src/config_requirements.rs:375-383 | codex-rs/config/src/permissions_toml.rs:253-261 | codex-rs/config/src/permissions_toml.rs:263-271 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 31+ corresponding lines) · ×1
Edited copies of one member (3 members, 31+ corresponding lines) codex-rs/cli/src/debug_sandbox.rs:55— codex-rs/cli/src/debug_sandbox.rs:55-87 | codex-rs/cli/src/debug_sandbox.rs:102-133 | codex-rs/cli/src/debug_sandbox.rs:139-169 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 31 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 10+ corresponding lines) · ×1
Edited copies of one member (4 members, 10+ corresponding lines) codex-rs/tui/src/app/background_requests.rs:80— codex-rs/tui/src/app/background_requests.rs:80-94 | codex-rs/tui/src/app/background_requests.rs:251-260 | codex-rs/tui/src/app/background_requests.rs:357-366 | codex-rs/tui/src/app/background_requests.rs:373-382 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 12+ corresponding lines) · ×1
Edited copies of one member (4 members, 12+ corresponding lines) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:842— codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:842-853 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:572-583 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:805-820 | codex-rs/tui/src/bottom_pane/request_user_input/mod.rs:822-837 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 11+ corresponding lines) · ×1
Edited copies of one member (6 members, 11+ corresponding lines) codex-rs/tui/src/bottom_pane/list_selection_view.rs:893— codex-rs/tui/src/bottom_pane/list_selection_view.rs:893-903 | codex-rs/tui/src/bottom_pane/list_selection_view.rs:905-915 | codex-rs/tui/src/bottom_pane/list_selection_view.rs:917-927 | codex-rs/tui/src/bottom_pane/list_selection_view.rs:929-939 | codex-rs/tui/src/bottom_pane/list_selection_view.rs:941-951 | codex-rs/tui/src/bottom_pane/list_selection_view.rs:953-963 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 8+ corresponding lines) · ×1
Edited copies of one member (5 members, 8+ corresponding lines) codex-rs/backend-client/src/client.rs:537— codex-rs/backend-client/src/client.rs:537-544 | codex-rs/backend-client/src/client.rs:689-701 | codex-rs/backend-client/src/client.rs:705-714 | codex-rs/backend-client/src/client/profile.rs:62-70 | codex-rs/backend-client/src/client/rate_limit_resets.rs:84-91 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 8 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (60 corresponding lines) · ×1
Edited copy of a member (60 corresponding lines) codex-rs/state/src/runtime/memories.rs:571— codex-rs/state/src/runtime/memories.rs:571-631 | codex-rs/state/src/runtime/threads.rs:13-72 — These two members are one piece of code written twice and then edited apart: 60 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 copies of one member (4 members, 11+ corresponding lines) · ×1
Edited copies of one member (4 members, 11+ corresponding lines) codex-rs/code-mode-host/src/grpc/session.rs:459— codex-rs/code-mode-host/src/grpc/session.rs:459-470 | codex-rs/code-mode-host/src/lib.rs:783-794 | codex-rs/code-mode/src/grpc_session/state.rs:66-76 | codex-rs/exec-server/src/local_process.rs:140-152 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 6+ corresponding lines) · ×1
Edited copies of one member (4 members, 6+ corresponding lines) codex-rs/ext/history-notes/src/extension.rs:194— codex-rs/ext/history-notes/src/extension.rs:194-200 | codex-rs/ext/mcp/src/plugin_contributor.rs:23-29 | codex-rs/ext/memories/src/extension.rs:168-174 | codex-rs/ext/web-search/src/extension.rs:170-175 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 4+ corresponding lines) · ×1
Edited copies of one member (3 members, 4+ corresponding lines) codex-rs/core/src/config/mod.rs:2807— codex-rs/core/src/config/mod.rs:2807-2810 | codex-rs/core/src/context/environment_context.rs:188-191 | codex-rs/ext/skills/src/host_roots.rs:443-446 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (3 corresponding lines) · ×1
Edited copy of a member (3 corresponding lines) codex-rs/core/src/exec_policy.rs:1168— codex-rs/core/src/exec_policy.rs:1168-1170 | codex-rs/tui/src/exec_command.rs:8-10 — These two members are one piece of code written twice and then edited apart: 3 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.
Duplicated block (56 lines × 2) codex-rs/protocol/src/models.rs:1673— codex-rs/protocol/src/models.rs:1673-1728 | codex-rs/protocol/src/models.rs:1740-1795 — both copies are in the same file, so extract the 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 `codex-rs/protocol/src/models.rs:1673` 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.
Duplicated block (52 lines × 2) codex-rs/app-server/src/request_processors/thread_lifecycle.rs:631— codex-rs/app-server/src/request_processors/thread_lifecycle.rs:631-682 | codex-rs/app-server/src/request_processors/thread_lifecycle.rs:683-734 — both copies are in the same file, so extract the 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/mention_codec.rs:222` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (38 lines × 3) codex-rs/core/src/session/mcp.rs:239— codex-rs/core/src/session/mcp.rs:239-276 | codex-rs/core/src/session/mcp.rs:357-394 | codex-rs/core/src/session/mcp.rs:945-982 — 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 (34 lines × 2) codex-rs/app-server-protocol/src/protocol/thread_history.rs:653— codex-rs/app-server-protocol/src/protocol/thread_history.rs:653-686 | codex-rs/app-server-protocol/src/protocol/thread_history.rs:693-726 — both copies are in the same file, so extract the 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 `codex-rs/app-server-protocol/src/protocol/thread_history.rs:653` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `payload` to `&AgentReasoningEvent` in one and `&AgentReasoningRawContentEvent` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (27–28 lines × 2) codex-rs/cli/src/login.rs:379— codex-rs/cli/src/login.rs:379-405 | codex-rs/cli/src/login.rs:423-450 — both copies are in the same file, so extract the 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–28 lines × 2) codex-rs/tui/src/bottom_pane/chat_composer.rs:2169— codex-rs/tui/src/bottom_pane/chat_composer.rs:2169-2196 | codex-rs/tui/src/bottom_pane/chat_composer.rs:3802-3826 — both copies are in the same file, so extract the 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 first that the copies are not typed on the same thing: the declarations holding them bind `now` to `Instant) -> (InputResult` in one and `Instant` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/chatwidget/plugin_catalog.rs:572` 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.
Duplicated block (24–25 lines × 4) codex-rs/tui/src/bottom_pane/chat_composer.rs:2228— codex-rs/tui/src/bottom_pane/chat_composer.rs:2228-2252 | codex-rs/tui/src/bottom_pane/chat_composer.rs:2311-2334 | codex-rs/tui/src/bottom_pane/chat_composer.rs:2398-2421 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/chat_composer.rs:2228` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `key_event` to `KeyEvent) -> (InputResult` in one and `KeyEvent` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/hooks/src/events/permission_request.rs:275` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (20–22 lines × 2) codex-rs/app-server-protocol/src/protocol/thread_history.rs:1761— codex-rs/app-server-protocol/src/protocol/thread_history.rs:1761-1780 | codex-rs/thread-store/src/local/rollout_migration/legacy_event.rs:72-93 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server-protocol/src/protocol/thread_history.rs:1761` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/streaming/controller.rs:310` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (18–20 lines × 2) codex-rs/app-server/src/request_processors/plugins.rs:1597— codex-rs/app-server/src/request_processors/plugins.rs:1597-1616 | codex-rs/app-server/src/request_processors/plugins.rs:1742-1759 — both copies are in the same file, so extract the 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.
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. 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 (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:197-212 — 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/core-plugins/src/command_migration/render.rs:51` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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.
Duplicated block (9–18 lines × 2) codex-rs/core/src/tasks/mod.rs:853— codex-rs/core/src/tasks/mod.rs:853-870 | codex-rs/ext/guardian-reviewer/src/metrics.rs:26-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/ext/guardian-reviewer/src/metrics.rs:26` 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. 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 (16–17 lines × 3) codex-rs/linux-sandbox/src/bwrap.rs:1028— codex-rs/linux-sandbox/src/bwrap.rs:1028-1043 | codex-rs/linux-sandbox/src/bwrap.rs:1330-1346 | codex-rs/linux-sandbox/src/bwrap.rs:1368-1384 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/linux-sandbox/src/bwrap.rs:1028` 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.
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 3 separate duplicated blocks between them, totalling at least 53 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/hooks/src/events/pre_tool_use.rs:268` 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.
Duplicated block (11–16 lines × 2) codex-rs/tui/src/bottom_pane/selection_popup_common.rs:576— codex-rs/tui/src/bottom_pane/selection_popup_common.rs:576-586 | codex-rs/tui/src/bottom_pane/selection_popup_common.rs:693-708 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/bottom_pane/selection_popup_common.rs:693` 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. 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 (14–15 lines × 4) codex-rs/analytics/src/events.rs:1547— codex-rs/analytics/src/events.rs:1547-1561 | codex-rs/core/src/hook_runtime.rs:1029-1042 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/analytics/src/events.rs:1547` 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. 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 (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 91 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs:79` 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.
Duplicated block (11–15 lines × 2) codex-rs/tui/src/app/managed_worktree_creation.rs:134— codex-rs/tui/src/app/managed_worktree_creation.rs:134-144 | codex-rs/tui/src/app/working_directory.rs:229-243 — 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 `codex-rs/tui/src/app/managed_worktree_creation.rs:134` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (14 lines × 3) codex-rs/core/src/unified_exec/process_manager.rs:692— codex-rs/core/src/unified_exec/process_manager.rs:692-705 | codex-rs/core/src/unified_exec/process_manager.rs:714-727 | codex-rs/core/src/unified_exec/process_manager.rs:802-815 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/core/src/unified_exec/process_manager.rs:728` calls `Err` and `codex-rs/core/src/unified_exec/process_manager.rs:706` 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 (11–14 lines × 2) codex-rs/tui/src/bottom_pane/selection_popup_common.rs:401— codex-rs/tui/src/bottom_pane/selection_popup_common.rs:401-411 | codex-rs/tui/src/bottom_pane/selection_popup_common.rs:560-573 — both copies are in the same file, so extract the 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. 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 (24–25 lines × 2) codex-rs/tui/src/cwd_prompt.rs:129— codex-rs/tui/src/cwd_prompt.rs:129-153 | codex-rs/tui/src/update_prompt.rs:64-87 — 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 `codex-rs/tui/src/cwd_prompt.rs:129` 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.
Duplicated block (12–13 lines × 7) codex-rs/hooks/src/events/compact.rs:267— codex-rs/hooks/src/events/compact.rs:267-278 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/hooks/src/events/compact.rs:267` 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. 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 (13 lines × 4) codex-rs/windows-sandbox-rs/src/acl.rs:173— codex-rs/windows-sandbox-rs/src/acl.rs:173-185 | codex-rs/windows-sandbox-rs/src/acl.rs:370-382 | codex-rs/windows-sandbox-rs/src/acl.rs:411-423 | codex-rs/windows-sandbox-rs/src/acl.rs:469-481 — 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. 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 (10–13 lines × 2) codex-rs/tui/src/bottom_pane/multi_select_picker.rs:584— codex-rs/tui/src/bottom_pane/multi_select_picker.rs:584-593 | codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:295-307 — 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 99 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/bottom_pane/skills_toggle_view.rs:295` 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.
Duplicated block (12 lines × 3) codex-rs/windows-sandbox-rs/src/acl.rs:589— codex-rs/windows-sandbox-rs/src/acl.rs:589-600 | codex-rs/windows-sandbox-rs/src/acl.rs:932-943 | codex-rs/windows-sandbox-rs/src/acl.rs:1039-1050 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/windows-sandbox-rs/src/acl.rs:589` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/rmcp-client/src/utils.rs:112` 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. 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 (26–29 lines × 2) codex-rs/tui/src/app_server_session.rs:2968— codex-rs/tui/src/app_server_session.rs:2968-2996 | codex-rs/tui/src/app_server_session.rs:3043-3068 — both copies are in the same file, so extract the 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `response` to `ThreadResumeResponse` in one and `&ThreadResumeResponse` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/config_panel/render.rs:136` 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.
Duplicated block (10–11 lines × 4) codex-rs/app-server/src/bespoke_event_handling.rs:1012— codex-rs/app-server/src/bespoke_event_handling.rs:1012-1022 | codex-rs/core/src/session/turn.rs:2512-2521 | codex-rs/rollout-trace/src/protocol_event.rs:518-527 | codex-rs/thread-manager-sample/src/main.rs:459-469 — 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.
Duplicated block (11 lines × 6) codex-rs/git-utils/src/apply.rs:465— codex-rs/git-utils/src/apply.rs:465-475 | codex-rs/git-utils/src/apply.rs:477-487 | codex-rs/git-utils/src/apply.rs:489-499 | codex-rs/git-utils/src/apply.rs:503-513 | codex-rs/git-utils/src/apply.rs:556-566 | codex-rs/git-utils/src/apply.rs:570-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/git-utils/src/apply.rs:465` 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.
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.
Duplicated block (7–10 lines × 3) codex-rs/tools/src/code_mode.rs:44— codex-rs/tools/src/code_mode.rs:44-53 | codex-rs/tools/src/code_mode.rs:172-178 | codex-rs/tools/src/code_mode.rs:203-210 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tools/src/code_mode.rs:203` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. 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 (21 lines × 3) codex-rs/tui/src/app_server_session.rs:2973— codex-rs/tui/src/app_server_session.rs:2973-2993 | codex-rs/tui/src/app_server_session.rs:3011-3031 | codex-rs/tui/src/app_server_session.rs:3048-3068 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/app_server_session.rs:2973` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `response` to `ThreadResumeResponse` in one and `&ThreadResumeResponse` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/tui/src/app_server_session.rs:3032` calls `clone` and `codex-rs/tui/src/app_server_session.rs:3069` does not — after which the two agree again for 3 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 (4–10 lines × 3) codex-rs/app-server-protocol/src/schema_fixtures.rs:278— codex-rs/app-server-protocol/src/schema_fixtures.rs:278-287 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server-protocol/src/schema_fixtures.rs:278` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/hooks/src/schema.rs:785` calls `iter`, `collect`, `sort_by_key` and `codex-rs/config/src/schema.rs:292` does not — after which the two agree again for 3 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 (4–10 lines × 4) codex-rs/otel/src/events/session_telemetry.rs:747— codex-rs/otel/src/events/session_telemetry.rs:747-750 | codex-rs/otel/src/events/session_telemetry.rs:845-854 | codex-rs/otel/src/events/session_telemetry.rs:910-919 | codex-rs/otel/src/events/session_telemetry.rs:961-964 — 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–10 lines × 2) codex-rs/tui/src/status/card.rs:559— codex-rs/tui/src/status/card.rs:559-568 | codex-rs/tui/src/status/card.rs:578-584 — both copies are in the same file, so extract the 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 `codex-rs/tui/src/status/card.rs:559` 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. 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/apply-patch/src/streaming_parser.rs:314` 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. 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 (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:264-267 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server-transport/src/transport/remote_control/enroll.rs:70` 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. 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `StartRemoteControlPairingRequest` in one and `RemoteControlPairingStatusRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/app-server-transport/src/transport/remote_control/enroll.rs:78` calls `retry_after_with_jitter`, `now_utc` and `codex-rs/app-server-transport/src/transport/remote_control/server_api.rs:267` 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/tui/src/external_agent_config_migration/mod.rs:102` 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. 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/tui/src/external_agent_config_migration/mod.rs:110` calls `Key`, `handle_key` and `codex-rs/tui/src/model_migration.rs:162` 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 (7–8 lines × 3) codex-rs/otel/src/metrics/client.rs:680— codex-rs/otel/src/metrics/client.rs:680-687 | codex-rs/otel/src/provider.rs:513-519 | codex-rs/otel/src/provider.rs:599-605 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/otel/src/metrics/client.rs:680` 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. 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 (6–8 lines × 2) codex-rs/core/src/session/mod.rs:1837— codex-rs/core/src/session/mod.rs:1837-1842 | codex-rs/core/src/session/mod.rs:1884-1891 — both copies are in the same file, so extract the 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.
Duplicated block (6–7 lines × 3) codex-rs/cloud-tasks/src/lib.rs:1102— codex-rs/cloud-tasks/src/lib.rs:1102-1107 | codex-rs/cloud-tasks/src/lib.rs:1869-1874 | codex-rs/cloud-tasks/src/lib.rs:1907-1913 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/cloud-tasks/src/lib.rs:1102` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/cloud-tasks/src/lib.rs:1867` calls `clear` and `codex-rs/cloud-tasks/src/lib.rs:1101` 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 (6–7 lines × 2) codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:575— codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:575-580 | codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:621-627 — both copies are in the same file, so extract the 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:580` calls `and_then`, `iter`, `position` and `codex-rs/tui/src/bottom_pane/mcp_server_elicitation.rs:627` does not — after which the two agree again for 3 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 (6 lines × 10) codex-rs/network-proxy/src/http_proxy.rs:827— codex-rs/network-proxy/src/http_proxy.rs:827-832 | codex-rs/network-proxy/src/http_proxy.rs:878-883 | codex-rs/network-proxy/src/http_proxy.rs:920-925 | codex-rs/network-proxy/src/http_proxy.rs:991-996 | 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:362-367 | codex-rs/network-proxy/src/socks5.rs:427-432 | codex-rs/network-proxy/src/socks5.rs:762-767 | codex-rs/network-proxy/src/socks5.rs:851-856 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/network-proxy/src/http_proxy.rs:827` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/network-proxy/src/http_proxy.rs:926` calls `method` and `codex-rs/network-proxy/src/socks5.rs:316` 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 (5–6 lines × 3) codex-rs/app-server/src/request_processors/thread_processor.rs:1225— codex-rs/app-server/src/request_processors/thread_processor.rs:1225-1230 | codex-rs/app-server/src/request_processors/thread_processor.rs:1355-1359 | codex-rs/app-server/src/request_processors/turn_processor.rs:1594-1599 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server/src/request_processors/thread_processor.rs:1225` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, 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. 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/cli/src/doctor/output.rs:311` 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. 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 (7 lines × 5) codex-rs/cloud-tasks/src/lib.rs:1103— codex-rs/cloud-tasks/src/lib.rs:1103-1109 | codex-rs/cloud-tasks/src/lib.rs:1176-1182 | codex-rs/cloud-tasks/src/lib.rs:1398-1404 | codex-rs/cloud-tasks/src/lib.rs:1870-1876 | codex-rs/cloud-tasks/src/lib.rs:1909-1915 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `codex-rs/cloud-tasks/src/lib.rs:1867` calls `clear` and `codex-rs/cloud-tasks/src/lib.rs:1101` 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 (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:1479-1483 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/cli/src/migrate_rollouts.rs:409` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/rollout/src/list.rs:1484` calls `path` and `codex-rs/cli/src/migrate_rollouts.rs:414` 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 (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.
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.
Duplicated block (47–51 lines × 2) codex-rs/state/src/runtime/logs.rs:93— codex-rs/state/src/runtime/logs.rs:93-139 | codex-rs/state/src/runtime/logs.rs:176-226 — both copies are in the same file, so extract the 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 `codex-rs/state/src/runtime/logs.rs:93` 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.
D4 · Code Duplication· Edited copy of a member (56 corresponding lines) · ×1
Edited copy of a member (56 corresponding lines) codex-rs/core/src/tools/handlers/test_sync.rs:141— codex-rs/core/src/tools/handlers/test_sync.rs:141-196 | codex-rs/rmcp-client/src/bin/test_stdio_server.rs:1069-1129 — These two members are one piece of code written twice and then edited apart: 56 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 copies of one member (3 members, 28+ corresponding lines) · ×1
Edited copies of one member (3 members, 28+ corresponding lines) codex-rs/rmcp-client/src/bin/test_stdio_server.rs:228— codex-rs/rmcp-client/src/bin/test_stdio_server.rs:228-265 | codex-rs/rmcp-client/src/bin/test_stdio_server.rs:267-294 | codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs:374-411 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 28 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
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:377-408 — 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 5 separate duplicated blocks between them, totalling at least 82 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:38` 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. 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs:408` calls `Some`, `read_only` and `codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:70` 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 (22–25 lines × 2) codex-rs/app-server-test-client/src/plugin_analytics_capture.rs:13— codex-rs/app-server-test-client/src/plugin_analytics_capture.rs:13-37 | codex-rs/app-server-test-client/src/plugin_analytics_smoke.rs:381-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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/app-server-test-client/src/plugin_analytics_capture.rs:13` 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. 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 (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:244-255 | codex-rs/rmcp-client/src/bin/test_streamable_http_server.rs:390-402 — before extracting anything, compare `codex-rs/rmcp-client/src/bin/rmcp_test_server.rs` and `codex-rs/rmcp-client/src/bin/test_stdio_server.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 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. Read the line range as the matched WINDOW rather than a finished unit: at `codex-rs/rmcp-client/src/bin/rmcp_test_server.rs:51` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with 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 (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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `codex-rs/app-server-test-client/src/lib.rs:681` calls `is_empty`, `Ok` and `codex-rs/app-server-test-client/src/lib.rs:712` 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 (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.
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.
Unstable project codex-web-search-extension — codex-web-search-extension has instability 0.92 with 1 dependents.
P12 · CI test-gate honesty· Test failure does not fail the CI gate · ×1
Test failure does not fail the CI gate REDACTED:47— `continue-on-error: true` lets the step or job that runs `pnpm -r --filter ./sdk/typescript run test` fail without failing the pipeline — the suite can go red and the change still merges. Remove it from the test step, or quarantine the specific failing tests instead.
Duplicated block (50 lines × 2 locations) codex-cli/bin/codex.js:26— codex-cli/bin/codex.js:26 · 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.
Duplicated block (16 lines × 2 locations) codex-cli/bin/codex.js:268— codex-cli/bin/codex.js:268 · 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.
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.
Complex function detectPackageManager (cyclomatic 13, cognitive 18) codex-cli/bin/codex.js:172— 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.
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.
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.
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.
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.
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.
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/tui/src/chatwidget/activity_presentation.rs:36— `!activity.is_empty() && !auxiliary.is_empty()` appears character-identically in 2 files — codex-rs/tui/src/chatwidget/activity_presentation.rs, codex-rs/tui/src/transcript_view.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/agent-identity/src/lib.rs:296— `!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:1336— `!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/windows-sandbox-rs/src/no_reparse_dir.rs:276— `!handle.is_null() && handle != INVALID_HANDLE_VALUE` appears character-identically in 2 files — codex-rs/windows-sandbox-rs/src/no_reparse_dir.rs, codex-rs/windows-sandbox-rs/src/unified_exec/tests.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:549— `!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:846— `!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:132— `!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:254— `(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/chatwidget/activity_presentation.rs:33— `activity.is_empty() && auxiliary.is_empty()` appears character-identically in 2 files — codex-rs/tui/src/chatwidget/activity_presentation.rs, codex-rs/tui/src/transcript_view.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:835— `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:2718— `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:1043— `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/tui/src/app/side_pane.rs:104— `app.zoomed_thread.is_some() && app.zoomed_thread == app.current_displayed_thread_id()` appears character-identically in 2 files — codex-rs/tui/src/app/side_pane.rs, codex-rs/tui/src/app/sidebar.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/src/realtime_conversation.rs:1498— `auth.is_chatgpt_auth() || auth.is_api_key_auth()` appears character-identically in 2 files — codex-rs/core/src/realtime_conversation.rs, codex-rs/exec-server-cli/src/config.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/src/client.rs:1387— `auth.is_some_and(CodexAuth::uses_codex_backend) && provider.is_openai() && provider.requires_openai_auth && provider.env_key.is_none() && pr…` appears character-identically in 2 files — codex-rs/core/src/client.rs, codex-rs/ext/guardian-v2/src/async_scorer/sampler/connection_pool.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.
Interpolated log message defeats structured logging codex-rs/tui/src/app_event_sender.rs:69— `error!` at line 69 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:1635— `warn!` at line 1635 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:1646— `warn!` at line 1646 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:1911— `error!` at line 1911 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:305— `debug!` at line 305 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:310— `debug!` at line 310 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:88— `debug!` at line 88 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:111— `debug!` at line 111 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:180— `debug!` at line 180 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:222— `debug!` at line 222 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:226— `debug!` at line 226 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:230— `debug!` at line 230 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:196— `warn!` at line 196 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:1288— `error!` at line 1288 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:1622— `error!` at line 1622 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:125— `warn!` at line 125 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:1000— `warn!` at line 1000 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:472— `warn!` at line 472 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`.
Silent fallback default on Err codex-rs/cli/src/doctor.rs:910— `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:1112— `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:232— `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:107— `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/agent/history.rs:57— `retained_items_for_fresh_child` 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/connectors.rs:432— `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:689— `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:277— `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:1146— `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/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:459— `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/ext/agent-message-board/src/mcp.rs:110— `contribute` 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:744— `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:222— `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.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 45 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/cli/src/doctor/filesystem_paths.rs, codex-rs/tui/src/markdown_render/math.rs, codex-rs/cli/src/doctor/background.rs, codex-rs/tui/src/markdown_render/math/render/structured.rs (+37 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 27 significant file(s) lose their only recent owner: codex-rs/codex-mcp/src/ema_auth.rs, codex-rs/git-utils/src/branch.rs, codex-rs/ext/skills/src/dynamic_skill_selector/character_ngram.rs, codex-rs/rollout/src/seekable_reader.rs, codex-rs/protocol/src/agent_path.rs, codex-rs/ext/memories/src/backend.rs, codex-rs/feedback/src/guardian.rs, codex-rs/ext/skills/src/dynamic_skill_selector/multi_query_lexical.rs (+19 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 20 significant file(s) lose their only recent owner: codex-rs/voice-host/src/devices.rs, codex-rs/tui/src/transcript_view/copy_mode.rs, codex-rs/tui/src/chatwidget/worktree_picker.rs, codex-rs/cloud-client/src/lib.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 (+12 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 19 significant file(s) lose their only recent owner: codex-rs/tui/src/transcript_view/select_mode.rs, codex-rs/tui/src/config_panel/render.rs, codex-rs/tui/src/transcript_view/select_mode/motion.rs, 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/markdown_copy/table.rs, codex-rs/tui/src/analytics/plot/annotations.rs (+11 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/guardian-context/src/preparation/transcript/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/guardian-context/src/transcript_record.rs, codex-rs/mxc-sandbox/src/lib.rs, codex-rs/windows-sandbox-rs/src/sandbox_utils.rs, codex-rs/exec-server/src/sandbox_integrity/telemetry.rs (+6 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #6 — If anonymized user #6 becomes unavailable, 7 significant file(s) lose their only recent owner: codex-rs/rollout-trace/src/reducer/tool/terminal.rs, codex-rs/rollout-trace/src/writer.rs, codex-rs/rollout-trace/src/reducer/inference.rs, codex-rs/rollout-trace/src/reducer/test_support.rs, codex-rs/rollout-trace/src/model/mod.rs, codex-rs/rollout-trace/src/model/session.rs, codex-rs/rollout-trace/src/lib.rs. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #7 — If anonymized user #7 becomes unavailable, 7 significant file(s) lose their only recent owner: codex-rs/windows-sandbox-service/src/registered_runtime/metadata.rs, codex-rs/windows-sandbox-rs/src/app_package.rs, codex-rs/windows-sandbox-rs/src/service_diagnostics.rs, codex-rs/windows-sandbox-service/src/registered_runtime/registration_result.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 #8 — If anonymized user #8 becomes unavailable, 6 significant file(s) lose their only recent owner: codex-rs/exec-server/src/discoverV2/capability_discoveries.rs, codex-rs/ext/mcp/src/cloud_plugin.rs, codex-rs/exec-server/src/discoverV2/capability_manager.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 #9 — If anonymized user #9 becomes unavailable, 6 significant file(s) lose their only recent owner: 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/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 #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: codex-rs/message-history/src/batch.rs, codex-rs/tui/src/bottom_pane/chat_composer/completion_target.rs, codex-rs/utils/pty/src/child.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 #12 — If anonymized user #12 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 #13 — If anonymized user #13 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 #14 — If anonymized user #14 becomes unavailable, 4 significant file(s) lose their only recent owner: bazel/rules/testing/wine/src/lib.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 #15 — If anonymized user #15 becomes unavailable, 4 significant file(s) lose their only recent owner: codex-rs/state/src/runtime/reclamation.rs, codex-rs/app-server/src/request_processors/feedback_rollout_history.rs, codex-rs/feedback/src/rollout_archive.rs, codex-rs/state/src/runtime/logs_maintenance.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/cli/src/doctor/desktop.rs, codex-rs/cli/src/doctor/desktop/macos_security.rs, codex-rs/feedback/src/upload.rs, codex-rs/feedback/src/report_upload.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/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 #18 — If anonymized user #18 becomes unavailable, 3 significant file(s) lose their only recent owner: codex-rs/login/src/auth/workload_identity.rs, codex-rs/workload-identity/src/exchange.rs, codex-rs/workload-identity/src/lib.rs. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #19 — If anonymized user #19 becomes unavailable, 3 significant file(s) lose their only recent owner: 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 #20 — If anonymized user #20 becomes unavailable, 3 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. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #21 — If anonymized user #21 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.
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/cloud-tasks-client/src/api.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/codex-api/src/endpoint/realtime_websocket/protocol_frameless_bidi.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/core-plugins/src/artifact_operation.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.
D30 · Dependency Vulnerabilities· Medium advisory (unmaintained) · ×11
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
D30 · Dependency Vulnerabilities· Medium vulnerability · ×6
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 29 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 (234 single-owned of 2766 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; 2766 of the 3625 production source files in this repository met that bar). They are anonymized user #22 (2 file(s)), anonymized user #23 (2 file(s)), anonymized user #24 (2 file(s)), anonymized user #25 (2 file(s)), anonymized user #26 (2 file(s)), anonymized user #27 (2 file(s)) (+23 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/rmcp-client/src/ema_resource.rs, codex-rs/rmcp-client/src/oauth/enterprise_generation.rs, codex-rs/cli/src/migrate_rollouts.rs, codex-rs/thread-store/src/local/rollout_migration/telemetry.rs, codex-rs/cli/src/mcp_login.rs, codex-rs/rmcp-client/src/oauth_callback_input.rs, codex-rs/login/src/oauth/error.rs, codex-rs/app-server-protocol/src/protocol/v2/bedrock.rs (+28 more).
No ADRs found codex-rs/windows-sandbox-service/Cargo.toml:12— 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/`. ADRs are expected here because `codex-rs/windows-sandbox-service/Cargo.toml` makes this repository a deployable product (line 12).
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 11 of 175 project(s) overshoot their size bounds, lowering Project Cohesion to 8.7/10. The most over is `codex-rs/tui` (311041 LoC, 529 module-visible types across 55 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) — 12 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/codex-api/src/endpoint/realtime_websocket/protocol_frameless_bidi.rs, codex-rs/utils/sleep-inhibitor/src/lib.rs, codex-rs/core-plugins/src/artifact_operation.rs, codex-rs/utils/sleep-inhibitor/src/macos.rs (and 4 more) (13 orphaned of 2766 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; 2766 of the 3625 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.
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.
Logging is not universal — Only 74/90 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 11 more.
P3 · Security & performance tooling· Dependabot does not watch uv · ×1
Dependabot does not watch uv .github/dependabot.yaml:4— `.github/dependabot.yaml` schedules updates, but no `package-ecosystem` entry covers `uv`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list.
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.
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:170).
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.
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.
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.5 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: async-lock — `async-lock` is locked at 3.4.2 but 3.5.0 is the current stable release on crates.io, and it already satisfies the `"3"` requirement declared in codex-rs/linux-sandbox/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p async-lock` and commit the updated REDACTED.
Outdated: aws-config — `aws-config` is locked at 1.8.12 but 1.13.2 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.5 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.21.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-runtime-api` and commit the updated REDACTED.
Outdated: aws-smithy-types — `aws-smithy-types` is locked at 1.4.7 but 1.9.4 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.11.2 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.44 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.11 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.
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.
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.
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.
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.
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.
Run 01a1da49-5f17-7b9c-802e-012c7588d534 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 64 · Warnings: 5226 · Recommendations: 185 · Info: 94 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 14-11-2026 @ 13:40 UTC.
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.